Commit Graph

282 Commits

Author SHA1 Message Date
Pritesh Nandgaonkar
08cdb5e2e8 Fix improper plugin id assignment
Summary: This diff fixes the improper plugin id getting assigned to the variable which lead to notifications not getting shown. The client id has `#` so pluginId is no longer the second argument when one splits the string by `#`. This diff fixes this problem.

Reviewed By: passy

Differential Revision: D13176776

fbshipit-source-id: cd5bdc33c61485e3cdc2f2dbcc615980c39c8b8c
2018-11-23 05:48:11 -08:00
John Knox
ca1f0202d7 Add retries around android device watching
Summary: Retry up to 5 times with exponential backoff.

Reviewed By: passy

Differential Revision: D13138244

fbshipit-source-id: 94c68b87aa281cfc3239b0bb8bdd75a2e0d7edc7
2018-11-22 06:39:58 -08:00
Pascal Hartig
9e6a86923a Fix yarn lint (#332)
Summary:
Eslint / prettier are unhappy with the formatting of the FlowFixMe
comment, but the suggested solution is really ugly. Let's disable
the lint for now and remove this once it's addressed.
Pull Request resolved: https://github.com/facebook/flipper/pull/332

Reviewed By: jknoxville

Differential Revision: D13156552

Pulled By: passy

fbshipit-source-id: 680d151ea1022912e0e4a83fa42dc51005631c30
2018-11-22 06:34:09 -08:00
John Knox
bbdbb94415 Fix network plugin bug
Summary:
Some network requests are yielding error: e.getMessage() is not a function.
It shouldn't be .getMessage(), it should be .message

Reviewed By: priteshrnandgaonkar

Differential Revision: D13137334

fbshipit-source-id: 72c782376c8e62a05c5e9ce1b956566ce1fc5bf0
2018-11-20 06:43:58 -08:00
Panagiotis Vekris
e380fa7a08 Flow v0.86.0 in xplat/sonar
Summary: allow-large-files

Reviewed By: gabelevi, dsainati1

Differential Revision: D13105210

fbshipit-source-id: 462af926206a10618a725531f2e62da9f3291fc0
2018-11-19 12:14:51 -08:00
John Knox
018718244a Fix adb client use of promise.resolve
Summary: This was misusing promise.resolve by calling it before the result is produced, meaning there was a race condition. It would also resolve as success even if listDevices failed.

Reviewed By: passy

Differential Revision: D13121173

fbshipit-source-id: f120a1b199d1e3168059c537461f65a8dc125a94
2018-11-19 09:47:04 -08:00
John Knox
a6765deec6 Fix missing android devices bug
Summary:
Finally tracked down this bug that's been annoying me.

If you start flipper while the adb daemon is not running, then flipper will start the daemon, but it won't wait for it to have finished starting before telling the client to watch for devices. This is a race condition, and in practice never seems to work.

To avoid this, I'm calling `adb devices` on the client and waiting for it to complete before doing anything else. This forces it to wait for the daemon to start up if it hasn't already, and if it has then it instantly returns.

Reviewed By: passy

Differential Revision: D13101963

fbshipit-source-id: b85bed24751ce5c8efdfc6e841400e4db2580ab0
2018-11-19 04:48:00 -08:00
John Knox
7821b6b5a9 Sort uninitialized devices in redux state
Summary: Stops them from jumping around if they try to connect more than once.

Reviewed By: passy

Differential Revision: D13084056

fbshipit-source-id: 803538298c45b9c28e5116f072518e8632b0f1cf
2018-11-16 03:40:48 -08:00
Panagiotis Vekris
b2b27b774e Back out "Flow v0.86.0 in xplat/sonar"
Summary: Original commit changeset: f0122c8c6d60

Reviewed By: avielg

Differential Revision: D13083312

fbshipit-source-id: 4b77fda5221feff5c721bb8a509b1350d60046d5
2018-11-15 08:24:00 -08:00
Daniel Büchele
0b43d219c3 Adding test converage for plugin loading
Summary: Adds test for the plugin reducer and dispatcher

Reviewed By: jknoxville, passy

Differential Revision: D13082652

fbshipit-source-id: 4af2c7721c4d88abbd332d610ff71d5db78e721c
2018-11-15 07:30:05 -08:00
Daniel Büchele
1edc91512d add testing GKs
Summary: Adding two GKs (one failing, one passing) to allow the testing of gatekeeper functionality. This is used in the next diff.

Reviewed By: jknoxville

Differential Revision: D13082651

fbshipit-source-id: c6d8ef484564c8ae8b4c107de5643c700f696ad5
2018-11-15 07:30:05 -08:00
Daniel Büchele
7747a0714d plugin redux
Summary:
Plugins were loaded in `/plugins/index.js` which was loaded once at launch of the app. This moves the list of available plugins to redux. This way, plugins can be dynamically added. The redux store keeps to Maps of plugins (devicePlugins and clientPlugins) with their ID as key:

```
  devicePlugins: Map<string, Class<FlipperDevicePlugin<>>>,
  clientPlugins: Map<string, Class<FlipperPlugin<>>>,
```

On launch of the app, all plugins bundled with the app and the one found in `pluginsPath` are dynamically added.

This changes now allows to add new plugins at any time. All components that need to know which plugins are available (e.g. the sidebar) are connected to the redux store. This way, they will automatically update, whenever a new plugin is added.

- add `plugins` to the redux store to keep the list of available plugins
- add a plugins dispatcher, responsible for loading the plugins on launch
- connecting all React components that imported `plugins/index.js` before to the redux store to get the plugins from there.
- moved the updating of the MenuBar to the plugins dispatcher as it needs to update whenever a new plugin is added.

Reviewed By: jknoxville, passy

Differential Revision: D12449236

fbshipit-source-id: 6ef3e243e2c80443614b901ccbfde485fcb4301c
2018-11-15 07:30:05 -08:00
John Knox
ff3977da77 Show connecting spinner
Summary:
First step in visualising the connection setup process.
Just a spinner while cert exchange is happening, so it doesn't look like nothing is happening.

Reviewed By: passy

Differential Revision: D13062514

fbshipit-source-id: a0692821025f42f4fe4af86faf059d4719008f25
2018-11-15 04:36:40 -08:00
John Knox
866cb72124 Put connection setup state in redux
Summary: Puts the connection state into redux so we have more visibility on what's happening in bug reports and in general allowing us to display it on screen.

Reviewed By: passy

Differential Revision: D13060455

fbshipit-source-id: c79b4b7d6a1155d86128a5d8d1174ead9e4514ae
2018-11-15 04:36:40 -08:00
Panagiotis Vekris
6362188563 Flow v0.86.0 in xplat/sonar
Summary: allow-large-files

Reviewed By: zertosh

Differential Revision: D13067587

fbshipit-source-id: f0122c8c6d602750289121d2ab2fdb09cbb033bc
2018-11-14 15:39:25 -08:00
John Knox
a48c680a40 Modify client id string and device serialisation
Summary:
This improves bug reports.
Adding serial into device.toJson() means you can now easily see which clients (apps) are from which device because they both contain the serial.
Changing client id to use # instead of - because the subcomponents of it already use -.

Reviewed By: passy

Differential Revision: D13058430

fbshipit-source-id: 02697ec623829423e667fd2acbd1abc369a6919b
2018-11-14 08:26:32 -08:00
John Knox
9f13e1422b Add 'Redux State' to bug reports
Summary:
Now the BugReporter has access to the logs and the redux store, to submit more useful bug reports.
This isn't currently used in open source, unless you override / replace this file.

Reviewed By: danielbuechele

Differential Revision: D13058210

fbshipit-source-id: e52a3cb528693ab171843080685e5342e0b6a393
2018-11-14 05:49:00 -08:00
John Knox
d9a9439dfa Fix emulator launching bug
Summary:
I was getting the following error when trying to launch an emulator:
`PANIC: Missing emulator engine program for 'x86' CPU.`

It seems like emulator/emulator is more reliable than tools/emulator: https://stackoverflow.com/questions/26483370/android-emulator-error-message-panic-missing-emulator-engine-program-for-x86

So put them both on the path in that order.

Reviewed By: passy

Differential Revision: D13040325

fbshipit-source-id: 11e8b24b2a99e02955128d5fb7c17764b98388fa
2018-11-13 11:18:34 -08:00
Daniel Büchele
274d71cb2f update default filters
Summary: Searchbar didn't update the filters when new default filters were added. This adds the new filters when they are added to the searchbar. Existing filters are not touched.

Reviewed By: passy

Differential Revision: D12999885

fbshipit-source-id: 51d9a1579724be2098b54161b39a0769180fb343
2018-11-12 02:27:00 -08:00
Daniel Büchele
bf7c35387c Report notifications not useful
Summary:
* adds a button to hide notifications by category
* adds a quick action to report notifications as not helpful
* fixes type of network plugin's notifications to be string instead of number

Reviewed By: jknoxville

Differential Revision: D12999883

fbshipit-source-id: 32be5bde5931cca4a27ab1ad34418300196452cc
2018-11-12 01:49:48 -08:00
Daniel Büchele
bd03f891d0 notification category filters
Summary:
Allows filtering notification by category. Category filters are also persisted in redux.

Adds a test suite for notification reducer

Reviewed By: passy

Differential Revision: D12999884

fbshipit-source-id: 5f8d2357e52f091c17b726e1f89ed68f3b7294fb
2018-11-12 01:49:48 -08:00
Daniel Büchele
8cb715bb3a adding actions to notifications
Summary: This diff adds action buttons to the notifications. Notifications with actions can only be sent from the main process. This is why we need to send a message to the main process which then shows the notification. The action callbacks are sent back to the renderer process to handle the action and log the event.

Reviewed By: passy

Differential Revision: D12999886

fbshipit-source-id: b415fded3172582fad11d88cabf0cfc5b3b8d4f9
2018-11-12 01:49:48 -08:00
Brett Lavalla
4954d018d0 Add litho accessibility rendering to Flipper accessibility mode
Summary: This is a re-do of D9720987.  Now that the Litho version has been bumped to 20 in D12838684, this diff can land safely.

Reviewed By: danielbuechele

Differential Revision: D12969979

fbshipit-source-id: b12d14e3b292d8cd110967f84f770f3725a800de
2018-11-10 00:05:44 -08:00
Dimple Jethani
0bb0d69115 added clicking on urls
Summary: added clicking on links from www

Reviewed By: danielbuechele

Differential Revision: D12992945

fbshipit-source-id: 16444a0a64b8a6cc8b46d0f79b746cf56de25ed0
2018-11-09 12:18:14 -08:00
Dimple Jethani
4a02041fa1 adding tree structure to layout inspector for NT subsection
Summary: Added JSON parsing to make tree structure for NT subsection in layout inspector

Reviewed By: danielbuechele

Differential Revision: D12938117

fbshipit-source-id: 43967d2e970ff2ce7e9b2e05a99d58a95a71b650
2018-11-07 12:45:40 -08:00
John Knox
bdc3abacbd Isolate BodyFormatter exceptions
Summary: If one throws an exception, we'd skip all the other ones. I don't think that's the behaviour we want.

Reviewed By: passy

Differential Revision: D12958926

fbshipit-source-id: dd82b750197b6fc1380496be4147fe63454d39da
2018-11-07 10:35:38 -08:00
Sveinung Bakken
a56d7d5d72 Add HTML formatter to Network plugin
Summary:
Currently HTML renders as a blank response panel which is not helpful for seeing erros.
Adding a formatter for `text/html` so we can see error responses, or other HTML responses, correctly.

Note, this adds the xml beautifier package from npm.

Reviewed By: danielbuechele

Differential Revision: D12883274

fbshipit-source-id: c49b60984f10bba471b5bbb8aabcb385a171d0d6
2018-11-07 08:51:45 -08:00
Daniel Büchele
8ab52839fb UI fixes
Summary:
This is a collection of small UI fixes for the network plugin:

- image maxWidth is set to 100% to not cause vertical scrolling
- Panels now have horizontal scrollbars, if their content overflows
- fixing missing icon for failed network requests
- removing position sticky from table headers as it was not used and causing some rendering issues and performance problems
- Adding a `label` and `grow` option to the `Select`-component which is used in the sidebar of the network plugin.

Reviewed By: passy

Differential Revision: D12956336

fbshipit-source-id: 6e7e9cf97c058a2ff626576d4afdc6df65007ea1
2018-11-07 06:27:33 -08:00
Daniel Büchele
4ff5c7294c don't update when nothing changed
Summary:
The QPL plugin is sending the current time on the device every second, this was causing state updates every second.

QPL: don't update the state, when we did not receive new traces.
Client: only dispatch the update event, when the new state is different from the current.

Reviewed By: passy

Differential Revision: D12956337

fbshipit-source-id: c006540097408ead8fb8c5aac3aaaa220c1a3951
2018-11-07 06:27:33 -08:00
Daniel Büchele
db42e8e970 createTablePlugin using persistedState (fixes #310)
Summary:
Implementing persistedState for createTablePlugin, so it doesn't lose its data when switching back and forth between plugins. When `runInBackground` is set to true on the native side, createTablePlugins are now also capable of receiving new data in the background.

Adds a test suite for createTablePlugin, to make sure it:
- returns a FlipperPlugin
- ID, title and icon are set correctly
- the resetMethod clears the data
- the persistedStateReducer correctly adds new data

Reviewed By: passy

Differential Revision: D12939848

fbshipit-source-id: 30048f3ce2bb98c83b0c165e48df72c8e28eadcd
2018-11-07 02:44:35 -08:00
Hilal Alsibai
21a18d3e53 Pass real client to sidebar extension factory functions
Summary: This allows sidebar extensions to have more information as to whether they should be enabled or not

Reviewed By: danielbuechele

Differential Revision: D12930405

fbshipit-source-id: 649d3f01da1c535f7d60b7b525b012a888ea78e0
2018-11-06 11:30:35 -08:00
Daniel Büchele
2088153ffb make width of DetailsSidebar configurable
Summary:
The `DetailsSidebar` has a fixed width of 300px. For some plugins it makes sense to specify a larger width for the sidebar, to show more content in it.

Usage:
```
<DetailSidebar width={500}>...</DetailSidebar>
```

Reviewed By: passy

Differential Revision: D12924525

fbshipit-source-id: 889d799017a6d3d53f6d32510863b4838a928fba
2018-11-06 05:38:01 -08:00
Daniel Büchele
9fb3a56303 persist notification filter
Summary:
persist the state of the redux store of `blacklistedPlugins`, so we don't show notifications for them.

This also fixes a bug where defaultFilters were not shown in the filterbar.

Reviewed By: passy

Differential Revision: D12924356

fbshipit-source-id: ebc5d2f5d2d3acfb5ed63d4085b65b7a78a7b05a
2018-11-06 05:38:01 -08:00
Daniel Büchele
95a7298d21 updating UI documentation
Summary:
adding documentation for more of our UI components.

Deleted some unused components, which were not working anyways.

Reviewed By: jknoxville

Differential Revision: D12896109

fbshipit-source-id: 959c7864240883869ad67283f80a3c189b94bf00
2018-11-05 03:12:23 -08:00
John Knox
b3f9bd9ee1 Remove adb reverse from test setup
Summary:
The bash file was running adb reverse on the oneworld devices.

Switching to use the real code to do this instead.

--forceExit is needed because the dispatcher keeps an open handle on the adb connection, and it doesn't expose a close() method to stop it. I'm not sure of the best way to fix that, but it's out of scope for this diff anyway.

Reviewed By: passy

Differential Revision: D10868563

fbshipit-source-id: fb44ff1353d5050bb7967cb6c4fa18c2e5d0d149
2018-10-31 08:54:42 -07:00
Jiyue Wang
f88aa99d2a Show the streaming response correctly in Flipper
Summary: make Sonar network tab work nicely with GraphQL streaming response

Reviewed By: danielbuechele

Differential Revision: D12841335

fbshipit-source-id: efcae3428c42957cbce27d467180ccbc10dc2ae9
2018-10-31 08:07:54 -07:00
Pascal Hartig
81ef493a23 yarn fix
Summary: Fix style in master.

Reviewed By: jknoxville

Differential Revision: D12838697

fbshipit-source-id: 0d0d59d6d073c13e4a8c926d3a52329c3dc2381f
2018-10-31 04:48:30 -07:00
Pascal Hartig
0a6dbfcf3e Bump flow version
Reviewed By: priteshrnandgaonkar

Differential Revision: D12839991

fbshipit-source-id: 1dcca0a0bc682bf24430c7313d4af14b87cfc44d
2018-10-30 17:04:50 -07:00
Pritesh Nandgaonkar
2ee2dfacfe Back out "[DO NOT LAND until Litho open source version includes rerenderForAccessibility] add litho accessibility rendering to Flipper accessibility mode [2/2]"
Summary: Original commit changeset: 000a7413fcbe

Reviewed By: passy

Differential Revision: D12821473

fbshipit-source-id: 5fa369cc48f074414b04e4786d5bd634158598a6
2018-10-29 06:20:47 -07:00
Brett Lavalla
21c0b3ad0e add litho accessibility rendering to Flipper accessibility mode [2/2]
Summary: Completes D9667222 to allow force rendering of accessibility in litho when an accessibility service is not actually running.

Reviewed By: ikenwoo

Differential Revision: D9720987

fbshipit-source-id: 000a7413fcbe775a525ca3aca64443c3669cdf9e
2018-10-27 23:35:50 -07:00
John Knox
e418a810e6 Apply oneworld-fix patch before testing connectivity
Summary:
Making the runner apply the necessary oneworld fix patch before running the tests.

This can't be a long term solution, but at least means not getting that breaking change landed doesn't stop our tests from running.

Since that change is only necessary for the tests, maybe we'll get away with fixing the update process before having to land it.

Reviewed By: priteshrnandgaonkar

Differential Revision: D10852110

fbshipit-source-id: b53a6d0ae9cb51e62cafc0c0f2cfe359ee6aff46
2018-10-26 06:42:32 -07:00
Pascal Hartig
c3e4f16188 Restructure modules to reduce import-time side effects
Summary:
`flipper` does a lot of stuff at import time. I copied the `styled` reexport
to the UI module, so it's possible to just depend on that.

`remote` is another one of those pot holes that can easily ruin your journey
if you aren't careful navigating around it. Added some defensive fallbacks here
which ultimately allows the lint test to run (and pass) without Electron.

Reviewed By: danielbuechele

Differential Revision: D10507655

fbshipit-source-id: 6dad5665ba15b5cb73caa4ea46262cf337173eb8
2018-10-25 12:56:42 -07:00
Pascal Hartig
2f307b8b4f Avoid import-time side effects for application
Summary:
`INITIAL_STATE` is defined at import-time and relies on `remote.getCurrentWindow()`, which means that any import from the `flipper` module will require a display server + electron running.

Happy to take alternative suggestions to make this look a bit less intrusive.

Reviewed By: danielbuechele

Differential Revision: D10507539

fbshipit-source-id: 62b6bff0b4fd40638e54328613de4d3821b69dd6
2018-10-25 12:56:42 -07:00
John Knox
d1a1c299dc Reconnect when adb server gets killed
Summary:
Flipper tracks devices on an adb connection. If the adb server gets killed, it deletes all devices, but doesn't attempt to reconnect.
This gets it to rety after 500ms.

Reviewed By: priteshrnandgaonkar

Differential Revision: D10526974

fbshipit-source-id: a2101067f2245b728f458fc5e06dc68833c5e772
2018-10-24 08:13:43 -07:00
John Knox
bd25e5e97c Re-use adb client
Summary: This class already has an adb client. Instead of creating new ones, should just use that.

Reviewed By: passy

Differential Revision: D10231152

fbshipit-source-id: c9426a12f0f6baf94026da51a79131d07e58053c
2018-10-24 04:31:03 -07:00
Pritesh Nandgaonkar
12d2af38f7 Added screens in sample app for notification
Summary:
Added a basic communication flows and a button to trigger notification
{F142016937}

Reviewed By: jknoxville

Differential Revision: D10492428

fbshipit-source-id: b65fc46b3be695852f9197771a253d9e8596f328
2018-10-23 09:12:57 -07:00
Pascal Hartig
bc0e5b3a11 Broaden notification message type definition
Summary:
Let's the notification render any React node.
Particularly useful when including links or wanting to
format messages.

Reviewed By: jknoxville

Differential Revision: D10488157

fbshipit-source-id: 06d3c6b4477c78e8bef78e3a3dc0e05bc67a2ef4
2018-10-22 15:47:49 -07:00
John Knox
f0262d91f0 Oneworld connectivity test
Summary:
Gets a oneworld device (just android for now), installs an app. Checks it connects and stays connected for 5s.

The app installed is in an array, we just need to add more targets for further tests.

Reviewed By: danielbuechele

Differential Revision: D10231083

fbshipit-source-id: c33fb091c1b7914a33690398a79fd700c445c06c
2018-10-22 11:38:36 -07:00
John Knox
764cdfe127 Move async work out of the Server constructor
Summary:
I feel like doing async stuff here isn't a good idea in general.
But more pressingly, it means you can't immediately call server.close() after new Server(), because the things to close haven't been created yet.

Reviewed By: danielbuechele

Differential Revision: D10488301

fbshipit-source-id: 76ebe91e0c09f353e0bdb9f2e4116757e757abb2
2018-10-22 11:38:36 -07:00
Daniel Büchele
086ab0188b rename fill attribute
Summary:
We were using `fill={true}` as an attribute to make flexbox containers fill the entire available space.

However, `fill` is an HTML attribute (see: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill) This caused warnings printed to the console.

This diff renames the attribute to `grow` with is also more in line with the Flexbox terminology.

Reviewed By: priteshrnandgaonkar

Differential Revision: D10488389

fbshipit-source-id: ed8553c6203cdf6df94d26c731164ecec4c9fbd2
2018-10-22 09:54:59 -07:00