Commit Graph

1393 Commits

Author SHA1 Message Date
John Knox
5288c4ac93 Rename id in CLEAR_PLUGIN_STATE event
Summary:
There's been a bug here where the id was treated as a pluginId.
Renaming to make it clear.

Reviewed By: passy

Differential Revision: D16338884

fbshipit-source-id: 42c6c92653811d88cd37ebf4834346b1f0bb2c2a
2019-07-18 05:28:45 -07:00
John Knox
286f0d7acf Fix persistedState bug
Summary:
Persisted state was not being cleared across client disconnects.
This fixes that.

Reviewed By: passy

Differential Revision: D16338524

fbshipit-source-id: ec51ec3bd999a388a0e8687f08841970872087ec
2019-07-18 05:28:45 -07:00
Benjamin Elo
beb656c84e Added Nav Plugin tests
Summary:
Here I added two tests to test the persisted state reducer in the navigation pliugin.

I uncovered that my state reducer is not pure, as it calls the Date constructor, but I will fix this in a future update by passing the date recorded on the Android device when the nav event occurs and sending that via the socket connection.

For now I have modified the state reducer to take a date as part of the payload on a nav_event, or if none exists record the date as before. Also, if a page has no uri, but we want to record a nav event, I send null uri from the Android side. This doesn't send the uri as null to flipper; the uri object property simply doesn't exist. In this case I explicitly cast the undefined value for uri to null.

Reviewed By: jknoxville

Differential Revision: D16330958

fbshipit-source-id: fe338ea3a244df6ef33356bc7fdef8da9291dc68
2019-07-18 02:54:34 -07:00
Pascal Hartig
a6fb1a9d86 Add prefetcher mercurial setup code
Summary:
Logic for installing an uninstalling a custom `post-update` mercurial hook, invoking the script introduced in the previous diff.

This is to gather some early data before rolling this integration out more broadly, i.e. through the mercurial distribution.

Reviewed By: jknoxville

Differential Revision: D16283081

fbshipit-source-id: e8610509e5f105a9b717a881aa327bb04f9a2f4f
2019-07-18 02:48:28 -07:00
Sidd Srinivasan
4dbf51f28c switch for to htmlFor in <Select>
Summary: Was getting error that the label for Select should be using htmlFor not for. found that when wrapping with JSX - changing this inside select fixes this errorlog.

Reviewed By: passy

Differential Revision: D16264103

fbshipit-source-id: 6a19d723a8356403ba4a169e0b160fed7e137670
2019-07-17 07:57:32 -07:00
John Knox
934bfa97e4 Fix type in test
Summary: fail isn't a thing

Reviewed By: passy

Differential Revision: D16335797

fbshipit-source-id: c2f07b722424f540e6eb1a4cd423397ec1fe545c
2019-07-17 07:19:22 -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
7d3f05dae3 Re-enable flow module checking
Summary:
Setting the module extension to .tsx overrode the defaults, meaning .js files were no longer being checked when imported.

This adds the defaults back to the extensions to be checked, including `.js`
It does seem to cause errors importing `.tsx` at the moment, but there aren't many so I've just $FlowFixMe'd them for now.

https://flow.org/en/docs/config/options/#toc-module-file-ext-string

Reviewed By: passy

Differential Revision: D16333800

fbshipit-source-id: 7bea92c038048234b4f634704f71c15d79ab3c63
2019-07-17 06:40:09 -07:00
Pascal Hartig
37f8caf714 Replace commonjs import
Summary: Feels out of place. More drive-by stuff. I'll set up a linter for this later.

Reviewed By: bnelo12

Differential Revision: D16332869

fbshipit-source-id: 0fb94eabbeeca039f8704df288e26babf34a7e34
2019-07-17 06:29:23 -07:00
Mihaela Ogrezeanu
11198e003e Display data model in side panel
Summary:
This displays the data models passed to the Sections in the side panel when a data node is clicked. This does not change the collapse behaviour when a Section node is clicked.
To make it easier to associate a section with its changesets, appended the global indexes a Section is responsible for to the node label.

Reviewed By: passy

Differential Revision: D16283820

