Commit Graph

40 Commits

Author SHA1 Message Date
Lorenzo Blasa
4d5bf8084b Remove feedback request
Summary: It has served its purpose, remove.

Reviewed By: LukeDefeo

Differential Revision: D43769239

fbshipit-source-id: 36fb575b15fe9d092c7728a56b735ff98ff78608
2023-03-03 07:33:24 -08:00
Luke De Feo
f12d8221d6 Fixed issue where visualiser would crop bottom few pixels of screen
Summary:
Fixes https://fb.workplace.com/groups/443457641253219/permalink/522118536720462/

On android for some reason our display metrics for the application, activity and winow were smaller than the decor view. We were using the root view as the base static view for the visualiser with overflow hidden. Since it will slightly smaller than the decor view we were losing some of the lower pixels of the snapshot

The decor view is the one that is actually snapshot so any bounds for nodes above are meaningless . The fix is to simply have the visualiser start at the snapshot view. We know this bounds is correct.

Tested on ios and android and all looks ok

Reviewed By: lblasa

Differential Revision: D43356523

fbshipit-source-id: 4d6177c8242365f33b1d64fc149a10baff7c85d6
2023-02-17 02:45:05 -08:00
Luke De Feo
d24343d2ac Make the visualiser scrollable and remember width
Summary:
Previously If you set the visualiser too wide, the height adjusts with the aspect ratio and  the bottom was cut off and there was no way to scroll. Have added a scrollbar if it exceeds the available height

Also the width state was promoted to an atom so the users resize amount is preserved when moving between plugins

A better solution might be to prevent the visualiser from getting too wide for the available hieght but it get complex when the window resizes.

Reviewed By: lblasa

Differential Revision: D43351294

fbshipit-source-id: f618a69ed025214593a74b952ce75c5fd98447cd
2023-02-17 02:45:05 -08:00
Luke De Feo
1cd916e414 Increase indent and automatically scroll horiztonally on selection
Summary:
Indent is made bigger so the horizontal lines have more space and the whole thing can breath more. To componesate the view scroll horiztontally so that the tree node is always visible. Was also able to clean up the hierachy a bit

changelog: increase tree indent and automatically scroll both horizontally and vertically when selecting an element

Reviewed By: lblasa

Differential Revision: D43311566

fbshipit-source-id: 53bc7bd55027e87fdecadac9aa8bc41612bb684a
2023-02-17 02:45:05 -08:00
Luke De Feo
d1e6b27358 Remove gap between tree scroll bar and visualiser resize handle
Summary:
So much tidier

changelog: UIDebugger remove gap between tree and visualiser

Reviewed By: lblasa

Differential Revision: D43307743

fbshipit-source-id: ceec9b3b164c93ecadfe8c0b7299a978b2915e3b
2023-02-17 02:45:05 -08:00
Luke De Feo
8581aa1944 Memoise selection of nodes
Summary:
For the visualiser we use the same trick as with the hover state. We subscribe to selection changes and only render if the prev or new state concerns us.

For the tree we change from object identity to the node id + and indent guide are added to the memoisation equal check.

Depending on teh change this tree memoisation can vary in effectiveness. If you go from nothing selecting to selecting the top element nothing is memoised since react needs to render every element to draw the indent guide. If you have somethign selected and select a nearby element the memoisation works well.

There are ways to improve this more down the road

changelog: UIDebugger improve performance of selecting nodes

Reviewed By: lblasa

Differential Revision: D43305979

fbshipit-source-id: 5d90e806ed7b6a8401e9968be398d4a67ed0c294
2023-02-17 02:45:05 -08:00
Lorenzo Blasa
dacc6ebb16 Feedback request
Summary:
^

Only for iOS this time.

Note: passing the device OS freely to the main component as this is just temporary code that will be deleted soon.

Reviewed By: antonk52

Differential Revision: D42990221

fbshipit-source-id: 41b4107caa6bf312191889af75afd28873f6eda5
2023-02-03 07:43:00 -08:00
Luke De Feo
df9b0a6aa6 Use react query to cache myles query
Summary: The call to myles was a little slow and very cachable so use react query. Additionally it depends on VPN / light so added an error state to make that clear.

Reviewed By: lblasa

Differential Revision: D42990344

fbshipit-source-id: 8d6ad20aea79f1972a7cf1f61f8af729e5f3464f
2023-02-03 04:38:51 -08:00
Lorenzo Blasa
49403df95f Remove survey banner
Summary:
^

Not removing the component, yet, as we may re-introduce the survey once we officially release on iOS.

Reviewed By: antonk52

Differential Revision: D42499399

