Summary:
This is the first of many diffs that extracts the connection, device, client detection out of the flipper core, to create a reusable flipper-server library that can be used in e.g. flipper-dump.
To keep diffs a little smaller, the current connection logic is first moved to the `server/` directory, and decoupled manually from the rest of the core, before moving it over to a separate package.
This first diffs moves the `comms/`, `devices/` and certificate utilities to the `server` directory.
Further untangling will follow in next diffs
Reviewed By: timur-valiev
Differential Revision: D30246551
fbshipit-source-id: c84259bfb1239119b3267a51b015e30c3c080866
Summary: Introduce `Dialog.alert` to show users a FYI message, and be able to wait for it to be handled, as utility around several `Modal` utilities.
Reviewed By: jknoxville
Differential Revision: D29875484
fbshipit-source-id: 5d2ea83e486631ac18a81800b467f97dfaac6d34
Summary: Introduce convenience abstractions to make it easier to manage dialogs imperatively, by promisyfying common dialog abstractions.
Reviewed By: jknoxville, nikoant
Differential Revision: D29790462
fbshipit-source-id: c092c15cf569ec353b9c1042f25cd67e6c76db01
Summary:
Some folks were missing the copy as text ManagedTable used to have, so introduced both the options to either copy as text (visible columns or custom copy handler) or as JSON
Changelog: It is now possible to both copy as text or as JSON from data tables
Reviewed By: jknoxville
Differential Revision: D29712096
fbshipit-source-id: 27bd2e869a247bd0896ce2774c08651123fd531d
Summary:
This stack reduces our direct dependency on Electron, for example by exposing our own API to open links.
Also exposing `getFlipperLib` as API from `flipper-plugin`, so that these utility methods are available outside plugin contexts as well.
Reviewed By: timur-valiev
Differential Revision: D29661689
fbshipit-source-id: 0c0523326eeb0d9d8fbe3e03c4609327bb53596b
Summary:
Per title.
Feature will be used in several plugins in next diffs.
Differential Revision: D29514456
fbshipit-source-id: c12427c2a7c53fa01cd1c7f429be8611be55496d
Summary:
Changelog: [Flipper] Improve serialisation mechanism format & speed
The default serialisation mechanism used by Flipper to serialise plugin states is very flexible, taking care of maps, sets, dates etc. However, it is also really slow, leading to issues like in the related tasks, and work arounds like D17402443 (98bc01618f) to skip the whole process for plugins.
This diff changes the serialisation mechanism to have a better trade off between speed and convenience: For now we will only apply the smart serialisation for objects living at the _root_ of the serialised object, but it won't be applied recursively.
This sounds like a dangerous change, but works well in practice:
* I went through all `persistedState` and `createState` definition (the types), and the idea that complex types like Map and Set only live at the root of the persisted state holds up nicely. That makes sense as well since plugins typically store literally the same data as that they have received over the wire, except that they put it in some maps, sets etc.
* I introduced `assertSerializable` that only runs in dev/test, which will check (recursively, but without all the cloning) to see if a tree is indeed serialisable.
* The fact that by swapping this mechanism rarely existing unit test for exportData needed changes proves that the assumption that only roots are relevant generally upholds (or that plugin authors don't write enough tests ;-)).
* I verified that popular plugins still import / export correctly (actually *more* plugins are exportable now than before, thanks to sandy wrapper introduced earlier)
Reviewed By: jknoxville
Differential Revision: D29327499
fbshipit-source-id: 0ff17d9c5eb68fccfc2937b634cfa8f4f924247d
Summary: per title. As follow up for previous diff
Reviewed By: fabiomassimo
Differential Revision: D28965865
fbshipit-source-id: 440c8143ac44011d895b3f194cabe7c69c51af72
Summary:
Code blocks are quite common in Flipper, and a bit verbose in Ant, so let's standardize!
Changelog: Standardize CodeBlock component
Reviewed By: passy
Differential Revision: D28117560
fbshipit-source-id: 5a5538a49b59ef40c814d22055fac56e7598cbbb
Summary: Flipper Sandy plugins didn't have an event to hook into that is run _after_ any state snapshot is loaded, which was needed by the graphQL plugin, as they do some post processing when a data snapshot is restored.
Reviewed By: passy
Differential Revision: D28189573
fbshipit-source-id: 4ef992f3fafc32787eab3bc235059f2c41396c80
Summary:
Noticed in reviews during the convertathon there is still quite some boilerplate in things that happen on the boundary of UI and plugin state, such as setting up menu entries and providing common functionality like clear, master/detail layout, etc.
This diff introduces the `MasterDetail` component, which takes a higher level approach by merely needing to provide the state atoms and desired features, and taking care of the wiring.
Applied it to createTablePlugin, to prove that going from `createTablePlugin` to `MasterDetail` will be a much smaller step now.
Verified on the funnel logger plugin
Reviewed By: passy
Differential Revision: D28090362
fbshipit-source-id: 146f8c315fea903901ad4e3e46711642f16cf0e6
Summary: This diff exposes the createTablePlugin from flipper-plugin, so that createTablePlugin based plugins can be converted to Sandy as well
Reviewed By: jknoxville
Differential Revision: D28031227
fbshipit-source-id: 8e9c82da08a83fddab740b46be9917b6a1023117
Summary: Moved Toolbar to flipper-plugin. No further changes.
Reviewed By: nikoant
Differential Revision: D28027334
fbshipit-source-id: 35de13d87734ae3a8af037166945b1a669106274
Summary:
In many cases, the onExport handler doesn't try to customise the format, but merely fetch some additional information before creating an export.
By allowing the `onExport` handler to also return nothing, and instead merely update existing state, this case will be easier to express now;
Reviewed By: nikoant
Differential Revision: D28026558
fbshipit-source-id: 2b90b3e1ced6a6a5b42938b6f6b74b0eb9ceafc0
Summary: Allow subscribing to Atom state changes
Reviewed By: mweststrate
Differential Revision: D28027692
fbshipit-source-id: 24fd7ea16b013c364bbb1d25b30c48bc698db014
Summary: The `logger` was currently only available in a React context, and not directly exposed from the `client` API as well. This diff fixes it. The infrastructure including test stubs were present already, so the change is minimal.
Reviewed By: nikoant
Differential Revision: D28010120
fbshipit-source-id: cdd09ed236f5d92d07005d4e5a699360596281e4
Summary: Introduce the DataList component. Not feature complete yet, but core functionality is present so that people can use it during the convertathon. It is used to implement the route list in the network mock dialog
Reviewed By: priteshrnandgaonkar
Differential Revision: D27046716
fbshipit-source-id: a247ce7032b350b31bf55962ca4268e30f43471a
Summary: Expose a Panel api from Sandy, which is quite similar to the old one, except that it uses Antd, and it will remember the users closed / open preference through sessions, a much requested feature.
Reviewed By: nikoant
Differential Revision: D27966607
fbshipit-source-id: 9b18df377215c1e6c5844d0bf972058c8c574cbb
Summary: Per discussion in parent diff, fixed the links to be idiomatic so that they work in both internal and public builds
Reviewed By: jknoxville
Differential Revision: D27963896
fbshipit-source-id: 35504b04e8975acc419be668804c5d7ad7aa2a16
Summary:
This diff moves the core of ElementsInspector to flipper-plugin and decouples it from legacy design system and Electron, without any significant improvements or API changes yet, which will follow later.
Colors and docs will be added later in this stack.
Reviewed By: passy
Differential Revision: D27660300
fbshipit-source-id: 96abfa3b3174fa852cf04ae119c23c3d629fee74
Summary:
This diff moves the rest of the DataInspector jungle to flipper-plugin. No actual improvements are made yet, but the code is decoupled from Electron and the legacy theming. For example by using Antd based context menus.
Note that `ManagedDataInspector` is now rebranded `DataInspector`, as that is the only variation that should (and is) used publicly.
For the interactionTracker removal, see next diff.
SearchableDataInspector will be addressed in a next diff
Reviewed By: passy
Differential Revision: D27603125
fbshipit-source-id: 188bd000260e4e4704202ce02c7fc98319f0bc22
Summary: This moves `<DetailSidebar>` component to `flipper-plugin` and documents it. No semantic changes.
Reviewed By: passy
Differential Revision: D27234575
fbshipit-source-id: 74640602d718f84ad999f5dac0420089796ed7fb
Summary:
Beyond a search across all columns, it is now possible to specific columns for specific values:
* for a row to be visible, all active column filters need to be matched (e.g. both a filter on time and app has to be satisfied)
* if multiple values within a column are filtered for, these are -or-ed.
* if no value at all within a column is checked, even when they are defined, the column won't take part in filtering
* if there is a general search and column filters, a row has to satisfy both
Filters can be preconfigured, pre-configured filters cannot be removed.
Reseting will reset the filters back to their original
Move `useMemoize` to flipper-plugin
Merged the `ui/utils` and `utils` folder inside `flipper-plugin`
Reviewed By: nikoant
Differential Revision: D26450260
fbshipit-source-id: 11693d5d140cea03cad91c1e0f3438d7b129cf29
Summary:
First rudementary setup of DataTable component that follows a data source. Initially used react-virtuose library, but it performed really badly by doing expensive layout shifts and having troublesome scroll handling. Switched to react-virtual library, which is a bit more level, but much more efficient, and the source code is actually understandable :)
Features:
- hook up to window events of datasource
- high and low prio rendering, based on where the change is happening (should be optimized further)
- sticky scrolling support
- initial column configuration (custom rendering, styling, columns etc will follow in next diffs)
Reviewed By: nikoant
Differential Revision: D26175665
fbshipit-source-id: 224be13b1b32d35e7e01c1dc4198811e2af31102
Summary:
For context see https://fb.workplace.com/notes/470523670998369
This diff introduces the DataSource abstraction, that can store records. If a key is set a key -> record mapping is stored, to make it easy to update existing records using `upsert`, without knowing their exact index.
Internal storage will be slightly altered in upcoming diffs, so don't pay to much attention to that part.
Reviewed By: nikoant
Differential Revision: D25953337
fbshipit-source-id: 1c3b53a2fcf61abaf061946be4af21d2aecc6c6d
Summary:
Upgrade the static docs plugin.
You no longer need to import OssOnly and FbInternalOnly in markdown files, so removed those imports too.
Reviewed By: passy
Differential Revision: D26580059
fbshipit-source-id: 2763de2f5fbef41ec2ac7f7bdd147418badb78b6
Summary:
Introduced `isConnected` flag on device and plugin client to reflect whether a connection is still available for the plugins, or that they have been disconnected.
Potentially we could expose the (readonly) `connected` state atom for this as well, or an `onDisconnect` event for device pugins, to create a responsive UI, but there might be no need for that, in which case this suffices.
Reviewed By: nikoant
Differential Revision: D26249346
fbshipit-source-id: b8486713fdf2fcd520488ce54f771bd038fd13f8
Summary:
Unlike non-sandy plugins, non-sandy plugins weren't serialized using our serialization utility yet. This diff addresses that, meaning that users don't have to bother about how to serialize maps, sets and dates.
Unlike the old fashioned plugins, the `makeObjectSerialize` utility is used, rather than `serialize`. This normalizes the objects, but doesn't serialize them, which is done at the end of the export data process anyway for the whole tree. This avoids creating a double JSON serialization which is fully of ugly escape characters.
This makes the onImport / onExport definition of the logs plugin nicer.
Also improved the docs.
Reviewed By: nikoant
Differential Revision: D26146421
fbshipit-source-id: 6abfb6ee2e3312e2a13a11832ff103dc62fd844c
Summary: Per title, this allows for pre-processing data after it is deserialized and before it is stored in the plugin
Reviewed By: nikoant
Differential Revision: D26126423
fbshipit-source-id: bc08a6ab205d2a0d551515563cd85a197595ddb2
Summary:
Sandy plugins can now set up an `onExport` handler to enable customizing the export format of a plugin: `client.onExport(callback: (idler, onStatusMessage) => Promise<state>)`
Import will be done in next diff
Reviewed By: nikoant
Differential Revision: D26124440
fbshipit-source-id: c787c79d929aa8fb484f15a9340d7c87545793cb
Summary:
Introduced API to replace the deprecated `selectPlugin` in Sandy.
The API can be used to navigate from `device plugin -> device plugin`, or` client plugin -> device / client plugin`
Introduced `isPluginAvailable` as well, so that the user interaction an be fine tuned in case the plugin is not disabled.
Reviewed By: jknoxville
Differential Revision: D25422370
fbshipit-source-id: c6c603f1c68e6291280b3d0883e474448754ded1
Summary: When exposing new top-level APIs from `flipper-plugin`, they should be documented. Added a unit test to enforce this and added documentation for all missing APIs.
Reviewed By: passy
Differential Revision: D25421401
fbshipit-source-id: f5cafc1881de846c8a5dd86e5d094ebd27a66f2a
Summary: In the Flipper chrome there is a lot of `logger={logger}` prop drilling. Let's not do that anymore in the future by using a proper hook, which is exposed from `flipper-plugin`.
Reviewed By: passy
Differential Revision: D25421304
fbshipit-source-id: 01ec8563c67f7e2fac359c2f8216eba722bff8d9
Summary: Make sure that GKs can be used in pure sandy plugins.
Reviewed By: jknoxville
Differential Revision: D25368358
fbshipit-source-id: c7c6aa4ecf0443cb3b5d90e22e8aca9a73a69389
Summary:
Set up basic primitives for user interaction tracking. I hope the docs and unit tests in this diff are self explanatory :)
In upcoming diffs:
* Wire up to scuba events
* Annotate all important parts of Flipper Chrome
* Investigate if we can wrap important interactions of ANT by default
Reviewed By: jknoxville
Differential Revision: D25120234
fbshipit-source-id: 9849d565d7be27e498cc2b4db33e7d6e6938ee06
Summary: This updates the docs of Flipper to use Sandy, rather than `FlipperPlugin` class. Restructured the docs a bit as a result.
Reviewed By: passy
Differential Revision: D24991285
fbshipit-source-id: 66d5760c25cf9cf3983515433dfd64348d51db3d
Summary: expose `appName`, `appId` and `device` to Sandy plugins. Will be used in next diff to migrate navigation plugin
Reviewed By: cekkaewnumchai
Differential Revision: D24857253
fbshipit-source-id: 03ac3d376d5d1950bcf3d78386a65ce167b517e3
Summary: Moved docs outside of FBInternal docs. Will make Sandy APIs the default in the docs soon, and move the links to the proper location, but this at least makes sure we can already link to the correct place in WP announcements
Reviewed By: jknoxville
Differential Revision: D24829287
fbshipit-source-id: 913f2db65a7cdd04bd1be47aebc48ece7a6cef04