fbshipit-source-id: f1149f47dff448de05d919f7f8d16a2aba53bbb0
2019-07-17 06:29:22 -07:00
Benjamin Elo
a9e90aa9b2 Receive navigation events and persist them
Summary: After setting up the navigation event emitter on the android side, we must now receive them on the client side and persist them in the Redux store.

Reviewed By: passy

Differential Revision: D16280944

fbshipit-source-id: 3dc4c5c6add41388469c801700974eb0ccd9a56b
2019-07-17 03:00:50 -07:00
Benjamin Elo
ce93ecfcca Speed up Redux dev tools by disabling log serialization
Summary: Serializing the logs of the devices within Redux dev tools was causing Electron to crash due to it being out of memory. We can sanitize the state serialization by rewriting the device logs to <<DEVICE_LOGS>>. This fixes the issue and causes Electron to use less memory and CPU while in devlopment mode.

Reviewed By: jknoxville

Differential Revision: D16282673

fbshipit-source-id: abee6d167b23f24647e45f039a77ab60576ab3e6
2019-07-17 02:50:13 -07:00
John Knox
782c23393a Back out "[flipper] disconnect client instead of removing it"
Summary:
Original commit changeset: 650ef1344b8b

Backing this out until we can come up with a better way to do it.

The change was introduced so that when a device disconnects / crashes, we don't lose all plugin state, and you can still see what was on screen before the crash..

However, there are some problems with this solution, which get quite complicated. Putting them here for future reference:
* Closing an app results in the plugins staying there, and there's no way to tell it's not actually connected.
* If the app reconnects, the JS plugin doesn't get re-initialized. Even though the client plugin has been.

Reviewed By: bnelo12

Differential Revision: D16280931

fbshipit-source-id: 48e09b876e631aa87372054e706cdb9a2b3e2eb7
2019-07-16 08:39:05 -07:00
John Knox
a097e673d8 Back out "[flipper] fix reconnecting clients"
Summary:
Original commit changeset: 1d0e6ce17c89

Backing this out until we can come up with a better way to do it.

The change was introduced so that when a device disconnects / crashes, we don't lose all plugin state, and you can still see what was on screen before the crash..

However, there are some problems with this solution, which get quite complicated. Putting them here for future reference:
* Closing an app results in the plugins staying there, and there's no way to tell it's not actually connected.
* If the app reconnects, the JS plugin doesn't get re-initialized. Even though the client plugin has been.

Reviewed By: bnelo12

Differential Revision: D16280932

fbshipit-source-id: 92585cdd0dace2012924df4106327a1e21ab9f9b
2019-07-16 08:39:05 -07:00
Mihaela Ogrezeanu
42c887e634 Add more fields on the Tree nodes
Summary:
Add fields for colouring the changeset operation that was performed on a node in the tree.
Changesets are not ordered by type of operation, they need to be displayed in order

Reviewed By: danielbuechele

Differential Revision: D16121158

fbshipit-source-id: 411557170b16ada9d1d72fb617b1aaf583e0f0e7
2019-07-16 07:33:12 -07:00
John Knox
9a97b3b45b Add 1h tolerance to ssl certs
Summary:
This changes the start date of all generated certificates to be 1h in the past.

Why? To allow for clock skew, and allow clock manipulation in tests.

To do this, I had to switch from `openssl x509 req`, to `openssl ca` for generating them, because it has the startdate parameter.

This variant is a bit more complicated to use, so I've added an openssl.conf and some extra files.

I also changed the org from Sonar to Flipper because it now needs to match the CSRs coming from the mobile apps, and they use Flipper.

Reviewed By: passy

Differential Revision: D16223722

fbshipit-source-id: bdbd61bce1bc1b54d7b0b3cc6741675aa68d2cf6
2019-07-15 04:33:52 -07:00
Pritesh Nandgaonkar
ba95e73a8d Show status updates while exporting
Summary: Adds a feature to display status update, while exporting Flipper trace. This will make user aware of the steps which are being executed to export flipper trace. This diff also logs the status update, to better support the issue posted by the user regarding the Flipper trace.

Reviewed By: jknoxville

Differential Revision: D16203810

