Commit Graph

47 Commits

Author SHA1 Message Date
Daniel Büchele
0ec48d4fc9 index
Summary:
This converts the index file to TypeScript which is used as an export for all plugins. Alongside, I had to fix a couple of errors in various files to make sure everything works correctly.

For plugins using flow, we define an interface which uses the type definition for FlipperPlugin and types all UI components as `any`.

Reviewed By: passy

Differential Revision: D16936890

fbshipit-source-id: dacd9a63a82b9f0bbb530b06072186874cba7b6f
2019-08-22 10:02:27 -07:00
Pascal Hartig
6c7aeef7ed Migrate exportMetrics
Summary: _typescript_

Reviewed By: jknoxville

Differential Revision: D16712087

fbshipit-source-id: 63dc45a26eb8112aef2b1bfa0d67bf57aa9ec72a
2019-08-12 03:53:16 -07:00
John Knox
3bfb7faf0a Convert plugin.js to plugin.tsx
Summary:
* Deletes plugin.js
* Adds plugin.tsx
* Adds plugin flow-typed module that has the old flow types

Reviewed By: passy

Differential Revision: D16668067

fbshipit-source-id: b2f0ce47c4cf7125b4e352821e921b97675d12a9
2019-08-08 12:06:11 -07:00
Chun-Ho Ng
fe56c8471c Frontend improvements for Databases plugin
Summary:
Specs here: https://fb.quip.com/aPPOAWMraRMT

Screenshots:
https://pxl.cl/Gngf
https://pxl.cl/Gngg
https://pxl.cl/Gngd
https://pxl.cl/GxQr
https://pxl.cl/Gngh
https://pxl.cl/Gngk
https://pxl.cl/Gngl
https://pxl.cl/Gngm

Reviewed By: quanturium

Differential Revision: D16266093

fbshipit-source-id: a5408b974875dcabcbd6055ccbb2818d0c1b25f6
2019-08-07 21:09:49 -07:00
Daniel Büchele
262b1fd4a9 flowconfig TsStub
Reviewed By: passy

Differential Revision: D16647501

fbshipit-source-id: ed92153fcf48574c5ae032131cb8d8dc4b00baf2
2019-08-05 10:29:14 -07:00
Benjamin Elo
e4601a89f3 Added IndexedDB utility functions for reading and writing bookmarks
Summary:
These are utility function for reading from the IndexedDB and writing to it. This will be used for persistant storage of bookmarks.

The reason I chose IndexedDB over local storage is due to the poor efficiency of stringifying and parsing a long list of bookmarks everytime we read and write to local storage.

With IndexedDB we can modify a single value at a time.

Bookmarks are passed around as a Map, with the key being the uri's and the common names being the values. This allows me to check if a specified uri is in the Map in O(1) time, so that I can highlight the star icon in the UI with gold.

Reviewed By: jknoxville

Differential Revision: D16498744

fbshipit-source-id: 7c7af28bf4eb3fcc985a71dfd61ffbdb8481b6a6
2019-07-28 12:50:31 -07:00
Sidd Srinivasan
dcf8bc1799 Timeline Panel
Summary: Stepper that reflects the static - states of the trace process.

Reviewed By: mfcripps

Differential Revision: D16286582

fbshipit-source-id: 9434816f2155c0205d1a3ab549580c48769c9973
2019-07-24 09:58:05 -07:00
Pascal Hartig
3760e260d6 Add xdg-basedir
Summary:
Split this up into a separate review because the file is actually
sorta hand-written and just adds noise to the things I was
actually doing.

Reviewed By: jknoxville

Differential Revision: D16441548

fbshipit-source-id: 93366d38908bbec347fd837f5dc90b11329ebf8e
2019-07-24 02:22:36 -07:00
John Knox
939513e7a6 Add dateformat flow stub
Summary: `flow-typed create-stub dateformat`

Reviewed By: passy

Differential Revision: D16334489

