Commit Graph

1482 Commits

Author SHA1 Message Date
Ankur Sadhoo
e7173e060c Make sure right sidebar shows for Watch plugin in client-less mode
Differential Revision: D19261373

fbshipit-source-id: 194480622074bc7672eae67105e0ac8efeafe623
2020-01-02 12:43:07 -08:00
Michel Weststrate
8a84bcbe29 Make sure non-existing icons do break the build
Summary:
Builds didn't fail when using non-existing icons, and the error message was not very clear

Also added verification that, before automatically adding an icon to the prefetcher, that icon does exists

Reviewed By: jknoxville

Differential Revision: D19264063

fbshipit-source-id: 4320d5b960e85e3f15bbca13d69f3063b983a511
2020-01-02 10:45:59 -08:00
Anton Nikolaev
2bee021966 Do not show Doctor warning on startup for already seen problems
Summary: Doctor sometimes can show false-positives and in such case there is no way to suppress showing warning message on each startup. To reduce annoyance I've added an option to save the problems already seen by user and show the Doctor warning only for new problems.

Reviewed By: mweststrate

Differential Revision: D19187095

fbshipit-source-id: 14c1fcc9674f47fbe0b5b0f2d5d1bceb47f7b45d
2020-01-02 08:55:15 -08:00
Michel Weststrate
74daa3fb1a Collect plugin background stats
Summary: Collect run time stats on how much CPU plugins use

Reviewed By: nikoant

Differential Revision: D19161359

fbshipit-source-id: 96b020b1f23b5e8d2e602f0ff6c3aa80ea149792
2020-01-02 08:22:32 -08:00
Michel Weststrate
85992d354d Automatically add icons to prefetch in development mode
Summary:
When browing through flipper one gets random warnings about uncached icons. Since we can't predict which plugins use which icons, it is hard to keep the list in `icons.js` updated.

This diff extracts the table to a separate json file (static/icons.json) and if an icon is missing in development, it will automatically add it to the list, so that the icons will be part of the prefetch of the next build / restart

Reviewed By: jknoxville

Differential Revision: D19257253

fbshipit-source-id: c9c791d50fa5d66738d93873289fbde575f32d66
2020-01-02 08:22:31 -08:00
Michel Weststrate
59c9a10a73 Fix random warnings in several plugins
Summary: Click through plugins and fix warnings until tired.

Reviewed By: jknoxville

Differential Revision: D19253740

fbshipit-source-id: 87b6d6b103ee51c7b5579a128a15c3bb9d71b432
2020-01-02 08:22:31 -08:00
Michel Weststrate
5d25b77622 Bug: cannot export data / submit bug without selected device / client
Summary: Without selected device or client, it is currently impossible to submit a bug report. This diff fixes that.

Reviewed By: jknoxville

Differential Revision: D19251701

fbshipit-source-id: fd0dc0c779fb27d93ed02a404da76a7e6b251b94
2020-01-02 07:14:15 -08:00
Michel Weststrate
9acf23596e Show a message if a background plugin is not starred
Summary:
Since background plugins don't receive data anymore when not starred, we should hint the user about this.

For this diff, I reused the existing statusbar. Although this solution is quite ugly, I think it is better than introducing yet another notification / warning mechanism. Probably we should revisit the layout of this status bar in the future.

Reviewed By: jknoxville

Differential Revision: D19251588

fbshipit-source-id: 1dfd07be383d4ba318f344ebff4b08ed36194c58
2020-01-02 07:14:15 -08:00
Michel Weststrate
04fcaddded Only store messages for plugins that are starred
Summary:
From several reviews / early feedbacks it was suggested several times to use the star mechanism to distinguish which plugins are allowed to send messages. This diff implements that:

- If a plugin is not selected, and not starred, it will drop the messages it received in the background
- This logic is still behind the same GK
- I think this change warrants upping the message queue limits significantly
- A future optimization would be to disable sending messages from the device side of things to reduce bridge usage, but that change is probably a lot more complicated with less impact
- In the next diff I'll make clear from UI perspective that unstarred plugins don't queue messages