fbshipit-source-id: 8f0bdc3836fec6dd79f2ca9827822d13f6cfd8bd
2019-07-15 04:01:45 -07:00
Pritesh Nandgaonkar
7f2709e1a5 Add close button to the export share sheet
Summary: Adds close button to the dialog box which appears while exporting a flipper trace. To implement this I had to first see what is the bottle neck of the export process. The major bottle neck turned out to be the serialization step. So to make the export process interruptible, I have put in a call `await idler.idle()` which resolves when the main thread is idle. I have also added the tests for the idler.

Reviewed By: passy

Differential Revision: D16183582

fbshipit-source-id: 4ec0c985e216fd9d41e91cdcd8b4cca66d2cb04d
2019-07-15 04:01:44 -07:00
Daniel Büchele
0a42558344 TitleBar
Summary: Let's migrate one file to TS, this helps us to test our tooling and make sure, everything works as expected.

Reviewed By: bnelo12

Differential Revision: D16149514

fbshipit-source-id: 05055a1830f187c6812baa661e109ea67995253b
2019-07-12 04:24:33 -07:00
Benjamin Elo
9f1f34bd99 Added search bar to navigation plugin
Summary:
Here I've started work on a search bar for the top of my plugin. Currently it supports navigation in a device by typing in an app uri and pressing the enter key or by pressing the send icon.

More features will be added as other components for this plugin are added. I have added a function stub for the bookmark button for now and the drop down icon is purely cosmetic at the moment.

Reviewed By: jknoxville

Differential Revision: D16183223

fbshipit-source-id: 0313d8c6e3a967c9400b9e9d3f24960e6a021a8c
2019-07-11 07:48:47 -07:00
Benjamin Elo
222676eb44 Moved navigation inside of Android Device
Summary:
It makes more sense for the navigation ability to be inside the Device's class instead of scattered throughout the rest of the app.

I have moved the Android navigation logic inside the AndroidDevice and added a function stub to BaseDevice. I also encoded the URI as an initial safeguard to injection attacks via adb, but will remove this altogether once I enable navigation through the socket connection.

Reviewed By: jknoxville

Differential Revision: D16182374

fbshipit-source-id: be3c6d1cfcbe293583edada1f77c023965dfd12c
2019-07-10 12:13:16 -07:00
Pascal Hartig
e831743132 Harden lint rules
Summary: Taking another stab at adding some lint rules to make it harder to shoot yourself in the foot. Hopefully nothing too controversial. Preferring spread and rest should lead is more readable and there's no downside when using ES6. The "useless" rules are just things like renaming imports to the original name which should only happen during refactors.

Reviewed By: jknoxville

Differential Revision: D16180453

fbshipit-source-id: 1cf6851b7726c0aee953ec7cf7dd6fa0aca32253
2019-07-10 12:06:39 -07:00
Edward Pastuszenski
4f4d9fa76e Omit invisible columns from horizontallyScrollable ManagedTables' width
Summary: Currently, `horizontallyScrollable` logic includes even invisible columns in the width calculation for `horizontallyScrollable` `ManagedTable`s, resulting in large empty spaces when many columns are invisible.

Reviewed By: danielbuechele

Differential Revision: D16139713

fbshipit-source-id: f653121845fbeac8a29bdb67ad0309add28e526a
2019-07-10 03:28:26 -07:00
John Knox
385d9ded57 Don't create adb client during module import
Summary:
Creation of the adb client requires the logger to already be initialized, so this should never be called at the global scope in a module, or you'll get weird import-order related bugs.

I noticed this while debugging, I don't think it's impacting anything right now, but have made it lazy just to avoid confusion in future.

Reviewed By: passy

Differential Revision: D16162266

fbshipit-source-id: 5363292d5cfcf2867a2654777cd8f4baed01d2c0
2019-07-10 03:28:25 -07:00
Pascal Hartig
c588b650ae Prefer const wherever possible
Summary:
Non-final identifiers make code harder to understand.
This is particularly true for JavaScript where even the *type*
can change as a value gets reassigned later.

This enforces to use `const` whereever possible, but doesn't
"outlaw" `let`. Mixed destructuring is also still allowed.

Used `eslint --fix` to change all existing cases.

Reviewed By: jknoxville

Differential Revision: D16131329