fbshipit-source-id: d72b89a6578913bb799f93038455e16e386a7422
2019-07-17 07:19:22 -07:00
John Knox
ef1eb41dba Use mutex library instead of repeatedly chaining promises
Summary:
I noticed that after a long-running flipper session, 11% of the memory was composed of millions of tiny PromiseReaction records (https://github.com/domenic/promises-unwrapping#promisereaction-records).

It seems this method of chaining promises meant that it was forming a linked list of these from the most recent, back to the very first invocation.

Instead of using a home-rolled lock, I'm replacing it with an actual library. Haven't verified the fix, but this seems like a better approach regardless.

Reviewed By: passy

Differential Revision: D15853570

fbshipit-source-id: 1626d9f25cba809794b13ee920bdec2cd1d4b874
2019-06-17 09:11:50 -07:00
Daniel Büchele
79414aa3e1 Bumped electron version
Summary:
We in React VR were need newer Chrome DevTools version to make our plugin work properly. Chromium version with required fixes were shipped in electron 5.0.0.

This diff bumps electron version and explicitly allows node integration (accessing require, process and other node related functions from window object in index.html), because it was disabled by default in 5.0.0.

Reviewed By: jknoxville

Differential Revision: D15693539

fbshipit-source-id: 4f71a07b2afaa489aec46940c924f4ad30ad0413
2019-06-10 10:36:25 -07:00
Daniel Büchele
53748da75e UI improvements
Summary:
* expanding/collapsing nodes
* memoizing table rows
* adding sidebar

Reviewed By: davidaurelio

Differential Revision: D15621070

fbshipit-source-id: 9335259d3b4bc1348e917782918eb1e0f678ba17
2019-06-07 08:14:20 -07:00
Pascal Hartig
e2215b4a17 Update jest flow-typed definition
Summary: Should be better than the mock we generated before, I hope.

Reviewed By: danielbuechele

Differential Revision: D15621591

fbshipit-source-id: a153d9233f6715c4c53ccabf2b8d18ce95b37f03
2019-06-05 09:38:00 -07:00
Pascal Hartig
a3b7b93167 Upgrade to Flow 0.98.1
Summary: This should buy us some time before Sandcastle kicks us off again. :)

Reviewed By: danielbuechele

Differential Revision: D15449604

fbshipit-source-id: 90d4e8a965d0163de32416b43d9aa24ede104db2
2019-06-03 07:07:24 -07:00
John Knox
9528078296 Add "Copy cell" to ManagedTable
Summary:
Previously you could only copy the entire row.
Now you can choose which cell to copy.
Not the perfect UI admittedly, but that would require a big change to make individual cells selectable. I think it's a definite improvement.

Reviewed By: passy

Differential Revision: D15231784

fbshipit-source-id: 0d52192a5bf4e8ea1ebee74988c749d3f602fea9
2019-05-08 09:42:00 -07:00
Pritesh Nandgaonkar
c422829beb Limit the message length in the notification
Summary:
Before this diff the notification fired for crash reporter had the entire callstack as its message, which is actually not required and it also makes a UI not good.

This diff just limits the message length

BUG:

{F154537911}

Reviewed By: passy

Differential Revision: D14594189

fbshipit-source-id: 663710e3e80be4367d0cc2a532fd4aa312cc0c1e
2019-03-27 08:45:41 -07: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
Daniel Büchele
ffa586dd49 adding keytar native module
Summary:
`keytar` is developped by the Nuclide team and allows cross-platform access to the system's keychain. As `keytar` has a native dependency, we need to make sure Metro doesn't try to bundle it as part of our JS bundle. We are adding another rule to our electron-transform, to not bundle `.node` files (which are native node modules).

Secondly, we need to make sure, the native module is compiled for the correct version of node.js. Usually native modules are compiled for the node version that is running on the system it is installed on. However, we need to make sure it is compiled with the node version that is bundled with electron. That's exactly what `electron-rebuild` does: It recompiles all native modules with the electron's node version.

More on native modules: https://electronjs.org/docs/tutorial/using-native-node-modules

Reviewed By: jknoxville

Differential Revision: D14224402

fbshipit-source-id: 6414a53391a861a23a5d95bf6f18cd0058d9178f
2019-02-28 07:28:25 -08:00
Pascal Hartig
ea03aa36b7 Add child-process-es6-promise
Summary: Using this in the next diff. If you don't feel like this is a good fit, probably better to comment there.

Reviewed By: jknoxville

Differential Revision: D14225747

fbshipit-source-id: 29cd0b4a37b988b4bd8643f1db64bb3e2610b0e4
2019-02-26 16:33:19 -08:00
Daniel Büchele
13f7444013 electron update
Summary:
Started with upgrading electron from 3.0.0 to 4.0.5. This required a bunch of subsequent updates:
* upgrading `electron-builder` to latest version, because the old version couldn't build electron 4 apps.
  * `appDir` is deprecated in builder config, `projectDir` is used instead, which we already had set, so its fine to just remove this ([see GitHub commit](a5e457163e)).