fbshipit-source-id: 596ebda7acf39c0b8377bbd3a1a8f4dfa81e59a4
2023-01-13 07:36:20 -08:00
Luke De Feo
989797a225 Dynamic scaling of visualizer and resizable window
Summary: Fixes https://fb.workplace.com/groups/443457641253219/permalink/480446154221034/

Reviewed By: mweststrate

Differential Revision: D42095625

fbshipit-source-id: 364577141f2819dd22b0b499b11770d0bb88b1f5
2022-12-16 03:47:58 -08:00
Luke De Feo
8242a94ca4 Rename tree
Reviewed By: lblasa

Differential Revision: D41875028

fbshipit-source-id: a3afd0014798f03cbaefac3f9128b4e92bccb290
2022-12-12 07:28:37 -08:00
Luke De Feo
74247ee721 Remove react complex tree
Reviewed By: lblasa

Differential Revision: D41875029

fbshipit-source-id: 2af58610fe0d0f644aa8450a4210fd52f8ed4db6
2022-12-12 07:28:37 -08:00
Luke De Feo
a6544489f3 Basic new tree implemenation
Summary: The old implementation would always rerender on every operation (select, hover etc) and was quite slow for large hierachies

Reviewed By: lblasa

Differential Revision: D41838166

fbshipit-source-id: 1270841027926440a9c1f1a846d3aedc75ffe8bf
2022-12-12 07:28:37 -08:00
Lorenzo Blasa
df960aee80 Show empty sidebar when no node is selected
Summary: ^

Reviewed By: LukeDefeo

Differential Revision: D41549165

fbshipit-source-id: 7f6324c8e04b8c7db3afe1e4cc5e1cbe0c023b7c
2022-11-29 10:39:14 -08:00
Lorenzo Blasa
a8f8e081c5 Feedback request banner
Summary:
This change adds a small feedback alert banner. It will have a link to our workplace feedback group.

Additionally, it asks engineers to record their sessions.

Reviewed By: LukeDefeo

Differential Revision: D41531851

fbshipit-source-id: 7ec8ca79350e7a84ab0532065bc57187ef0055ba
2022-11-28 11:21:24 -08:00
Luke De Feo
b214806325 Add padding and refactor our controls component
Summary: also made the controls component full width to push down the visualiser

Reviewed By: lblasa

Differential Revision: D41548665

fbshipit-source-id: 2bca527e70c92bc0ded120e51a0880f76f7cca87
2022-11-28 05:09:20 -08:00
Luke De Feo
57dcf72763 Added ability to pause the incoming updates from the client
Summary: There were a few subtleties around what to the auto expanding / collapsing for active children but otherwise this is quite straightforward

Reviewed By: lblasa

Differential Revision: D41548252

fbshipit-source-id: c153d00210d859463a51753dadf2e5aabeb7ea35
2022-11-28 05:09:20 -08:00
Luke De Feo
6bb541a33f Group app wide ui state into one object
Summary: Should be a bit easier to see what UI state we are holding at the plugin instance level

Reviewed By: lblasa

Differential Revision: D41498272

fbshipit-source-id: 6d88086766efd9c39f71be7e2ce32c5058494c96
2022-11-24 09:23:16 -08:00
Luke De Feo
01f7fa34e5 Remove per node snapshot in favour of single top level snapshot
Summary: In order to support focus mode we need to have only 1 snapshot. In practice this is the case but we are making this more apparant in this diff.

Reviewed By: lblasa

Differential Revision: D41493003

fbshipit-source-id: 19ed7213d15adaea4732f4ec60309efa8dae6f94
2022-11-24 09:23:16 -08:00
Luke De Feo
b576060339 Pretty loading spinner
Reviewed By: antonk52

Differential Revision: D41343098

fbshipit-source-id: 69b75e7a93344d2a05fa6fac9f466126feaf8cad
2022-11-24 09:23:16 -08:00
Luke De Feo
3722ac1fea Permanent search bar
Summary: Out of the box the library search has some issues. when search matches it steals focus from the input. Eventually we want to customise the rendering of the tree items anyway so this lays the foundation for taht

Reviewed By: antonk52

Differential Revision: D41336524

fbshipit-source-id: 194f67023edd0675cd9bd8d6134260439c6b2785
2022-11-24 09:23:16 -08:00
Luke De Feo
062e87f50f Use mouse position for hit test for 2D vizualizer
Summary:
The Dom events for the divs that are very close together were not firing correctly causing the old implementation to not track the hovered node correctly. This was really frustrating trying to select a node amongst many close neighbours.

The new approach uses the mouse x,y position and performs a hit test. Currently we do a dfs looking for the first deepest child that interests the mouse x,y. In a future diff we will extract a list when there are multiple candidates.