fbshipit-source-id: 2eceaca7c603b71b36e005be5d135e1849f2518d
2019-07-10 03:28:25 -07:00
Pascal Hartig
662db20948 Disallow var
Summary: We're ES6 and `var`s scoping rules are weird. Let's block this.

Reviewed By: jknoxville

Differential Revision: D16131290

fbshipit-source-id: ba67d16bb8a185a4bb59a657a97b00230dbacafe
2019-07-10 03:28:25 -07:00
Daniel Büchele
af8fbf2b46 remove warning for GKs
Summary: As we are trying to clean the console from any non-important logs, I am removing the warnings about GK'd plugins. This information can be seen on the "Plugin not showing" panel.

Reviewed By: jknoxville

Differential Revision: D16148408

fbshipit-source-id: 5aeffa6e82524aacb050385ba86439654c07c741
2019-07-09 03:07:04 -07:00
Pascal Hartig
434913de40 Add yarn lock
Summary: Gets generated when running yarn, let's check it in.

Reviewed By: danielbuechele

Differential Revision: D16131278

fbshipit-source-id: d604a0af148826818d89c95f5ef07b595f60dca3
2019-07-08 04:56:01 -07:00
Roman Gorbunov
6c5e2cbcf8 Added highlighting of search results
Summary:
Text of the component is now can be searched if flipper layout plugin
Flipper now highlight all the row if name of id or text of this component matched to the query

Reviewed By: priteshrnandgaonkar

Differential Revision: D16108315

fbshipit-source-id: ff5eb0bc4890f02c9b07e47c26b9ea1408d9c606
2019-07-08 03:43:55 -07:00
Zoltán Gilián
6e1483edfa Export graphQLQuery function from fb/user.js
Summary: ... so device plugins can import it via the flipper module.

Reviewed By: danielbuechele

Differential Revision: D16111730

fbshipit-source-id: ac399692a11fc2b61d702eb46c57f6ca30fe0d72
2019-07-08 03:28:31 -07:00
Daniel Büchele
5c96b0952b set selectedDevice to null instead of undefined
Summary:
We are using `redux-persist` to persist parts of our redux store over reloads. In this library, there is a check if a value "was removed to the store". However, they are doing this check by checking if the value of this key is `undefined`. This is not a good way of checking if a property exists on an object, because it can exists but explicitly be set to `undefined`. This was the case for `connections.selectedDevice`, we were setting the value to undefined, once the device disconnected. This caused the key to be persisted, eventhough it wasn't whitelisted for persisting.

In this diff, we are setting the `selectedDevice` to `null` instead of `undefined` once a device disconnects.

Reviewed By: passy

Differential Revision: D16121260

fbshipit-source-id: f32c8ea9e30f02e065fa63380ae0245379a47496
2019-07-04 08:11:53 -07:00
Benjamin Elo
4d774ba252 Added navigation plugin
Summary: Adding the auto-genrated scarf files from creating the Flipper navigation plugin. GK for this plugin is flipper-navigation.

Reviewed By: jknoxville, danielbuechele

Differential Revision: D16119841

fbshipit-source-id: 74e19c82dc95e73fe2ae06d1eb8cef2456b81931
2019-07-04 05:20:51 -07:00
henry_zheng
1b3ae77c40 fix network stackoverflow #215 (#474)
Summary:
fixed issue: https://github.com/facebook/flipper/issues/215

## Changelog

1. use pako to inflate direct to unicode string to avoid 'stack size limit exceed' problem
Pull Request resolved: https://github.com/facebook/flipper/pull/474

Test Plan:
Tested with Meetup trace that crashes reproducibly without this fix:
{F165395994}

Tested gzipped body with fb4a:

{F165396053}

Reviewed By: jknoxville

Differential Revision: D16090209

Pulled By: passy

fbshipit-source-id: 64b8a61fa9d80d9e8b62105b3f1dc3289a29cc07
2019-07-04 05:15:22 -07:00
John Knox
33df17b462 Fix layout search red text
Summary: The search text should only appear red when it's a regex, and when that regex is not valid.

Reviewed By: danielbuechele

Differential Revision: D16091096