* upgrading `jest-runner/electron` because the old version couldn't run electron 4 tests.
  * upgrading our custom dependency resolution to use electron 4.0.5, because the test runner still resolves to 2.0.8 ([see GitHub issue](https://github.com/facebook-atom/jest-electron-runner/issues/31)).
* updating `sandcastle.sh` to use the new cache files from D14131344.
* removing `package-lock.json` as is was causing warnings. We use `yarn` and `yarn.lock` anyways. This file must have been committed by accident.
* updating our check to only run one version of Flipper at a time to use the new electron API `app.requestSingleInstanceLock` as the old one was removed in electron 4.
* updating the snapshot test that checks App rendering, which changed a little due to the electron upgrade.
* upgrading flow-type definitions to `electron-v4.0.5.js` generated by [electron-flowtype-definitions](https://github.com/danielbuechele/electron-flowtype-definitions).

**PS: Best new feature in Electron 4: Copy&paste working in dev tools**

Reviewed By: jknoxville

Differential Revision: D14131360

fbshipit-source-id: d7ed9643875629a1fa1860bb61b11dd0c64112ab
2019-02-21 02:46:12 -08:00
Pascal Hartig
ce80e03e8f Add expand-tilde package
Summary:
Just splitting the diff adding the dep from using it
because this is always quite noisy.

Reviewed By: jknoxville

Differential Revision: D13940957

fbshipit-source-id: b31a953a7ebdce9a6611c47ee007c051cdcac147
2019-02-04 04:42:18 -08:00
Pascal Hartig
09a93cd9e6 Upgrading flow and fixing lint errors
Summary:
Upgrading to flow 0.91, fixing a bunch of `$FloxFixMe`s that were introduced by upgrading to 0.86.
Also fixing some linting issues.

Reviewed By: priteshrnandgaonkar

Differential Revision: D13900794

fbshipit-source-id: 5d0a1b62371f3b5d34b909bae0876583acb6f977
2019-02-01 06:51:01 -08:00
Daniel Büchele
dab50ec5c4 add headless entry point
Summary:
Adding `headless/index.js` This is the entry point to the headless version of Flipper.

This creates a redux store, and initializes the dispatchers. As all business logic (adb connections, etc.) are managed by dispatchers, this spins up a working version of Flipper, listening on our ports, allowing connections to devices.

For APIs not available in node.js, we are adding polyfills. `WebSocket` is used by redux-devtools, `fetch` is used in a couple of places throughout the application. These polyfills are added to the global namespace, so the app can run the same as in the browser.

Reviewed By: passy

Differential Revision: D13786573

fbshipit-source-id: 685f67e1c0d2948de7c43b8a1e2dc10dc69aa743
2019-01-25 12:19:07 -08:00
Daniel Sainati
9b985b1338 remove deprecated utilities
Summary: Remove `$Subtype` and `$Supertype` utilities. Replacement was done on a best-effort basis. In many cases it sufficed to replace `$Supertype<T>` and `$Subtype<T>` with `T`, but when this was not possible `any | T` and `any & T` were used instead.

Reviewed By: jbrown215

Differential Revision: D13624765

fbshipit-source-id: 82ee9d43cfc318ed4bd2d84e0f4c5c1d8f488a9c
2019-01-15 13:58:53 -08:00
John Knox
005383f94b Add sessionId to redux store and Logger output
Summary:
I've left InteractionTracker without a store, so it doesn't know the sessionId. It really should have one, but that will have to be a different change.
We don't actually use the InteractionTracker at the moment so it's not a major deal for now.

The idea is to be able to get data like what percentage of sessions encounter an error, and how many errors sessions usually have etc.

Reviewed By: passy

Differential Revision: D13624031

fbshipit-source-id: 664e7ac5023166c2f72df3058c219901be7ff77a
2019-01-11 03:57:47 -08:00
Pascal Hartig
7471dc6481 Fix emulator launching on Linux
Summary:
The Android SDK installation on Linux is really dumb. The emulator binary
is dynamically linked and ships with some `.so`s that need to be either in `LD_LIBRARY_PATH` or `$CWD`.
For some reason, there's no script, so you have to manually `cd` into the directory in order to
run it. ¯\_(ツ)_/¯

Reviewed By: jknoxville

Differential Revision: D13589660

fbshipit-source-id: e3bdd7468108f1fb1e52f23ae45e21cacc5480f9
2019-01-07 07:47:17 -08:00
Daniel Büchele
c9b982b182 revamp UI + show oncall/group
Summary:
Redesigns the bug reporting dialog:
- show information from `package.json`'s `bugs` field, where we can link to support groups or name oncalls.
- adds show/hide animation
- uses new button style

Reviewed By: jknoxville

Differential Revision: D13417287

fbshipit-source-id: 2948794e9b1f42bbd895981d5e4b0578a9b8ee2e
2018-12-18 09:34:52 -08:00
Daniel Büchele
c92efdf945 add JS plugin
Summary:
Adding the JS part for the ComponentTree plugin.
Native parts are added in D13377058.

Reviewed By: priteshrnandgaonkar

Differential Revision: D13377066

fbshipit-source-id: dab8f2abdde604c3f78cfd80e17b433ef5e33505
2018-12-14 10:35:12 -08:00
Daniel Büchele
5a9d92c786 upgrading react-dev-tools
Summary:
Updating react-devtools plugin to the latest version.

As Flipper doesn't use a websocket anymore, this plugin was not working. In this diff, we are creating a websocket connection parallel to the rSocket connection which is used by the devtools. First we thought about tunneling the websocket through our rSocket, but this would be a lot more work.

By default they create a web-socket running on port 8097. But if this port is in use another port is used. The hostname and port to connect to is sent to the client-plugin.

Reviewed By: jknoxville

Differential Revision: D12897150

fbshipit-source-id: 6652b3c91fd5bd87fe86b29c730c8b2076bbc6ba
2018-12-04 03:37:47 -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
0a6dbfcf3e Bump flow version
Reviewed By: priteshrnandgaonkar

Differential Revision: D12839991

fbshipit-source-id: 1dcca0a0bc682bf24430c7313d4af14b87cfc44d
2018-10-30 17:04:50 -07:00
Pascal Hartig
9f24f05167 Best effort of extending immutable declaration
Summary:
It's still very much incomplete but this now exports
some of the top-level functions I'm about to use.

I'd love to just import f71ccd5db2/type-definitions/immutable.js.flow but this doesn't actually work as a module declaration because top-level type declarations are incompatible with it at the moment ... sigh.

Reviewed By: danielbuechele

Differential Revision: D10378353

fbshipit-source-id: 3023882b8bd38cf25d9a6c97905ff71548105775
2018-10-16 03:07:38 -07:00
Pascal Hartig
a379b18f64 Make immutable dependency available
Summary:
Set up hand-crafted flow type for it and add it to the offline-mirror.
Using the v4 pre-release as v3 apparently has even more effed up Flow support.

Reviewed By: danielbuechele

Differential Revision: D10258117

fbshipit-source-id: 9f6fcea152308696f34645cc99ba41b496dc5385
2018-10-10 05:43:12 -07:00
Daniel Büchele
a455520ecb adding jest test setup
Summary:
Adds a test runner for jest test and adds three simple test cases:
- render the app
- start a server
- client connecting to the app

Test can be run using `yarn test`.

To make the test runner work, some changes needed to be made:
- remove the export of `init()` from `'flipper'`, because it was a cyclic dependency
- updating Button.js to the new ref-API

Reviewed By: jknoxville

Differential Revision: D10027078

fbshipit-source-id: 49107b0dd4dec666b92ecd841422fe7e6b3a7756
2018-09-28 06:42:08 -07:00
Hilal Alsibai
5285d50abf Add syntax highlighting
Summary: Pretty colors

Reviewed By: danielbuechele

Differential Revision: D9504416

fbshipit-source-id: 7eb467ff43bed5566f3bd9ce72dc74064fb4718c
2018-08-29 03:27:07 -07:00
John Knox
db1b175d44 Use library to create temporary files
Summary: Makes the code a bit cleaner and maintainable.

Reviewed By: passy

Differential Revision: D9496316

fbshipit-source-id: a59a41b12a57bb2eedc25b154c6f9b0cdc77dd8a
2018-08-28 04:26:54 -07:00
Daniel Büchele
726966fdc0 convert to emotion
Summary:
My benchmarks have shown react-emotion to be faster than the current implementation of `styled`. For this reason, I am converting all styling to [emotion](https://emotion.sh).

Benchmark results:
{F136839093}

The syntax is very similar between the two libraries. The main difference is that emotion only allows a single function for the whole style attribute, whereas the old implementation had functions for every style-attirbute.

Before:
```
{
  color: props => props.color,
  fontSize: props => props.size,
}
```

After:
```
props => ({
  color: props.color,
  fontSize: props.size,
})
```

Reviewed By: jknoxville

Differential Revision: D9479893

fbshipit-source-id: 2c39e4618f7e52ceacb67bbec8ae26114025723f
2018-08-23 09:42:18 -07:00
Daniel Büchele
7bdb21e055 adding table debouncing
Summary:
When changing the props of a table often, this might results in a lot of unnecessary rerenders. This could be mostly seen in the analytics plugin, which is sending a lot of messages in a short time.

The update of the table component is now debounced to only re-render every 150ms. This also affects searching and filtering and makes typing in the search input smoother.

Reviewed By: passy

Differential Revision: D9447722

fbshipit-source-id: 00e092e4e047e9c40e5a1ec2789644858acc18dd
2018-08-23 04:57:28 -07:00
Daniel Büchele
1891e2c869 moving tables to react-window
Summary:
Tables were using a custom virtualization, which wasn't as performant as other solutions out there. In this diff, the table component is reworked for performance.
- removes `Table` component, because it was never used standalone, `ManagedTable` is what all plugins used
- uses `react-window` for `ManagedTable`
- reworks table highlighting and arrow-navigation to work with the new virtualization
- moves actual filtering out of `ManagedTable` into `Searchable` component for a better separation of concerns.

Reviewed By: jknoxville

Differential Revision: D9447721

fbshipit-source-id: 15eb2eb55eed9f49a0cb1ccfb2d748b3672fa898
2018-08-23 04:57:28 -07:00
John Knox
f73c28ba6b Prepare desktop app for requestResponse CSR change
Summary:
[Step 1 of a protocol change between desktop app and flipper agent]

The flipper agent periodically tries to connect.
When it doesn't have the required certs, instead of trying to connect, it requests them from the desktop.
After requesting, it just continues the loop, trying to request.

The problem with that is
a) the desktop can take longer than one cycle to generate and provide the certs, meaning the agent will make overlapping requests, causing confusion and it to take longer than necessary.
b) the desktop can take less time than a retry cycle, but the agent will still wait before trying to connect.

Fixing a) by making the agent wait for a response from the desktop before continuing attempting to reconnect.
This means on the next connection attempt, it's guaranteed that the desktop is finished processing the CSR.

b) remains unfixed for now, but can be dealt with separately.