Hovered node was removed from react props since both the tree and visualisor depend on it meaning when hover state changes the whole app is rerendered. Instead we have moved hover state to an atom which is subscribed to by each visualsation node. Only if the old or new value matches the particular nodes id do we set state. The viz nodes were memo'd to prevent children renderning. The result is that for a hover change at most 2 nodes out of the 500 or so will rerender.

I attempted to do the same with the tree but it wasnt working with the controlled tree environment + focus state. The perf seems fine as is so will leave it for now

Reviewed By: lblasa

Differential Revision: D41218324

fbshipit-source-id: 7f80bcee256abad2689a88d7e209f92417aab672
2022-11-14 07:05:58 -08:00
Lorenzo Blasa
01dc22b1ab Attributes Metadata
Summary:
Before this change, attributes and attribute metadata were intermingled and sent as one unit via subtree update event.

This represented a few issues:
- Repetitiveness. For each declared and dynamic attribute, metadata was included on each value unit.
- Metadata can vary in size and thus can have a negative impact on payload size.
- The attribute name which is part of metadata is a string which always overhead on processing.
- Metadata instantiation is not cheap thus this also incurs in processing overhead i.e. even instantiating a single string can have an impact.

The proposal is to separate metadata of attributes from the actual node reported attributes. This solves the problems mentioned above.

Reviewed By: LukeDefeo

Differential Revision: D40674156

fbshipit-source-id: 0788551849fbce53065f819ba503e7e4afc03cc0
2022-11-10 11:52:28 -08:00
Luke De Feo
f282a5eb8a Ant tree -> React complex tree
Summary:
Upgraded from ant tree library to the much more capable React complex tree. Added the following:
1. Ability to expand / collapse nodes while automatically expanding / collapsing active/inactive children when they change
2. Keyboard controls of tree all the time
3. Basic search functionality
4. Selecting node in tree focuses and scrolls in the tree
5. Hover state for tree

Reviewed By: lblasa

Differential Revision: D40633876

fbshipit-source-id: 8dcef5ec2c277e476a3eb3cdaef62b15c25323c0
2022-10-25 07:10:38 -07:00
Lorenzo Blasa
bb3b1cecef Simple antd types for each inspectable type
Summary:
Replace draft inspectors with read-only components.

This is a first step into having a richer UI. At the moment, these are read-only components but will likely be extended in the future as to allow editing of values.

Reviewed By: LukeDefeo

Differential Revision: D40345016

fbshipit-source-id: a6aef5861474b4aa8353c00ef257ab17b4cff00e
2022-10-25 03:09:00 -07:00
Lorenzo Blasa
c46ddf7912 Foundations for inspector
Summary:
^

This laids the foundation for the inspector. It just reorganises a few bits.

Reviewed By: LukeDefeo

Differential Revision: D40319611

fbshipit-source-id: 8cf9b151c631faa1f26a7a6dfaa86b01abc42fe5
2022-10-25 03:09:00 -07:00
Lorenzo Blasa
ee9415a8d4 Be able to handle different snapshots for different roots
Summary:
^

This change allows to take different snapshots for different nodes and render them each on the visualiser.

At the moment, more than likely, this is not really used. At the same time, it fixes an issue whereas any subtree update can override and set the only visible snapshot.

Reviewed By: LukeDefeo, antonk52

Differential Revision: D39821920

fbshipit-source-id: ab8f6a4a2a5e96801c951a4e3009cc571a617f22
2022-09-27 13:00:04 -07:00
Lorenzo Blasa
945e26d0f1 Snapshots on Visualiser
Summary:
^

TODO: the snapshot corresponds to the referring subtree update. However, the snapshot is getting applied as if it was the current top view of the running app. This is true in most cases but it doesn't for some. To solve this, we need to use the rootId for the subtree and apply the snapshot only if appropriate.

Having said that, is good enough for the current submission as we keep iterating on it.

Reviewed By: LukeDefeo

Differential Revision: D39813307

fbshipit-source-id: 33b6aff6e9dd085934150ebd2f247062447a59ff
2022-09-27 13:00:04 -07:00
Luke De Feo
67ff09563c Improved interaction between tree and visualizer
Summary:
Improved the 2 way relationship between tree and vizualiser. There are 3 states.
1. Select, this is when you click on either tree node or view. View is highlighted darker colour, sidebar shows up for that node and select is persisted when you mouse away
2. Hover, this is when you hover over a tree node or in the vizualizer, the node is highlighted a lighter colur
3. Hover while holding control - same as hover but we dont draw any children, this lets you see how parent nodes appear without their children

Reviewed By: lblasa

Differential Revision: D39695661

fbshipit-source-id: 623e479fb03567e9f15a4a4f9201b2c7884cabe4
2022-09-22 04:26:18 -07:00
Luke De Feo
f3b7552338 2D wire frame highlight from tree, select from wireframe
Summary:
Introduced some basic bidirectional link between tree and wireframe, the specific interaction will need some tweaking but this should get us started.