fbshipit-source-id: 22b3e229e2c82ced956bae8fd203c5f177323dc2
2019-07-03 03:40:16 -07:00
Pritesh Nandgaonkar
004efcb7a8 Fasten up serialization
Summary:
The serialization algo was slow. The problem was that it used to just go to the first child which was not serializable and went back to the parent which then looked for first child from the remaining children and serialized it, and this happened at all levels. Instead, currently, the child fills the stack up with the children which needs to be serialized, so there is no back and forth for each child. This improved the speed a lot.

Test case: Serializing ~10000 rows of logs
Previous Iterative algo: 33215.3 ms
Iterative Algo with the above change: 2051.1 ms
Recursive Algo: ~1000 ms

New Algo Video:

{F164050963}

Prev Algo: Too Slow

{F164051027}

{F164051085}

Recursive Speed:

{F164051982}

Reviewed By: jknoxville

Differential Revision: D16037998

fbshipit-source-id: 70fae9a0073ff28d1a6528ec0dbddceb213b2c5f
2019-07-02 08:12:28 -07:00
Benjamin Elo
641c9eee36 Added LocationButton component
Summary: This button will be used to navigate between most recent and favorite locations within an Android app. Button is WIP and will be modified when work on the Navigation plugin begins.

Reviewed By: jknoxville

Differential Revision: D16088389

fbshipit-source-id: 64dcbc678ddeaeb36dd771d0cccef7c78bbc4b5c
2019-07-02 06:36:37 -07:00
Daniel Büchele
f2c8fe0205 fix reconnecting clients
Summary:
When an archived device reconnected, the clients from the architved device weren't removed and a new client was added. This caused a client to be shown multiple times after reconnecting a device.

In this diff, all clients and pluginStates from an archived device are removed once the device reconnects.

Reviewed By: passy

Differential Revision: D16075349

fbshipit-source-id: 1d0e6ce17c89bb75dd993466bca6bd64e2c63338
2019-07-02 03:11:06 -07:00
Benjamin Elo
28d4e6409d Created chained button group component
Summary:
This is a new component that allows for chaining of buttons in a button group by placing an icon in between them.

This is how we plan to navigate between views within an Android app.

Reviewed By: danielbuechele

Differential Revision: D16071234

fbshipit-source-id: 404a3a341081b6111667bd5acf27876bec627435
2019-07-01 08:31:22 -07:00
Mihaela Ogrezeanu
353f65cd7f Move Sections Plugin to OS folder
Summary: as title; we'd like to reuse this for the Litho sections plugin but not having it in OS makes setting up deps more difficult than it should be.

Reviewed By: danielbuechele

Differential Revision: D16052298

fbshipit-source-id: cd965688eff4fedbe57264e6676b6ca09b9deb45
2019-07-01 07:06:39 -07:00
Daniel Büchele
468468a3bc Client fixes
Summary:
Event emitter was typed any. Therefore, Client extended any and thing went south.
removing the explicit any type and fixing flow errors.

Reviewed By: jknoxville

Differential Revision: D15987630

fbshipit-source-id: 9456149d46f839d9579fcc2671ab2a82935fc23a
2019-07-01 02:36:18 -07:00
Benjamin Elo
1a0ee24b1a Mac devices excluded from default devices
Summary:
Bug Summary:

When running Flipper on Mac, the Mac device is always first to register with Flipper and thus is always selected as the default connected device when first launching. This blocks the beautiful tutorial screen from appearing for new users.

Fix:

When registering new devices in the redux store, a new check has been added that maintains a blacklist of devices that cannot be selected as default. I have added Mac to start. At the same time, this fix preserves userPreferredDevices so that if the user has selected Mac as a device in the past, then next time Flipper is opened, even blacklisted devices will be displayed.

Making this fix uncovered a race condition, between the redux state being rehydrated and the devices being registered. I have potentially fixed this via a callback function in persistStore.

Reviewed By: passy

Differential Revision: D16048371

fbshipit-source-id: 79580b30e8a3b077dac1ac15131266e59646253f
2019-06-28 03:46:34 -07:00
Roman Gorbunov
30b7d4e9dd Copy ID of view
Summary: Now if you copy one of components in flipper in layout plugin, you will get not only name but also id in your clipboard