This is step 1 which adds an extra responder to the desktop app. It won't change anything until the agent starts
sending requestResponse messages instead of fireAndForgets. The plan is to leave this in place for a while to give users time to update, after that, we'll roll out the change to the agent.

Reviewed By: passy

Differential Revision: D9179392

fbshipit-source-id: 9a8021253dcd28c15cceeec23630a67aec219fd5
2018-08-07 06:41:38 -07:00
Daniel Büchele
75dfbf51f8 electron flow type definitions
Summary: Adding a flowtype library definition for electron 3 and fixing related type errors

Reviewed By: passy

Differential Revision: D9124758

fbshipit-source-id: e09cb5b05ba952e7f95f68f9043edc586f81ae83
2018-08-02 03:57:52 -07:00
Benjamin Pankow
4818d87c3f Add hprof analysis to Memory Tools plugin
Summary: Add needle dependency.

Reviewed By: danielbuechele

Differential Revision: D8665740

fbshipit-source-id: 552bbc3d346560d5d9981a666b8fb527a27d72d3
2018-07-31 14:19:15 -07:00
Daniel Büchele
37425e7ae8 persist state over reload
Summary: The selected device, app and plugin are not persisted over a reload using `redux-persist`.

Reviewed By: jknoxville

Differential Revision: D8836481

