Commit Graph

24 Commits

Author SHA1 Message Date
Pritesh Nandgaonkar
95fae7d4e8 Call exportState function before exporting metrics
Summary:
This diff fetches the additional data by calling the hook added in each plugins when the headless tries to export metrics directly out of the store rather than from the trace.

I added `fetchMetadata` function which will be called while exporting the state as well as exporting the metrics. We do not need to fetch metadata in the case when the metrics are exported from the given trace.

Reviewed By: passy

Differential Revision: D15560129

fbshipit-source-id: 9b14340e565ce17d1825bc2d32520d7b0c2b2219
2019-06-03 15:06:30 -07:00
Pritesh Nandgaonkar
914cbf6ccd Request all metadata for Images plugin before export
Summary:
Fresco plugin on the desktop side used to ask for all the image list along with the metadata when it was mounted. The mobile side never sent the image list and other information if not requested from it. That means, although Fresco plugin is a background plugin, there weren't any messages sent from the mobile side. Thus there was no trace available for Images plugin when the trace was exported. This diff, adds a hook which gets called before the export, where we request all the metadata from the mobile SDK.

BUG:

{F159305887}

Reviewed By: passy

Differential Revision: D15407962

fbshipit-source-id: 0012de2ab29d0f62e92d00f4926b04b1e394b62a
2019-05-23 05:48:04 -07:00
Pritesh Nandgaonkar
2c024a4488 Call exportPersistedState only for clients of a selected device
Summary:
Call `exportPersistedState` only for the clients of selectedDevice. This will fasten up our export, we do not need to call `exportPersistedState` for the clients of nonSelectedDevice.

{F159322777}

Reviewed By: passy

Differential Revision: D15440652

fbshipit-source-id: e018603cfeb56fec462b54a6897fb254cc361390
2019-05-22 03:47:27 -07:00
Pritesh Nandgaonkar
830c8067e4 Timeout promise while exporting flipper plugin
Summary:
Added a promiseTimeout util so that we limit the time taken to export flipper plugin. I had received a feedback from the user stating that that the loader for the export stays for ages and never finishes. So this diff adds a timeout to the promise which is returned by `exportPersistedState` function. This function is currently implemented just by Layout inspector to fetch the entire view hierarchy. I suspect the the former mentioned bug may be due to the unresponsive client.

This diff also shows the plugin and the client information for which `exportPersistedState` timed out. Also this will hopefully solve the problem surfaced recently stating that the bug report gets stuck, the reason for which I suspect would be the same as the above mentioned reason, because we export flipper data when we create a bug report.

Reviewed By: danielbuechele

Differential Revision: D14712633

fbshipit-source-id: 35f8cfa722ec3b7ff94ebda943d618834ac3207d
2019-04-04 04:20:15 -07:00
Pascal Hartig
b20d0a4c8b Add headless option to dump on disconnect
Summary:
This adds an optional exit strategy that reacts to the client disconnecting rather than a `SIGINT` which can be used for integration tests.

`MiddlewareAPI` is a subset of `Store` and required to work here.

Annoyingly, it's not quite clear to me why this does not work as part of an event loop cycle and requires a `setTimeout`. This doesn't have any negative effects and works in the same way that the SIGINT interruption works, but it's a bit of an eyesore.

Reviewed By: danielbuechele

Differential Revision: D14622111

fbshipit-source-id: e2caca056e478428d977565dc9bc09eefca4230c
2019-03-28 06:53:57 -07:00
Daniel Büchele
f30ff068a7 Show offline devices in dropdown
Summary:
This diff aims to make the selected device a little clearer, the button now shows different icons depending on the selected devices: physical, emulators and archived devices.

The dropdown now is grouped in these sections, depending on their availability:
- Connected Devices
- Running Emulators
- Imported Devices
- Launch Android emulators
- Open File...

"Open File..." allows to import a file the same way as File -> Open File...

Reviewed By: jknoxville

Differential Revision: D14460789