Reviewed By: priteshrnandgaonkar

Differential Revision: D16031628

fbshipit-source-id: e2c38182dea28719615609f3aa2c74e58749cce4
2019-06-28 01:51:40 -07:00
Benjamin Elo
ecf2831d5d Added toggle fix for dropdown device menu
Summary:
Summary of Bug:

The devices menu popup does not toggle as expected.

Because of the way the click event is fired in Javascript, that is mousedown, mouseup, click, and the fact that the electron menu closes on mousedown, was why the menu was not toggling as expected.

Fix:

This is a potential fix where I add some state to tell if the menu was recently closed, and disable the popup if it was. This is done through the callback method of menu.popup. Then on the next mouse event I renable the popup.

In addition to this, I moved the popup logic into onMouseUp instead of onClick. This was simply to make the code neater. Before I would have to add a timer to the onMouseUp event that would fire after the click event and renable the popup.

Let me know if there is a simple solution to this problem that I've completely missed.

Reviewed By: jknoxville

Differential Revision: D16028864

fbshipit-source-id: a73202536762cce2ab623176cbda0369ca2b8079
2019-06-27 07:19:43 -07:00
Pritesh Nandgaonkar
81b71352dd Fix the bug related to the crash selection
Summary:
Fixes the bug when the crash options had same title. Selection was broken in that case. Look at the video.

{F163450316}

Reviewed By: jknoxville

Differential Revision: D15985919

fbshipit-source-id: 7366c8f5f33bbddc15c058b7d20d78d295161404
2019-06-27 06:58:08 -07:00
Pritesh Nandgaonkar
c38a55d98f Clear entries from the device when logs are cleared
Summary: Before this diff "Clear Logs" didn't used to clear the log entries from the redux store. It just used to update the state, so when you switched back from other plugins, all previous log information used to pop up again. This diff fixes that.

Reviewed By: passy

Differential Revision: D16012710

fbshipit-source-id: 4393520ab6f77caa5f286e22446d2cb6d0827d71
2019-06-27 06:58:08 -07:00
Pritesh Nandgaonkar
43495fa64c Do no fetch meta data for the archived device
Summary: Do not fetch meta data when the selected device is the archived one,

Reviewed By: jknoxville

Differential Revision: D16011742

fbshipit-source-id: cd84ef62094ffd8f90922d304ebd911f3b36f469
2019-06-27 06:58:07 -07:00
John Knox
34f835ace8 More exit handling fixes
Summary:
Line 166 is missing a process.exit() causing the process to stay open forever if anything goes wrong.

Making everything use errorAndExit, and making use of the utility function so we don't need to remember when to print e, and when to print e.message.

Reviewed By: passy

Differential Revision: D15989164

fbshipit-source-id: c683fa07d98fe49283a59b5f8108ef54babc97a3
2019-06-26 09:17:56 -07:00
Daniel Büchele
718939cd6b disconnect client instead of removing it
Summary: When an Android device disconnects, the device is marked as offline. In this diff, we want to make sure the client for the disconnected apps is not removed, but converted into a "disconnected" client. This makes sure plugins are still shown for the disconnected app.

Reviewed By: passy

Differential Revision: D15985424

fbshipit-source-id: 650ef1344b8be4411794b0344805cb75ceae4a83
2019-06-25 07:51:51 -07:00
Pascal Hartig
7d4bd4e1f3 Track usage of leak switch
Summary:
Logging to see how many people use this feature in addition to the notification logs
we keep.

Reviewed By: oprisnik

Differential Revision: D15983761

fbshipit-source-id: db64bf97d0643f2bfce25a539ee10147924ee3f8
2019-06-25 05:42:08 -07:00
Pritesh Nandgaonkar
cad26c9319 Refactor headless start function
Summary: Refactors the headless to have a list of closures instead of the `if` conditions. This will make addition of new arguments easy as it will be just adding a new closure to the list. One can change the order of the execution of the closures by inserting it at whatever index the user wants.

Reviewed By: passy

Differential Revision: D15965142

fbshipit-source-id: e9f348fe9d9011adcd47d140713d6187eab3b3d3
2019-06-25 04:59:44 -07:00