fbshipit-source-id: 3ace1a950a200255d5daf77791d706ede0ff2138
2018-07-31 07:58:33 -07:00
Daniel Büchele
9f95698492 disable auto publish
Summary: electro-builder automatically publishes when it detects builds on TravisCI. This disables this behaviour, as we want to manually publish releases.

Reviewed By: jknoxville

Differential Revision: D8783066

fbshipit-source-id: d8723c87b879b3ef7ee02585997a13cb55095e65
2018-07-11 08:03:57 -07:00
Daniel Büchele
bcc47bfe0c add missing flow interfaces
Summary: adding missing flow interfaces, fixes flow error

Reviewed By: priteshrnandgaonkar

Differential Revision: D8639038

fbshipit-source-id: 509ebcc86ea64a01dcea4968a39ed0ea51fdec93
2018-07-03 10:05:00 -07:00
Daniel Buchele
f7d487dd76 fbshipit-source-id: 2cd940396d650342920b28835f6e672febe6b55c 2018-06-12 03:39:09 -07:00
Daniel Büchele
fbbf8cf16b Initial commit 🎉
fbshipit-source-id: b6fc29740c6875d2e78953b8a7123890a67930f2
Co-authored-by: Sebastian McKenzie <sebmck@fb.com>
Co-authored-by: John Knox <jknox@fb.com>
Co-authored-by: Emil Sjölander <emilsj@fb.com>
Co-authored-by: Pritesh Nandgaonkar <prit91@fb.com>
2018-06-01 11:03:58 +01:00