fbshipit-source-id: 8d6edff0d90d5e02e4ef5976af5680ab8eaf77b4
2019-03-15 11:30:38 -07:00
Pritesh Nandgaonkar
51139500f4 Add revision information in the exported file
Summary: Adds revision information which is used to build the flipper app. for more context follow the [discussion](https://fb.workplace.com/groups/1489943347777350/permalink/2046366362135043/)

Reviewed By: danielbuechele

Differential Revision: D14458169

fbshipit-source-id: 71860f1e78c042f76d0e220dd3be96f2adaf609e
2019-03-15 09:57:12 -07:00
Pritesh Nandgaonkar
e184af7f2a fix the parsing error
Summary:
The headless version used to use `JSON.stringify` to serialize the output of `serializeStore` which basically transformed the store to a specific format which is serializable.  But we have written the custom serialize function which cateres to the non serializable object types. Headless didn't use it, so thats why it exported Flipper trace in an unrecognizable format for the flipper.

I have also renamed `serializeStore` to `prepareToSerializeStore` so that the confusion doesn't occur in future. I have used an `exportStore` function in headless which exports the store to the `Promise<String>`

Reviewed By: jknoxville

Differential Revision: D14480096

fbshipit-source-id: f312d7637aa082d96c3bc1dfd00eefb19182e97f
2019-03-15 09:49:31 -07:00
Pascal Hartig
3141b954bf Run prettier fix
Summary: Should also fix the build.

Reviewed By: jknoxville

Differential Revision: D14477777

fbshipit-source-id: 01fcfb2321c9b7a12acdf079473d91b6805d4dda
2019-03-15 05:13:30 -07:00
Pritesh Nandgaonkar
c098269533 Added telemetry for import and export
Summary: Adding telemetry for import and export feature

Reviewed By: jknoxville

Differential Revision: D14267533

fbshipit-source-id: 1a5e041d0dc8c59c325e7d80dc83f6135f479161
2019-03-04 05:08:19 -08:00
Pritesh Nandgaonkar
b0551bb74e Export Flipper trace along with bug report
Summary:
Exports Flipper trace along with bug report. I was not able to upload `.flipper` file, thus I have uploaded `.json` file. One can download the json file from the portal and then can rename it to `.flipper` inorder to open it into flipper app.

I am looking into downloading `.flipper` directly, instead of `.json`. But that change, if it happens, will be done in other diff. I think having flipper trace on the bug report will be helpful to debug the issues.

Reviewed By: danielbuechele

Differential Revision: D14266218

fbshipit-source-id: fb7cf4c9773fb355f3569ce8d08b83bd736ab1ca
2019-03-01 08:22:46 -08:00
Daniel Büchele
79124891a9 url handler downloads
Summary:
Adding support for downloading archived Flipper data using a URL handler.
A URL looks like `flipper://import/?url=` and will download the file specified in the url param. While downloading the file, a spinner is shown in the app's titlebar.

Reviewed By: jknoxville

Differential Revision: D14262763

fbshipit-source-id: 6538fc78c07a48cef7b71b3f7bdbcb712d054593
2019-03-01 04:30:22 -08:00
Pritesh Nandgaonkar
af317eed2b Export and import all the nodes
Summary:
This diff does the following

- Support to export the entire view hierarchy for iOS
- Android is not supported yet
- This diff adds a call `getAllNodes` to the client side of iOS, which returns the entire view hierarchy
- Currently the search doesn't work on the imported layout plugin data. Also the imported layout plugin data doesn't expand the way it does when component is mounted, reason being the client passed to the plugin is not functional for the archived case

I will work on fixing the last points in the next diffs stacked on the current one.

For Android:
- Currently the export function will export whatever is currently displayed on the Flipper app, not the entire view hierarchy

Support for Android will also come up in later diffs.

Reviewed By: jknoxville

Differential Revision: D14209157

fbshipit-source-id: 3ad3e39edfd994913dc19cc239bfbbe011a9757c
2019-02-28 09:40:50 -08:00
Pritesh Nandgaonkar
92cc78c41d Handle the Logs when it is undefined
Summary: As per the title

Reviewed By: danielbuechele

Differential Revision: D14131195

fbshipit-source-id: 3b053c04e27de9faa8b8395bf4b0f6fe3d7c58dc
2019-02-19 05:33:43 -08:00
Pritesh Nandgaonkar
cab61b0c15 Serialize and Deserialize helper function
Summary: This diff adds a helper function to serialize and deserialize javascript Objects

Reviewed By: danielbuechele

Differential Revision: D14101483

fbshipit-source-id: 3e1f37076ccc04b83cf7de5f10900e21e6474c1d
2019-02-18 14:44:18 -08:00
Pritesh Nandgaonkar
9a8e30681b Handle the case of Logs not being present
Summary:
- handles the case when log is not present
- solved the cpu plugin error
- now `fileversion` is the flipper version

Reviewed By: jknoxville, danielbuechele

Differential Revision: D14065882

fbshipit-source-id: f88414bbb3d766f8ab6e0ec00943b59738918a0e
2019-02-14 04:53:56 -08:00
Pritesh Nandgaonkar
059ac83fcf Do not import already imported data
Summary: Before this diff, if one imported same file twice, it duplicated app data.This diff fixes that. When one tries to import the already imported file then this diff will select that flipper files device in the UI.

Reviewed By: jknoxville

Differential Revision: D14045145

fbshipit-source-id: f17c83486ffcdb0e2a57c70b1589e34567811d01
2019-02-12 08:37:14 -08:00
Pritesh Nandgaonkar
c28ef62f07 Import and export Logs
Summary: This diff adds import and export support for the logs plugin

Reviewed By: danielbuechele

Differential Revision: D13958713

fbshipit-source-id: a072de025f0b959302175ef0ccaf763ca41377e9
2019-02-12 02:47:55 -08:00
Pritesh Nandgaonkar
e5151b9994 Add salt to the exported device serial id
Summary:
This diff solves the following bug.

When the user imports the exported flipper data for the device which is currently running, there was a bug. A duplicate device with the same serial got created after importing the file. Due to the same `device_id`, the plugins of the exported device got imported in the already running device(which has the same device id).

To solve this problem, I have prefixed the exported `device_id` with a random string, so that the exported device is unique across the device list in the Flipper app.

Look at the vide to understand the bug

Also updated the test case accordingly

Reviewed By: danielbuechele

Differential Revision: D13973180

fbshipit-source-id: df6ee00987e81923914855cea4d76e2bd7167358
2019-02-12 02:47:55 -08:00
Pritesh Nandgaonkar
d70e512889 Show save as dialog for export data
Summary: This diff adds support to specify custom location to save the flipper data to be exported

Reviewed By: passy

Differential Revision: D13916944

fbshipit-source-id: cfe816d07eb505d99c00f7798f3a97a2093ab265
2019-02-05 09:36:35 -08:00
Pritesh Nandgaonkar
9bc54597cf Import from exported file
Summary:
This diff adds the feature to import the exported flipper data. It has the following features

- Dialog to select the file
- Merges the data with an existing store.

Reviewed By: danielbuechele

Differential Revision: D13901944

fbshipit-source-id: 1b9755735419732a34254bdc39d911bcb51ad8fe
2019-02-05 09:36:35 -08:00
Daniel Büchele
3b75fb092b output data on stdout
Summary: listening on `SIGINT` events and putting the serialized store to stdout.

Reviewed By: passy

Differential Revision: D13878051

fbshipit-source-id: 19c1d857a299ed9a474605169c54e5359e0515bd
2019-02-04 07:29:13 -08:00
Pritesh Nandgaonkar
cbd70f573c Added test cases for flipper import and export
Summary: Adds tests for flipper import and export. Also fixed few edge cases which was discovered through tests. The edge case was that it didn't export device plugin states.

Reviewed By: danielbuechele

Differential Revision: D13828357

fbshipit-source-id: ddc4352b729ca7f05c5875f2f3fbdd2c7f4e2186
2019-01-29 08:55:26 -08:00
Pritesh Nandgaonkar
5ef970e5b5 Serialize Store
Summary:
This diff adds the capability to export the flipper data to a file. With this diff you can click on the "Export Flipper" option from the "Edit" menu in menubar. It will export it in the file at this location

`~/.flipper/MessageLogs.json`

We do not exactly export the store, but just the important part of it. We export in the following format

```
{
fileVersion: '1.0',
device: {
   os: 'iOS',
   title: 'iPhone 7',
   serial: '',
   deviceType: 'physical',
  },
clients: [
   {
    query: {
       app: 'Facebook',
      },
      d: '12345678'
     },
   {
    query: {
       app: 'Instagram',
      },
    id: '12345678'
   }
],
store: {
   pluginState: {},
   notifications: {}
  }
}

```

In next diff I will add the capability to select the folder to export the file too.

Reviewed By: danielbuechele

Differential Revision: D13751963

fbshipit-source-id: 7d3d49c6adf8145b2181d2332c7dbd589155cec3
2019-01-28 15:43:24 -08:00