In the attach video one can see how graphQL plugin keeps storing messages if it is starred, but if it isn't starred and not selected either, it will skip messages

{F225692819}

Reviewed By: jknoxville

Differential Revision: D19250928

fbshipit-source-id: 7e6af0eb6830dc79951cfd206e05b44061f1b14a
2020-01-02 07:14:14 -08:00
Michel Weststrate
1caf5d5d3a Fix regression in background state
Summary: `flipperPrintPluginBackgroundStats()` tended to report the class name rather than the given plugin id

Reviewed By: jknoxville

Differential Revision: D19250706

fbshipit-source-id: 6035892bacf6a592d8c510320d5e003fac580ec7
2020-01-02 07:14:14 -08:00
Michel Weststrate
622d3ee3f0 Fix plugin state serialization
Summary:
Because the recordSourceUpdates where stored in Map instances, they were never serialized when exporting the data to flipper. (JSON.stringify doesn't support Map's). Although Flipper's own serializer does support maps (which is what you get when not overriding these static methods), the Flipper serializer is really slow, which made the export unusable.

~~The reason this became a problem is that in the new message architecture plugin snapshots serialize the events and apply them only when the plugin is opened, rather than doing it immediately when they are received. However, to be able to apply the events, the recordSource should be available. Before this change, this would throw exceptions when viewing the plugin in an imported flipper trace, as this recordSourceUpdates aren't available anymore.~~

The events are processed *before* the export now, so this is no longer a deal breaker, but it is still an improvement, as it will make the data available in the Flipper exports / imports, and fixed the following error that would occur when opening the store page in an flipper import:

{F225365428}

Reviewed By: jonathoma

Differential Revision: D19178158

fbshipit-source-id: f2bc0a05b02dd2fbd1029d472beeb614dded2dd3
2020-01-02 07:14:14 -08:00
Michel Weststrate
1f6a344f4d Make sure that failing to process an individual event, does not crash the plugin
Summary: See title

Reviewed By: jknoxville

Differential Revision: D19177573

fbshipit-source-id: 269a6a09887c930d446315eeaa31f28e1d100e7f
2020-01-02 07:14:13 -08:00
Michel Weststrate
b8e752412e Process queues before exporting plugins
Summary: This diff makes sure that pending queues for plugins that are selected are processed before making a flipper export.

Reviewed By: jknoxville

Differential Revision: D19194211

fbshipit-source-id: e076375889450407e7f94384051719f3bbc415ee
2020-01-02 07:14:13 -08:00
Michel Weststrate
0494a84d98 Make sure that plugins don't store events unbounded
Summary:
To avoid plugins to collect data forever and store it (if they are never opened), introduced a hard-coded default limit on how many events will be preserved.

A semantic change is that plugins have to be potentially resistant against missing events. So far, during testing, this didn't seem to cause any problems.

Reviewed By: jonathoma

Differential Revision: D19175912

fbshipit-source-id: 828be941e76b7356c9f5be7e5a49de9a7a31b0d2
2020-01-02 07:14:13 -08:00
Michel Weststrate
8c8f360572 Process and render messages when a plugin is opened
Summary: This introduces the necessary UI changes, to kick off and render event progressing process where needed

Reviewed By: jknoxville

Differential Revision: D19175450

fbshipit-source-id: 61e3e8f59eeebf97eedbe715fa7db320286543e2
2020-01-02 07:14:13 -08:00
Michel Weststrate
d2a2e2ab75 Introduce async message queuing
Summary:
This diff introduces the logic for queueing incoming messages rather then directly processing them you are behind the `flipper_event_queue` GK.

The reason the queue processing is a bit complicated is to make the queue can be processed non-blocking, can be cancelled, and is safe to concurrency issues.
The idea here is that the queue is processed when we switch to a plugin, report it's progress, and abort the process when switching to another plugin without loosing any work.