When hovering over the tree we halt the rendering of the wireframe up to that point, this allows us to explore parent views that layout child views.

When clicking a view in the wireframe it is 'seleceted' as if it was clicked in the tree. This set the tree selection so you can identify it in the tree as well as opens the side bar

Reviewed By: lblasa

Differential Revision: D39539277

fbshipit-source-id: 3beb1ad4cb56b398c640ac3e7fac2cc97f3f1a18
2022-09-21 07:02:48 -07:00
Luke De Feo
cf176bb071 Basic 2D wireframe
Summary: Basic visual wireframe for the purposes of verifying that our captured view hierachy is correct, the actual version we ship will hopefully be a lot better :)

Reviewed By: lblasa

Differential Revision: D39539278

fbshipit-source-id: 73d926ff1990f09ca9877430cb227f690d05d1d4
2022-09-21 07:02:48 -07:00
Luke De Feo
c7f24eb469 Refactor UI
Summary: Split our the mega component into separate parts in preparation for the visualizer

Reviewed By: lblasa

Differential Revision: D39509406

fbshipit-source-id: 0f867c1f8a91b7592673ae47ba2b5db4f3500732
2022-09-21 07:02:48 -07:00
Luke De Feo
24ec43eb92 Add observer type to Perf event
Summary: While looking at the event stream it is useful to know which observer type fired it

Reviewed By: lblasa

Differential Revision: D39430756

fbshipit-source-id: bc52f085a5497692f8076b12a9c015cc33a19d1e
2022-09-13 11:05:42 -07:00
Luke De Feo
9a270cdc7a Tree observer
Summary:
Added concept of a tree observer which is responsible for listening to the changes for a portion of the UI tree. This structure nests so Tree observers can hold child tree observers which emit events on a different cadence. This structure should allow us to incorporate different UI frameworks down the road as well as native android views.

We push the tree updates from the tree observers onto a channel and setup a coroutine to consume this channel, serialize and send down the wire.

Reviewed By: lblasa

Differential Revision: D39276681

fbshipit-source-id: a4bc23b3578a8a10b57dd11fe88b273e1ce09ad8
2022-09-12 03:48:43 -07:00
Luke De Feo
c76c993ce4 Introduced concept of active child
Summary: A node can have an active child, if present we assume all others are inactive and we don't traverse them. This means the activities not on top and view pager views not active will not be scanned. Additionally on the desktop we are automatically collapsing these views. The net result is a lot less work done on the main thread

Reviewed By: lblasa

Differential Revision: D39310126

fbshipit-source-id: ebd0c69d46f2d42fe42e678c8327fcdc73d08385
2022-09-12 03:48:43 -07:00
Lorenzo Blasa
ccec5a6abe Add a very simple attributes inspector
Summary: Add a very simple attributes inspector

Reviewed By: LukeDefeo

Differential Revision: D39306728

fbshipit-source-id: 0e46b3efc617253d0b3006e81a46f00fdf8e8457
2022-09-07 06:46:41 -07:00
Luke De Feo
41068d1c90 Native UI scan
Summary: Added scheduler to scan the Native UI every 500 ms to test, Also added instrumentation in a separate event with the timings of each stage visualised in a Data table on desktop which can be accessed with ctrl+I. Currently this instrumentation event is sent every time but it could be a config option controlled from the desktop in the future

Reviewed By: lblasa

Differential Revision: D39205313

fbshipit-source-id: ca034171db6b062396b4ef28028aaa663c4d852a
2022-09-07 04:37:17 -07:00
Luke De Feo
a5da6923eb Flatten layout during traversal
Summary: Move from a nested structure to a flatten one for data exchange, this will allow us to only send sections of the UI in the future

Reviewed By: lblasa

Differential Revision: D38982138

fbshipit-source-id: d578a07a6d2d7e117fbd741bd6e33062223ce10d
2022-09-07 04:37:17 -07:00
Luke De Feo
55b852f90c Basic tree UI
Summary: A very basic tree in Antd to visualise the UI

Reviewed By: lblasa

Differential Revision: D38977035

fbshipit-source-id: f9bbf765ea8027eeb263cad86407502c6a5779dd
2022-09-07 04:37:17 -07:00
Luke De Feo
f1e80b18b1 Basic desktop plugin
Summary:
Scaffolded desktop UI for UI debugger
I changed getroot from an rpc call to an event sent on connect. The root should never change as its the application object.

Reviewed By: lblasa

Differential Revision: D38866008

fbshipit-source-id: ca0f1908bedb643238f11ed796922e3359619167
2022-08-22 03:02:53 -07:00