Commit Graph

467 Commits

Author SHA1 Message Date
Michel Weststrate
e3cb16d870 Fixed layout issue with undefined column widths
Summary: This fixes an earlier reported issue with Messages plugin, if no column widths are set values can jump around per row

Reviewed By: passy

Differential Revision: D28090807

fbshipit-source-id: be124b94f507584cf177710816035cd280a5ef01
2021-04-29 07:31:54 -07:00
Brian Vaughn
e7cdbcbe85 Update react-devtools-core from ~4.10.2 to ~4.10.3 (#2244)
Summary:
4.10.2 had an fburl.com link in it when I should have used an fb.me link :( I'm sorry

cc mweststrate

Pull Request resolved: https://github.com/facebook/flipper/pull/2244

Reviewed By: passy

Differential Revision: D28054736

Pulled By: mweststrate

fbshipit-source-id: 0330f884e5d82cc669232aee3d8439b0f51240bd
2021-04-29 04:25:34 -07:00
Anton Nikolaev
c4887e638b Fixed adding queries to favorites
Summary: I found a bug after migration to Sandy. It is now not possible to add queries to favorites. This diff fixes the issue.

Reviewed By: mweststrate

Differential Revision: D28066435

fbshipit-source-id: 129a62dab9521160f8957abba70e5c7a6e609839
2021-04-29 01:27:54 -07:00
Pascal Hartig
cf2405a466 Convert flipper-messages to ant.design
Summary: The main change is the move to DataTable here.

Reviewed By: mweststrate

Differential Revision: D28006097

fbshipit-source-id: 7564276a1177a7835612db08857862cb81942bce
2021-04-28 07:06:09 -07:00
Brian Vaughn
e423bc7959 Update react-devtools-core from ^4.10.1 to ~4.10.2 (#2243)
Summary:
Bumps [react-devtools-core](https://github.com/facebook/react/tree/master/packages/react-devtools-core) from 4.10.1 to 4.10.2.

This update has only one change: https://github.com/facebook/react/pull/21344

For more background information on this upgrade: https://github.com/facebook/react/issues/21326

cc mweststrate

Pull Request resolved: https://github.com/facebook/flipper/pull/2243

Reviewed By: bvaughn

Differential Revision: D28040682

Pulled By: mweststrate

fbshipit-source-id: 82b1212f839719ff69b3b7735a8a24042b382085
2021-04-27 15:03:39 -07:00
Anton Nikolaev
c2a07e7638 Databases plugin migrated to Sandy functional API
Summary: Converted Databases plugin to Sandy functional API

Reviewed By: mweststrate

Differential Revision: D27999205

fbshipit-source-id: e9d2c7aa5858b9da3c1672efbb558fb6b1077b6b
2021-04-27 09:31:11 -07:00
Pascal Hartig
dcc7e06afc Add test for flipper-messages
Summary: Some non-UI tests. Couldn't quite figure out how to make the renderer aware of changes in the old ManagedTable. Given that I've got a task for migrating, I didn't think it was worth digging into it more.

Reviewed By: mweststrate

Differential Revision: D28001651

fbshipit-source-id: 034b3d71bff2513c946b9f84525f3344b7879df9
2021-04-27 09:06:10 -07:00
Pascal Hartig
15e4ae5c24 Convert flipper-messages to Sandy
Summary: No logic change or UI update, just 1-to-1 conversion.

Reviewed By: mweststrate

Differential Revision: D27997791

fbshipit-source-id: 4cde0ef7d749d3117ef95cf67e9ce66e9674f747
2021-04-27 09:06:10 -07:00
Harold Martin
4d262c0da4 Add protobuf support to network inspector (#2080)
Summary:
Protobuf based APIs are becoming more common (i.e. gRPC) but are difficult to inspect. Unlike plain text data formats (JSON), Protobuf calls transmit binary data requiring the format to be known ahead of time, making ad-hoc inspection impossible. This PR allows for those format definitions (messages in protobuf terminology) to be transmitted from the client to the network inspector plugin. These definitions are then imported into ProtobufJS which enables the binary data transmitted to be inspected as easily as JSON data.

See Retrofit PR in https://github.com/facebook/flipper/pull/2084

## Changelog

* Add ProtobufJS library to network plugin
* New `ProtobufFormatter` UI in `RequestDetails`
* `ProtobufDefinitionsRepository` to cache and load protobuf defintions
* `addProtobufDefinitions` call in the Android network plugin

Pull Request resolved: https://github.com/facebook/flipper/pull/2080

Test Plan: ![screenshot](https://user-images.githubusercontent.com/745166/111652068-001a5e80-87c4-11eb-8c94-e19b46dd074c.png)

Reviewed By: mweststrate

Differential Revision: D27507451

Pulled By: passy

fbshipit-source-id: 586d891b74f2b17d28fe7a2a99074da755851f38
2021-04-20 05:10:39 -07:00
Tim Yung
451c332260 Back out "Update React DevTools deps from 4.6 -> 4.12"
Summary:
Reverts D27764688 (7bd4f80c25) due to a bug with "Invalid hook call." being erroneously reported. We will upgrade again after that bug is resolved.

Changelog:
[Internal]

Reviewed By: fkgozali

Differential Revision: D27813660

fbshipit-source-id: 84a12f19cf1bb7e8aebef0da3ff6f7022c391d3e
2021-04-15 21:15:50 -07:00
Michel Weststrate
0fe879c838 Improve multiple element selector UI
Summary:
Layer selection is pretty easy to miss, as reported in for example: https://fb.workplace.com/groups/flippersupport/permalink/1098169193997071/

Moved the layer selection to the top of the view and gave it some highlighting + dynamic height. The section is no longer collapsible.

Changelog: [Layout] Make the layer selection more prominent

Reviewed By: priteshrnandgaonkar

Differential Revision: D27708650

fbshipit-source-id: c86a55c3a20794aee86e64b6766b2ca4dd6b563f
2021-04-15 07:48:33 -07:00
Michel Weststrate
5db2ef1275 Perf fixes
Summary:
This diff fixes some more perf bottlenecks in the layout inspector (see the diffs earlier in the stack for the total picture). Mostly:

1. Pass down stable refs from the root for callbacks and configuration
2. Remove the deep-equality check in the sidebar section rendering, which has a pretty significant constant overhead, especially if the selection didn't change
3. If the selection changes, the correct semantics is to reset the sidebar rather than trying to reconcile the elements. (A consequence of this is that Panel collapse state isn't preserved atm after changing selection, will address that in a later diff)

This reduces average render time for sidebar from ~20 to ~2 ms.

Reviewed By: priteshrnandgaonkar

Differential Revision: D27677353

fbshipit-source-id: ba183b7e3d778c0b3c8e7ca0d51535ce99a097ca
2021-04-15 07:48:33 -07:00
Michel Weststrate
4f75247213 Make Sidebar Extensions more idiomatic
Summary: Sidebar extensions were unkeyed, which make them render inefficiently. I cleaned the api a bit here by making the extensions more idiomatic; they are now components rather then functions, so that they have their own render cycle, state, etc. They are memo-ed now as well, so that they don't have to re-render if the selected item doesn't change.

Reviewed By: nikoant

Differential Revision: D27685980

fbshipit-source-id: b133bc42061b3b8cf971792f5818810ecb80e3ea
2021-04-15 07:48:33 -07:00
Michel Weststrate
7d9495027b Fix layout inspector re-rendering all elements on all changes
Summary:
Changelog: [Layout] Addressed several performance issues in the layout plugin

This diff and a few of the next stuff fix some performance issues in the Layout plugin. This diff fixes an issue where computing the context menu will cause all rows to render at all times, make the responiveness of the plugin quite slugish.

The fix in this case is to build up the context menu lazily, and pass a stable ref to the function through the tree, rather than a new menu every time the root component renders.

The changes in this diff and the next ones in total reduces the time (in prod builds) to draw a frame from ~200ms to ~5ms.

Reviewed By: cekkaewnumchai

Differential Revision: D27685983

fbshipit-source-id: a48b2ce2cdd1db31bb13122924617cbc3b6c198a
2021-04-15 07:48:33 -07:00
Michel Weststrate
69de9bc92d Initial move to flipper-plugin
Summary:
This diff moves the core of ElementsInspector to flipper-plugin and decouples it from legacy design system and Electron, without any significant improvements or API changes yet, which will follow later.

Colors and docs will be added later in this stack.

Reviewed By: passy

Differential Revision: D27660300

fbshipit-source-id: 96abfa3b3174fa852cf04ae119c23c3d629fee74
2021-04-15 07:48:33 -07:00
Brian Vaughn
7bd4f80c25 Update React DevTools deps from 4.6 -> 4.12
Summary:
Update `react-devtools-core` and `react-devtools` dependencies for RN, VSCode, Sonar, etc.

# Changelog:

[General][Changed] - Upgraded react-devtools-core dependency to 4.12.0

Reviewed By: gaearon

Differential Revision: D27764688

fbshipit-source-id: faa179cf4be3b49b14244d47ee0b91ae63138b8b
2021-04-14 13:37:24 -07:00
Anton Nikolaev
dc7226b7dc Script for plugin type-checking (#2172)
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/2172

New script which runs "tsc" for all plugins, receives list of errors and then checks which plugins are affected. It works for shared libs too, e.g. if there is an error in a shared library, then all plugins dependant on it will be counted as affected. For convenience, script saves list of errors affecting each plugin to "tsc-errors.log" in plugin folder.

This script will be used for automatic type-checking plugins against current "stable" and "insiders" versions of Flipper.

An alternative to this implementation would be to simply run "tsc" for each plugin individually, but such implementation takes a lot of time (5+ sec per plugin) and so cannot be effectively used on diffs.

Reviewed By: mweststrate

Differential Revision: D27499765

fbshipit-source-id: fcbbfc94a13e6c7c5beff0c889a929f84c41b2dd
2021-04-09 05:22:01 -07:00
Anton Nikolaev
e7c5a5cc93 Check that all dependencies provided by Flipper core are specified as peers in plugins
Summary: This is a guard to ensure all Flipper built-in packages are declared as peer dependencies. It also removes all of them from nested node_modules after installation to be 100% sure they always loaded from the root folder, because e.g. react can be still installed as a transitive dependency even it is not declared as dependency directly.

Reviewed By: passy

Differential Revision: D27040267

fbshipit-source-id: 1e315a6b280b36ab20778ee261aa386b51d9f964
2021-04-09 05:22:00 -07:00
Anton Nikolaev
b45b5f854a Move layout plugin sidebar extensions to the plugin package
Summary: Moved layout plugin sidebar extensions to the plugin package.

Reviewed By: passy

Differential Revision: D27036489

fbshipit-source-id: 5b3406e5c50ba61709d925a3c0cb07a6fd7552db
2021-04-09 05:22:00 -07:00
Anton Nikolaev
e5261967cb Link shared libs to allow re-using them in both in public and fb-internal plugins
Summary:
Link plugin shared libraries to the "plugins/node_modules" dir so they can be used as peer dependencies by both public and fb-internal plugins.

```
plugins
- node_modules
-- fb_shared_lib (symlink pointing to "plugins/fb/fb_shared_lib")
-- public_shared_lib (symlink pointing to "plugins/public/public_shared_lib")
- fb
-- fb_shared_lib
-- fb_plugin (can now use both fb_shared_lib and public_shared_lib as peer dependencies)
- public
-- public_shared_lib
-- public_plugin (can now use both public_shared_lib and fb_shared_lib (optionally if it's an fb-internal repo) as peer dependencies)
```

Reviewed By: passy

Differential Revision: D27034936

fbshipit-source-id: 68ee5312060ff57649ae061dd7dd14f8beb6d4a1
2021-04-09 05:22:00 -07:00
Anton Nikolaev
b3274a8450 Plugin folders re-structuring
Summary:
Here I'm changing plugin repository structure to allow re-using of shared packages between both public and fb-internal plugins, and to ensure that public plugins has their own yarn.lock as this will be required to implement reproducible jobs checking plugin compatibility with released flipper versions.

Please note that there are a lot of moved files in this diff, make sure to click "Expand all" to see all that actually changed (there are not much of them actually).

New proposed structure for plugin packages:
```
- root
- node_modules - modules included into Flipper: flipper, flipper-plugin, react, antd, emotion
-- plugins
 --- node_modules - modules used by both public and fb-internal plugins (shared libs will be linked here, see D27034936)
 --- public
---- node_modules - modules used by public plugins
---- pluginA
----- node_modules - modules used by plugin A exclusively
---- pluginB
----- node_modules - modules used by plugin B exclusively
 --- fb
---- node_modules - modules used by fb-internal plugins
---- pluginC
----- node_modules - modules used by plugin C exclusively
---- pluginD
----- node_modules - modules used by plugin D exclusively
```
I've moved all public plugins under dir "plugins/public" and excluded them from root yarn workspaces. Instead, they will have their own yarn workspaces config and yarn.lock and they will use flipper modules as peer dependencies.

Reviewed By: mweststrate

Differential Revision: D27034108

fbshipit-source-id: c2310e3c5bfe7526033f51b46c0ae40199fd7586
2021-04-09 05:22:00 -07:00
Michel Weststrate
07c4470ab9 Stricter types for DataDescription
Summary: Made datatypes used by DataInspector more strictly typed (in the hope to be able to drop some, but all are still in use, although the distinction between different elements isn't always clear).

Reviewed By: passy

Differential Revision: D27266825

fbshipit-source-id: 6a1c74b0ae3daff6299ca598b18a205d17c42e22
2021-04-07 07:55:12 -07:00
Michel Weststrate
b597da01e7 Introduce row truncation
Summary:
Changelog: Logs plugin will now automatically truncate long lines

...for a more pleasant experience where long messages don't distort things to much. (Made the buttons purple in a next diff for better contrast)

Reviewed By: passy

Differential Revision: D27395517

fbshipit-source-id: 733cd6329b979453ef3b428693be8c47c37adf4d
2021-03-31 03:44:34 -07:00
Mathis Gardon
f25d189aa5 Support custom metro ports (#2050)
Summary:
Based on issue https://github.com/facebook/flipper/issues/1509 I needed a custom port for the metro server to pass to flipper.

## Changelog

introduce `METRO_SERVER_PORT` env variable to be able to customize default 8081 port on startup.

Pull Request resolved: https://github.com/facebook/flipper/pull/2050

Test Plan:
Tested with a locally built linux desktop app, this seems to work OK pour hermes debugging & RN logging.

React DevTools don't seem to find the running app, maybe there's a mapping to handle there too ?

Reviewed By: jknoxville

Differential Revision: D27339006

Pulled By: passy

fbshipit-source-id: b1700c4fe73f14bf4617e23583b2954012e0a5aa
2021-03-31 03:30:14 -07:00
Michel Weststrate
d5fbe9a5b9 Support physical device logging
Summary:
Changelog: Logs plugin now supports physical iOS devices

As reported in https://github.com/facebook/flipper/issues/262 and linked papercut.

This diff adds support for iOS device logs through idb. Since idb doesn't respect `--json` flag at the moment, we perform the parsing in Flipper itself.

Reviewed By: passy

Differential Revision: D27346262

fbshipit-source-id: 3b314716f48bb9a7fe709370303396a51893359c
2021-03-29 07:00:47 -07:00
Pascal Hartig
e4a814502a Mass bump deps
Summary:
Bumping everything that's just a patch version behind or safe-looking minor change.

Just hoping to get ahead of dependabot's next run.

Reviewed By: fabiomassimo

Differential Revision: D27367567

fbshipit-source-id: 1bf8bad02e5a9f07f5982466254f9906581230cf
2021-03-27 04:25:57 -07:00
Pascal Hartig
8c85da5bc8 Bump deps
Summary: Just trying to get ahead of dependabot and bump some easy dependencies all at once.

Reviewed By: fabiomassimo

Differential Revision: D27326687

fbshipit-source-id: 0c724c8e3a688aa9777945fcd46061284fd77969
2021-03-25 12:28:29 -07:00
Michel Weststrate
f095a00c78 Fix Flipper crashing when decoding partial encoded requests
Summary:
Changelog: Fixed an issue where Flipper would crash when decoding large partial requests.

The current processing of partial requests assumes that the proviced base64 string is always an utf-8 string, which is incorrect as it might contain binary data as well. This causes `atob` build in to throw errors when trying to decode binary base64 strings with the following exception:

{F538782963}

However, what is worse, if those strings were larger than ~2 mb, it would completely crash Electron rather than on the JS level, with reports like:

```

Crashed Thread:        0  CrRendererMain  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       EXC_I386_GPFLT
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [85268]

Thread 0 Crashed:: CrRendererMain  Dispatch queue: com.apple.main-thread
0   com.github.Electron.framework 	0x000000011155b16f v8::internal::SetupIsolateDelegate::SetupHeap(v8::internal::Heap*) + 22324575
1   com.github.Electron.framework 	0x000000011155e811 v8::internal::SetupIsolateDelegate::SetupHeap(v8::internal::Heap*) + 22338561
2   com.github.Electron.framework 	0x00000001117e2e62 v8::internal::SetupIsolateDelegate::SetupHeap(v8::internal::Heap*) + 24978002
3   com.github.Electron.framework 	0x000000010fa32660 v8::internal::ClassScope::ResolvePrivateNamesPartially() + 14944
4   com.github.Electron.framework 	0x000000010fa322b5 v8::internal::ClassScope::ResolvePrivateNamesPartially() + 14005
5   com.github.Electron.framework 	0x000000010fa31933 v8::internal::ClassScope::ResolvePrivateNamesPartially() + 11571
6   com.github.Electron.framework 	0x000000011007ef58 v8::internal::SetupIsolateDelegate::SetupHeap(v8::internal::Heap*) + 451400
```

Reproduced this JS issue by lowering the `MAX_BODY_SIZE_IN_BYTES` in `NetworkFlipperPlugin.java` to 10KB, which causes all requests to be processed as partials.

Reproducing the the Electron crash is a lot harder, as it requires a surface that makes large, binary requests (more than a few mb), that is still intercepted by the Network layer. The best example I could find is sending large pictures or videos through a messenger for android chat. In that case it is still hard to produce due to caching though.

Fun fact, you can crash your own flipper and get the above crash by running this command:
`btoa(require("fs").readFileSync("/Users/mweststrate/Desktop/Screen Recording 2021-03-24 at 16.08.27 crop.mov", "binary"))`, where the provided file must be a few mb's large (this one is 10).

A result of fixing this issue, is that images that were send as partials can now be correctly previewed in the Network plugin again.

Reviewed By: jknoxville

Differential Revision: D27302961

fbshipit-source-id: 1ac86840f7268062bb59c789f3904537df3c51fa
2021-03-25 05:03:07 -07:00
Michel Weststrate
8f90deda55 Minor UI improvements
Summary:
Addresses feedback from: https://github.com/facebook/flipper/issues/2076

- fix filtering non-string columns
- fix overflow in filter dropdown
- hide app column on all devices
- show pid column on android, to simplify filtering per app

Reviewed By: passy

Differential Revision: D27188458

fbshipit-source-id: b6180fb5a8d0a47e50dd5dc3533da3ff1b0a1a2e
2021-03-19 08:59:12 -07:00
Pascal Hartig
414dd4d5ff Demote errors in crash reporter
Summary:
Not fatal errors and actually very, very high-firing. Something about
the serialisation here is wrong so I can't tell the exactly number right now.

Reviewed By: priteshrnandgaonkar

Differential Revision: D27117067

fbshipit-source-id: d9ce8c736ca2228acedeadeb2e7ee6744d766265
2021-03-18 05:45:28 -07:00
Anton Nikolaev
f468f0e07d Produce tsc typings for "flipper" package
Summary: This diffs refactors tsc projects structure and structure of our custom typings to allow producing typescript typings for "flipper" package. In next diffs I'm going to use the produced typings to check compatibility of plugins with certain versions of Flipper, e.g. to check whether plugin is compatible with current "stable" and "insiders" version.

Reviewed By: passy

Differential Revision: D26997158

fbshipit-source-id: a0416c7139bf08ec9d175730da4c4c2a8768eeb7
2021-03-17 14:03:38 -07:00
Michel Weststrate
9d3c48fd84 Logs2 -> Logs
Summary:
Use Logs2 plugin now as the default logs plugin (by overwriting it).

See the rest of this stack

Changelog: The device logs plugin has been fully rewritten. It is faster and more reponsive, formats urls and json, and supports line wrapping and text selection. Beyond that it is now possible to sort and filter on all columns and pause and resume the log stream.

Reviewed By: nikoant

Differential Revision: D27048528

fbshipit-source-id: e18386fec6846ac3568f33a3578f4742213ecaca
2021-03-16 15:03:49 -07:00
Michel Weststrate
87c5fab607 Convert crash reporter plugin to Sandy (non UI only)
Summary:
This diff converts the CrashReporter plugin to Sandy. The main driver is that it allows us to fix the connection management of logs in a next diff.

There are few changes to highlight:
* A bunch of the old unit tests are removed, as they primarily verified that persistedState abstraction works, a concept that doesn't exist anymore with Sandy (as a result all the logic in error handling and crash reporter plugin has become a lot more trivial as well)
* Added additional unit tests to verify that the integration with notifications from Sandy, and the integration of crashes in combination with CrashReporter plugin works (this wasn't the case before)
* Plugin errors were always suppressed in production builds of Flipper. However, that makes error reporting pretty pointless in the first place, so enabled it by default, but made it a setting in case this results in too many errors suddenly.
* The integration with clicking OS crash notification -> bringing the user to a sensible place _doesn't_ work, but it didn't work before this diff either, so will address that later
* This doesn't upgrade the Crash reporter UI to sandy yet, will do that later in a separate diff

Changelog: Crash reporter will now report errors triggered from the device / client plugins by default. This can be disabled in settings.

Reviewed By: priteshrnandgaonkar

Differential Revision: D27044507

fbshipit-source-id: 8233798f5cce668d61460c948c24bdf92ed7c834
2021-03-16 15:03:48 -07:00
Anton Nikolaev
b2776f1c36 Fix for tests after call to "build-plugins"
Summary: After calling "bundle-all-plugins" locally, "yarn test" is failing with obscure message, because some tests are trying to import built bundles instead of "index.tsx". This diff fixes that.

Reviewed By: passy

Differential Revision: D26986246

fbshipit-source-id: cffe988dc642e2c5d2b2028581cd162350186e0c
2021-03-11 17:07:12 -08:00
bizzguy
f61b5a1a86 Network plugin - support mocks in imported devices (#2040)
Summary:
It is not currently possible to create mock routes from imported network logs.  This PR will provide that functionality.

See this issue for more details: https://github.com/facebook/flipper/issues/1988

## Changelog

Network plugin - create mocks from imported network logs

Pull Request resolved: https://github.com/facebook/flipper/pull/2040

Test Plan:
Use sample app to create network activity
Export network activity
Import network activity
Create mocks from imported network activity
Verify that mocks work using sample app

Reviewed By: mweststrate

Differential Revision: D26947187

Pulled By: passy

fbshipit-source-id: 5e4e0197c49bb7a8227a70e574613381815e6d30
2021-03-11 03:08:08 -08:00
Pritesh Nandgaonkar
50f31f9fe0 Update the device plugins supported devices arguments
Summary:
Device plugins won't work for DummyDevice type as the device id is a fake one for this.

This diff updates the "supportedDevices" for the plugins.

Reviewed By: mweststrate

Differential Revision: D26944601

fbshipit-source-id: a29acc288f8f0c564f52db02914e7b0491b211d2
2021-03-10 06:34:36 -08:00
bizzguy
d07b74eed0 Network Plugin - Disable routes (#1969)
Summary:
Mock routes may contain quite a bit of data for header values and response bodies.  Currently, to turn off a mock a user must delete the mock and then go through the process of creating it when needed again.  This change will allow a user to temporarily disable a mock without deleting it.

A checkbox on the Routes list is used to enable/disable mocks.  As shown in this screenshot:

![image](https://user-images.githubusercontent.com/337874/109360670-3a3fb280-784d-11eb-83fd-724f0bb067d3.png)

## Changelog

Network Plugin - disable/enable mock routes

Pull Request resolved: https://github.com/facebook/flipper/pull/1969

Test Plan:
Create mocks using sample app
Verify that mocks are working as expected
Disable the mocks
Verify that the client has been updated with mocks (minus the disabled ones) user Flipper Messages plugin
Use the sample app to send the disabled requests again and verify that they are not mocked

Reviewed By: mweststrate

Differential Revision: D26888815

Pulled By: passy

fbshipit-source-id: cb8a05a27dd69ba4d2b60085a077efe795a99a7c
2021-03-08 11:52:36 -08:00
Anton Nikolaev
095667b742 Fix "failed to find appMatchPatterns" error
Summary: Fixed an error which happens on second and subsequent device connection to Flipper

Reviewed By: passy

Differential Revision: D26829255

fbshipit-source-id: 17eb603647626a2168e330ec67f4a89783219356
2021-03-05 03:50:24 -08:00
Michel Weststrate
afa2c6322a make lint error on missing keys
Summary: When exploratory testing Flipper, I generally see quite some React key warnings. So it seems that plugin devs often miss them. This diff will configure linting more aggressively to address that (it's not fool proof, but will find the most common cases).

Reviewed By: nikoant

Differential Revision: D26722707

fbshipit-source-id: e0d2b56de2422e1147f52c8e9150d00c7ee64bd2
2021-03-02 01:17:13 -08:00
Harold Martin
4d8be35d1a Add plugin for LeakCanary 2 (#1959)
Summary:
Add plugin for LeakCanary 2 as requested various times: https://github.com/facebook/flipper/issues/1379 https://github.com/facebook/flipper/issues/832  https://github.com/square/leakcanary/issues/1777

## Changelog

* Adds a leakcanary2 plugin for Android
* Adds support for leakcanary2 to existing desktop plugin

Pull Request resolved: https://github.com/facebook/flipper/pull/1959

Test Plan:
* Docs updated to show new implementation
* Should old leakcanary plugin in sample be replaced?

Reviewed By: mweststrate

Differential Revision: D26691637

Pulled By: passy

fbshipit-source-id: 5e236fa6cc124f0720a6b21b5ee7c117ccf96fbf
2021-03-01 09:11:37 -08:00
bizzguy
4da2b52803 Network Plugin - Add remaining HTTP method types to mock routes (#1962)
Summary:
Currently, mock routes can only be created for GET and POST HTTP method types.  Mocks should support all the valid HTTP method types.

See specification for a list of valid types:

    https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html

This was requested in issue: https://github.com/facebook/flipper/issues/1960

Here is a screen shot showing the new values added to the select list:

![image](https://user-images.githubusercontent.com/337874/108955120-418b7400-7633-11eb-9248-63d9639e0c4f.png)

## Changelog

Network Plugin - support all valid HTTP method types in mock routes

Pull Request resolved: https://github.com/facebook/flipper/pull/1962

Test Plan:
Define mock routes using additional method types
Using "Flipper Messages" plugin, verify that new types have been sent to device

Reviewed By: passy

Differential Revision: D26635050

Pulled By: mweststrate

fbshipit-source-id: 6d85ac346bd18687516a3566d1048982ec7cae46
2021-02-26 07:23:12 -08:00
bizzguy
29d16feed5 Network Plugin - fix highlighting issues in routes list (#1917)
Summary:
Fix problems with row highlighting on mocks route list.  When selecting a row, the highlight would sometimes be on the wrong row.  Also, when adding routes, the routes would sometimes get added in the middle of the list instead of at the end.

These problems were caused by incorrectly referencing route rows in code.  Sometimes index was used and other times the key was used.  Fixed by consistently using key.

This fixes the problem described in issue https://github.com/facebook/flipper/issues/1733

## Changelog

Network Plugin - fix problems with row highlighting on mocks route list

Pull Request resolved: https://github.com/facebook/flipper/pull/1917

Test Plan:
Start with no mocks | No rows should be shown | TRUE
Add a single mock | First (and only row should be highlighted) | TRUE
Delete mock | No rows should be shown | TRUE
Add single mockAdd another mock | 2nd row should be highlighted | TRUE
Add another mock | 3rd row should be highlighted | TRUE
Add 2 more mocks and assign number to each row (5 total) | Last row should be highlighted | TRUE
Select 1st row | 1st row should be highlighted | TRUE
Delete 1st row | 1st row should be highlighed | TRUE
Select last row | last row should be highlighted | TRUE
Delete last row | last row should be deleted and new last row should be highlighted | TRUE
Highlight a middle row (row 3) | middle row should be highlighted | TRUE
Delete middle row | middle row should be deleted and last row should be in its place and should be highlighted | TRUE

Reviewed By: passy

Differential Revision: D26604455

Pulled By: mweststrate

fbshipit-source-id: f29690244e32b364983089541718f4bc75154dd1
2021-02-26 07:19:00 -08:00
dependabot[bot]
473e0b5745 Bump dateformat from 3.0.3 to 4.5.1 in /desktop (#1957)
Summary:
Bumps [dateformat](https://github.com/felixge/node-dateformat) from 3.0.3 to 4.5.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/felixge/node-dateformat/releases">dateformat's releases</a>.</em></p>
<blockquote>
<h2>4.5.1</h2>
<ul>
<li>Fixed an issue with the <code>WW</code> mask not working</li>
</ul>
<h2>4.5.0</h2>
<ul>
<li>Added <code>WW</code> mask for week with padding (<a href="https://github-redirect.dependabot.com/felixge/node-dateformat/pull/156">details</a>)</li>
</ul>
<h2>4.4.2</h2>
<ul>
<li>Fixed an issue with <code>DDD</code> and <code>DDDD</code> masks sometimes not working (<a href="https://github-redirect.dependabot.com/felixge/node-dateformat/pull/158">details</a>)</li>
</ul>
<h2>4.4.1</h2>
<ul>
<li>Update <code>DDD</code> mask to use <code>Ysd</code>, <code>Tdy</code> and <code>Tmw</code> (<a href="https://github-redirect.dependabot.com/felixge/node-dateformat/pull/155">details</a>)</li>
</ul>
<h2>4.4.0</h2>
<ul>
<li>Added <code>DDD</code> and <code>DDDD</code> Mask for <code>Today</code>, <code>Tomorrow</code> and <code>Yesterday</code> (<a href="https://github-redirect.dependabot.com/felixge/node-dateformat/pull/71">details</a>)</li>
</ul>
<h2>4.3.1</h2>
<ul>
<li>Added <code>p</code> Mask for Timezone Offset e.g. <code>+02:00</code> (<a href="https://github-redirect.dependabot.com/felixge/node-dateformat/pull/149">details</a>)</li>
</ul>
<h2>4.2.2</h2>
<ul>
<li>Fix Rounding Issue with L Mask (<a href="https://github-redirect.dependabot.com/felixge/node-dateformat/pull/147">details</a>)</li>
</ul>
<h2>4.2.1</h2>
<ul>
<li>Reduce size of package (<a href="https://github-redirect.dependabot.com/felixge/node-dateformat/pull/142">details</a>)</li>
</ul>
<h2>4.2.0</h2>
<ul>
<li>Fixed Invalid '1970-01-01' Formatting (<a href="https://github-redirect.dependabot.com/felixge/node-dateformat/pull/143">details</a>)</li>
</ul>
<h2>4.1.0</h2>
<ul>
<li>Added Padding Short Date Mask</li>
</ul>
<h2>4.0.2</h2>
<ul>
<li>Fixed an issue with old years not having padding. e.g. 0009 was formatting as 9.</li>
</ul>
<h2>Performance Improvements</h2>
<p>This release brings significant performance improvements to dateformat.<br />
Some common operations are now 6 times faster than before!!!</p>
<p>There are no breaking changes in this release.</p>
<p><img src="https://user-images.githubusercontent.com/53957795/100558584-e0921f80-3313-11eb-984a-ac2995bc01ee.png" alt="image" /></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a href="https://github.com/felixge/node-dateformat/commits/v4.5.1">compare view</a></li>
</ul>
</details>
<details>
<summary>Maintainer changes</summary>
<p>This version was pushed to npm by <a href="https://www.npmjs.com/~chase-manning">chase-manning</a>, a new releaser for dateformat since your current version.</p>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=dateformat&package-manager=npm_and_yarn&previous-version=3.0.3&new-version=4.5.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

 ---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `dependabot rebase` will rebase this PR
- `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `dependabot merge` will merge this PR after your CI passes on it
- `dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `dependabot cancel merge` will cancel a previously requested merge and block automerging
- `dependabot reopen` will reopen this PR if it is closed
- `dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>

Pull Request resolved: https://github.com/facebook/flipper/pull/1957

Reviewed By: mweststrate

Differential Revision: D26605958

Pulled By: passy

fbshipit-source-id: a794b90b7b183177264ed8d42c47ebff8b98e330
2021-02-24 11:31:05 -08:00
Anton Nikolaev
ded38d7869 Fix expanding of selected item
Summary: Changelog: Layout plugin: fixed automatic expanding of layout tree when a deep element selected in the target mode.

Reviewed By: passy

Differential Revision: D26577751

fbshipit-source-id: 9f4a074d114892d6903a58e1ed44cf580cf1d432
2021-02-22 04:10:00 -08:00
Michel Weststrate
d37f1c282a Fixed issue with reseting logs
Summary:
Noticed that subsequent `adb logcat` invocations are stateful, and we didn't clear it's state when clearing the logs in memory.

This is a bandaid to get back to the previous behavior. I am wondering whether it wouldn't be just much more intuitive to always clear the logs (`adb logcat -c`) before we start the streaming log listener, so that users are never shown old logs from before flipper was connected?

Also fixed a leak in cleaning up the log listeners that was revealed by the possibility to disable the log plugin

Reviewed By: nikoant

Differential Revision: D26450262

fbshipit-source-id: 5b426e2d0e1fafdbc512d48d22b7bd4f30b61309
2021-02-17 08:19:28 -08:00
dependabot[bot]
ac263e6bee Bump js-base64 from 3.5.2 to 3.6.0 in /desktop (#1935)
Summary:
Bumps [js-base64](https://github.com/dankogai/js-base64) from 3.5.2 to 3.6.0.
<details>
<summary>Commits</summary>
<ul>
<li><a href="ad8897c84b"><code>ad8897c</code></a> version 3.6.0</li>
<li><a href="78016271df"><code>7801627</code></a> add isValid()</li>
<li>See full diff in <a href="https://github.com/dankogai/js-base64/compare/3.5.2...3.6.0">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=js-base64&package-manager=npm_and_yarn&previous-version=3.5.2&new-version=3.6.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

 ---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `dependabot rebase` will rebase this PR
- `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `dependabot merge` will merge this PR after your CI passes on it
- `dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `dependabot cancel merge` will cancel a previously requested merge and block automerging
- `dependabot reopen` will reopen this PR if it is closed
- `dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>

Pull Request resolved: https://github.com/facebook/flipper/pull/1935

Reviewed By: mweststrate

Differential Revision: D26463175

Pulled By: passy

fbshipit-source-id: 06b223e8d89c75f5bda1e67b4e41403f7663ec7e
2021-02-17 05:14:13 -08:00
Anton Nikolaev
b6372ad006 Fix appMatchPatterns error
Summary: Fixed error thrown by navigation plugin in Flipper release builds (T84083443)

Reviewed By: passy

Differential Revision: D26402201

fbshipit-source-id: 7433457e3074c26ad17ac5158522d287232e2ede
2021-02-12 09:22:21 -08:00
bizzguy
1b76c3d8e7 Changes to local storage for mocks and body format (#1871)
Summary:
Network calls are normally unique to an application as are the associated mocks.  Currently, the mocks for different applications are combined together and saved to the local store.  It would be better if mocks were saved (and retrieved by application).

This PR adds "appId" to the local store name to save mocks separately for each app.  This is not really the ideal technique since different apps could have the same name.  Android apps use packageId rather than app name (which is what appid is) to uniquely identify an app.  However, package id does not seem to be available to the Flipper client so appid is used instead.

This requirement is described in this issue: https://github.com/facebook/flipper/issues/1487

Also, individual developers often have a preference for how they like to view response data (parsed or formatted).  This PR saved the selected format so that the developer does not have to keep selecting it.  Since this preference is not specific to an app, it is not necessary to save the preference for each app.

## Changelog

Network plugin - save mocks by app
Network plugin - save response body format preference to local storage

Pull Request resolved: https://github.com/facebook/flipper/pull/1871

Test Plan:
Install two apps (with different names)
Create mocks in each app
Restart Flipper
View the mocks for each app and verify that they are unique to the app

Reviewed By: mweststrate

Differential Revision: D26341333

Pulled By: passy

fbshipit-source-id: cc0286a9dc4e37e008672bfad7c6180f0d5675e4
2021-02-10 05:11:17 -08:00
Michel Weststrate
bf7599e574 Bumped some deps to fix parsing of template literal types
Summary:
I want to use TypesScipt type literals in a next diff (e.g.

```
type Percentage = `${number}%`
```

But to be able to use that typescript, prettier and eslint needed bumps :)

Reviewed By: nikoant

Differential Revision: D26321133

fbshipit-source-id: a4891246ef8c654f324c6daf303c5c4b2f54496e
2021-02-10 02:52:22 -08:00
Michel Weststrate
60cfcb54a1 Wrap plugin calls into isConnected guards
Summary:
Previously, plugins could relatively safely use `client.call` at any moment in time to fetch some information from / to the client. Except for some raise conditions there was generally speaking a connection available.

With this stack it becomes possible to interact with plugins even after an app (unexpectedly) disconnected, which makes Flipper a lot more versatile, especially when it comes to inspect crashes post mortem. (For more explanation see the second diff in this stack)

However, this means that it is no longer safe to assume there is always a connection available. For that reason `client.isConnected` has been introduced to safeguard against that.

This diff introduces guards on all user interactions that are not super explicitly triggered by the user to avoid a lot of errors being generated. This is mostly in `init()` blocks and implicit user events like selecting or hovering rows.

Explicit user interactions like pressing buttons are not guarded by this diff, as ideally failure to communicate with the client should be communicated back to the user more explicitly rather than failing silently. The next diff will introduce a fallback mechanism where a popup is shown in case those calls aren't guarded.

Fixed a few key warnings while at it.

Reviewed By: nikoant

Differential Revision: D26275604

fbshipit-source-id: 5630066cdd9541e448a6dd1f8a21861b5d751ced
2021-02-09 04:16:26 -08:00