This diff does not include
[x] updates to the UI (**SO DON"T LAND IN ISOLATION**)
[x] metrics to see the effect

The effect of the changes can be seen when profiling the application, before this change there are very regular CPU spikes (see the small yellow bar on the top):

https://pxl.cl/TQtl

These go away when the events are no longer processed
https://pxl.cl/TQtp

Reviewed By: nikoant

Differential Revision: D19095564

fbshipit-source-id: 0b8c3421acc4a4f240bf2aab5c1743132f69aa6e
2020-01-02 07:14:12 -08:00
greenkeeper[bot]
477de3e9ba Update deep-equal in group plugins to the latest version � (#706)
Summary:
## The dependency [deep-equal](https://github.com/inspect-js/node-deep-equal) was updated from `1.1.1` to `2.0.1`.
This version is **not covered** by your **current version range**.

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.

 ---

**Publisher:** [ljharb](https://www.npmjs.com/~ljharb)
**License:** MIT

[Find out more about this release](https://github.com/inspect-js/node-deep-equal).

 ---

<details>
  <summary>FAQ and help</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>

 ---

Your [Greenkeeper](https://greenkeeper.io) bot 🌴
Pull Request resolved: https://github.com/facebook/flipper/pull/706

Reviewed By: mweststrate

Differential Revision: D19141026

Pulled By: cekkaewnumchai

fbshipit-source-id: e89050bf9e83f072a03f79e9b7772269be6efb9d
2019-12-30 09:30:30 -08:00
Ankur Sadhoo
9b5ba4decb Add Watch Bug Information Debugger as a connectionless plugin
Differential Revision: D19211198

fbshipit-source-id: 0a63fe8077141b5221254a668ef4c0e83c7d33ea
2019-12-26 19:25:09 -08:00
Michel Weststrate
bc36c1607d Apply idle optimizations throughout code base
Summary:
See explanation in parent diff, make sure the idler is used efficiently, instead of wasting a lot of CPU creating a new callstack every time `idle` is called.

Also fixed that cancelled idlers could result in an _uncaught_ exception

Reviewed By: nikoant

Differential Revision: D19158593

fbshipit-source-id: 0be505a74c374e0ca6ee0e79b1f1e98ac9b80467
2019-12-19 04:27:27 -08:00
Michel Weststrate
0a5df48639 Introduce a Test Idler to have a remotely controlled idler
Summary:
To test things that depend on `Idler`, we would so far need to depend on timing in the unit tests, which is very error prone. So introduced a `TestIdler` as well to make sure we can create an idler we can control remotely (as demonstrated in the unit test)

Note that idler smells like generator functions all over the place, so maybe I'll take a stab later to see if we can replace idlers with generators, which gives a much clearer control flow imho.

Reviewed By: nikoant

Differential Revision: D19158369

fbshipit-source-id: 605d120860ecb02883442524df6f876e050ff092
2019-12-19 02:38:08 -08:00
Michel Weststrate
f4fdeef692 Make it possible to override GK's in unit tests
Summary: Previously it was not possible to run unit tests to test logic that requires GK's to be enabled. This fixes that

Reviewed By: passy

Differential Revision: D19158368

fbshipit-source-id: b89691bdd2f975a3b4be343bd966ed77b2ad3763
2019-12-19 02:38:07 -08:00
Vladyslav Stepanov
09184a999f Fix various errors and warnings
Summary: Fix various errors that Flipper was complaining about in Watch plugin

Reviewed By: ankursadhoo

Differential Revision: D19168777

fbshipit-source-id: eefb98818ddb0da78de1daf2d67045cb90cd90aa
2019-12-18 17:46:42 -08:00
Chaiwat Ekkaewnumchai
9b84de0c0a Ignore Non-existed Key in Searchable to Prevent Flipper from Crashing
Summary: per title

Reviewed By: mweststrate

Differential Revision: D19143735

fbshipit-source-id: 67cb65a98760a82fd71073621bcbca819ebb1e5f
2019-12-18 07:30:14 -08:00
Chaiwat Ekkaewnumchai
db721e94a6 Clear Search Input After Entering It
Summary: per title

Reviewed By: nikoant

Differential Revision: D19143025

fbshipit-source-id: b371a55584b255b8f0a704eaa46e6a3eebad4a79
2019-12-18 05:00:46 -08:00
Michel Weststrate
91d5b95341 make it easier to test plugin logic
Summary:
This diff will make it easier to test a plugin in a "fully loaded" Flipper state. This makes it possible to test all the wiring of flipper, rather than the individual reducers.

This is in preparation of processing the message queue async.

Reviewed By: passy

Differential Revision: D19140879

fbshipit-source-id: 5a333abe9c7a4d0c33d1d06a105cd094cb8fc19f
2019-12-17 06:07:35 -08:00
Anton Nikolaev
d32774f439 Skip Android health-checks when the "Android Developer" option is disabled in Flipper settings
Summary:
Skip Android health-checks when the "Android Developer" option is disabled in Flipper settings.

Also made some refactoring to use immer for healthcheck reducer.

Reviewed By: mweststrate

Differential Revision: D19088322

fbshipit-source-id: 801d874b6e7e5af80802b4bf4313d98f1cee13f6
2019-12-16 16:40:08 -08:00
Denis Nedelyaev
be53990613 Add setting for skipping fbsource version check
Summary: Added a setting "Match local fbsource chekout", which inverserly corresponds to the `ignore_local_pin` setting in `flipper-launcher.toml`.

Reviewed By: passy

Differential Revision: D19030456

fbshipit-source-id: deaaf4e873a00bbc4e8bd3034353cf580df95a36
2019-12-16 07:01:01 -08:00
Pascal Hartig
5a3f107a50 Remove child-process-es6-promise
Summary: Replacing this with promisify-child-process, which is better.

Reviewed By: mweststrate

Differential Revision: D18954702

fbshipit-source-id: 2dad756a2cd4dd21b2efc8b1780d589607d6ff05
2019-12-16 03:57:29 -08:00
Michel Weststrate
edd894258c Favorite plugins are now stored per app rather than globally
Summary:
This diff is a refinement of D18780965, which fixed plugin preferences to be stored per device. Instead of storing plugin preferences globally, we now store them per app, so that every app can have their own favorites, which are shared regardless the device

Note that the current favorite selection will be lost.

Reviewed By: nikoant

Differential Revision: D19018169

fbshipit-source-id: acfa05ece8516840bb91aee4059886365b346582
2019-12-13 10:07:13 -08:00
Michel Weststrate
02ad5c64aa Fix last startup warnings
Summary: There were a few warnings printed when starting Flipper. This fixes the last of them!

Reviewed By: nikoant

Differential Revision: D19011385

fbshipit-source-id: 15bc46c4a67e8c8fd3c8b5d96dc67e61911a7e53
2019-12-13 07:11:43 -08:00
Michel Weststrate
8da2c8868b Expose Immer's produce from Flipper
Summary: Diff preparing for optimizing GraphQL (and other) plugins, and simplifying writing reducers by others

Reviewed By: nikoant

Differential Revision: D18930858

fbshipit-source-id: 91d176d77543978d65ea50635d4ed380690b1fa2
2019-12-13 07:11:43 -08:00
Alexander Putilin
c7af0b53e6 KaiOS device plugin for recording memory allocations
Summary:
This adds basic plugin for recording memory allocations.
{F224005997}

Reviewed By: passy

Differential Revision: D18837209

fbshipit-source-id: aa29680b3a44c51135b760fe4ee76edc6d0ec109
2019-12-12 08:12:52 -08:00
Anton Nikolaev
c030cbe204 No Icons on Windows with locale other than en-US
Reviewed By: mweststrate

Differential Revision: D18953063

fbshipit-source-id: d21116b11189851dff271fcfa7334a51b13c693f
2019-12-12 04:01:26 -08:00
Uma Sankar
559285f5f9 Producing new state when any change to preferences happen to address #470 (#623)
Summary:
Fixed issue https://github.com/facebook/flipper/issues/470

## Changelog

Producing new state when preferences gets updated in SharedPreferences plugin
Pull Request resolved: https://github.com/facebook/flipper/pull/623

Reviewed By: mweststrate

Differential Revision: D18929828

Pulled By: passy

fbshipit-source-id: 8e9e61f90838fd3676aa52c4c6117b3f452aa7c0
2019-12-11 10:18:41 -08:00
Anton Nikolaev
c0f902f81a Upgrade to emotion v10
Summary: React 16 is not compatible with react-emotion 9 (it prints warnings, see also https://github.com/emotion-js/emotion/issues/644). So we should upgrade to 10.

Reviewed By: mweststrate

Differential Revision: D18905889

fbshipit-source-id: c00d2dbbadb1c08544632cb9bfcd63f2b1818a25
2019-12-11 09:43:24 -08:00
Pritesh Nandgaonkar
c3dfcbe601 Show the plugins from the redux store only belonging to the selected app
Summary: It fixes the bug, where currently we show all active persistent plugins for the export functionality irrespective of the fact that the plugin is active for the selected client. With this diff we will only show active persistent plugins for the selected client.

Reviewed By: mweststrate

Differential Revision: D18890247

fbshipit-source-id: e567da0ccf04e051ca0eabb497a6bd72cc8a0d76
2019-12-11 06:27:22 -08:00
Michel Weststrate
5429d1f235 Make it possible to generate regression tests for Flipper plugins
Summary:
This Pull request makes it possible to automatically generate regression tests for plugins. The idea here is to record all incoming states for a specific plugin, the start state of the plugin, and the enstate of the plugin.

By replaying the same events in a test, the same plugin should result in the same end state. This will make it easy to test regressions and refactorings on real life scenarios. Execution time is recorded as well.

The API's are exposed as

- `flipperStartPluginRecording()`
- `flipperStopPluginRecording()`

This process generates both a data snapshot and unit test.

Reviewed By: passy

Differential Revision: D18907455

fbshipit-source-id: 923f814f534ccfa6aa2ff2bfa2f80bee41a1c182
2019-12-11 05:53:22 -08:00
greenkeeper[bot]
0febcd44ac chore(package): update uglify-js to version 3.7.2 (#690)
Summary:
Fix https://github.com/facebook/flipper/issues/682
Pull Request resolved: https://github.com/facebook/flipper/pull/690

Reviewed By: mweststrate

Differential Revision: D18929815

Pulled By: passy

fbshipit-source-id: 3e792b14e956702cd36d169dea0fc5048ed90322
2019-12-11 05:27:59 -08:00
Michel Weststrate
382330bfaf Convert to TypeScript
Summary: Before looking into performance bottlenecks, I thought it wise to upgrade to TypeScript as that is where all plugins are heading

Reviewed By: jknoxville

Differential Revision: D18829689

fbshipit-source-id: 4c515f240d742f77e89f3cbdff500c69afb3ac06
2019-12-11 03:46:48 -08:00
Pritesh Nandgaonkar
938f9542ee Fix the issue where perf events were not getting logged
Summary: I noticed a bug where the export data perf events were not logged. The issue was that, it used the `Logger.getTrackTimeSince` method which used the `performance` from `perf-hooks` and not an ordinary performance object available in the global scope. So just importing performance from perf-hooks solved the issue.

Reviewed By: mweststrate

Differential Revision: D18887666

fbshipit-source-id: 66c24f47b95b25d2f3703c16c70cbe8b35fe0ec3
2019-12-10 08:21:28 -08:00
Mateo Silguero
c4730c3e49 Parse all values on json fields (#678)
Summary:
I want to get a better visualisation of the databases values from a device, like the localStorage from ReactNative.

## Changelog

Iterate on the object value to parse all values from a json
Pull Request resolved: https://github.com/facebook/flipper/pull/678

Test Plan:
before:
<img width="1185" alt="Captura de Pantalla 2019-12-06 a la(s) 19 57 13" src="https://user-images.githubusercontent.com/25598400/70362212-e4a37280-1862-11ea-8b8b-a96edfece5c9.png">

after:
<img width="1185" alt="Captura de Pantalla 2019-12-06 a la(s) 19 55 52" src="https://user-images.githubusercontent.com/25598400/70362211-e4a37280-1862-11ea-8d16-00691c0f21c4.png">

Reviewed By: nikoant

Differential Revision: D18874887

Pulled By: passy

fbshipit-source-id: 679519fe2746a698e41ba015fd811a342c96c4fd
2019-12-10 06:04:19 -08:00
Pritesh Nandgaonkar
0c13943139 Allow user to copy the row attributes in the layour inspector
Summary: Allows user to copy the row attributes.

Reviewed By: passy

Differential Revision: D18811929

fbshipit-source-id: 62335a7c0b5f1557704c0d8d9ea258b4c7cbfdcf
2019-12-09 05:10:06 -08:00
Pascal Hartig
008a003a4d Add tests for healthchecks reducer
Summary:
Quite a bit of complex slicing going on there, so I think
this is quite useful to guard against future breakages.

Reviewed By: jknoxville

Differential Revision: D18853033

fbshipit-source-id: 36b17b8ce208cb320a193bceed86c89e010107e4
2019-12-06 08:00:53 -08:00
greenkeeper[bot]
83c3cf3688 Greenkeeper/@types/react 16.9.14
Summary: Pull Request resolved: https://github.com/facebook/flipper/pull/672

Reviewed By: jknoxville

Differential Revision: D18834245

Pulled By: passy

fbshipit-source-id: 352561d95c9489df6b675910a4c64548d93b4f30
2019-12-06 07:47:26 -08:00
John Knox
8e0a4a5e42 Fix clicking on native notification
Reviewed By: passy

Differential Revision: D18831700

fbshipit-source-id: 4cdaed3893fc6162a16ac2c1a8a9ee2ef1a0805c
2019-12-06 07:27:35 -08:00
Pascal Hartig
0c7b03cad3 Add tests for settings reducer
Summary: yiss_tests

Reviewed By: jknoxville

Differential Revision: D18851134

fbshipit-source-id: 53ffb9b516773df19c258e7d819962e3cd523751
2019-12-06 06:32:20 -08:00
Pascal Hartig
cde949e3a1 Fix double-parsing of process config
Summary: This had been there for way too long.

Reviewed By: mweststrate

Differential Revision: D18834089

fbshipit-source-id: 563aa04876910a7544a7f62865b146b933dbf570
2019-12-06 03:50:32 -08:00
John Knox
1a389202ca Change client to not produce plugin keys manually
Summary: I **think** this is the last part of the codebase doing manipulation of strings to produce plugin keys etc.

Reviewed By: passy

Differential Revision: D18831990

fbshipit-source-id: db449d78230adbca66e78f041381a34d9b249a45
2019-12-05 11:45:37 -08:00
Michel Weststrate
7f916f8a7b Gather plugin stats to improve performance
Summary: This diff makes it possible to gather stats of plugin usage, and print them from the console by issuing `window.flipperPrintPluginBackgroundStats()`.

Reviewed By: jknoxville

Differential Revision: D18811590

fbshipit-source-id: 4219923f7fd90187c7ec50a9aa68d7b817e3db8f
2019-12-05 09:30:33 -08:00
John Knox
0bf905e02f Replace all manual pluginKey parsing with a utility
Summary:
Ok this diff got a bit bigger than expected, but I think it makes it easier to understand what "plugin keys" are, and makes them less prone to error.

Previously pluginKeys were composed of: clientId#pluginName, where clientId was itself: app#os#device#device_id

But also, there were some plugin keys where the clientId was a device_id.

Now you deconstruct a plugin key, and will get a tagged object with type: 'device' or 'client', and the properties that they each have.

There is now no custom parsing of these afaik, let's keep it that way.

Since it took me a while to figure out what all these IDs are, I've documented it a bit in clientUtils.

Reviewed By: passy

Differential Revision: D18811848

fbshipit-source-id: eed2e2b5eedafb9e27900dbcf79a389fcaffae95
2019-12-05 07:37:57 -08:00