Commit Graph

29 Commits

Author SHA1 Message Date
John Knox
062cbc0dbd Fix contextClick after multi-highlight
Summary:
Select multiple rows, and then right click, or use Ctrl-click.
This was broken, it was resetting the selection when this happened.
This fixes it.

Now after selecting multiple, what happens depends where you right-click.

If you right-click within the current selection, it stays selected and you can copy it.
But if you right-click outside the current selection, that row becomes the new selected set, and you will just be able to copy that one. This feels right to me.

Reviewed By: passy

Differential Revision: D15822668

fbshipit-source-id: 6a6cda8a8f16fec55cffa52c1c2ff958c86b3f43
2019-06-14 09:13:52 -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
John Knox
79902cd7cb Fix some react warnings
Summary: React is printing errors saying not to use "Span", and booleans in html properties

Reviewed By: danielbuechele

Differential Revision: D15535593

fbshipit-source-id: e074137c89abfa69625b370087c9c18b579ff279
2019-05-30 03:15:28 -07:00
Daniel Büchele
8c4e373dfc fix table context menu/drag-select
Summary:
As seen [here](https://fb.workplace.com/groups/230455004101832/permalink/623364598144202/?comment_id=623436418137020&comment_tracking=%7B%22tn%22%3A%22R%22%7D) using the primary key + CTRL to open the context menu, triggers the drag-select mode. This should not be the case. This diff changes the behaviour to:

- Not trigger the drag-select-mode, when openting the context menu using CTRL
- Select the current row, when performing a context click on it.

Reviewed By: jknoxville

Differential Revision: D15538057

fbshipit-source-id: d3d086c3d44618b2801e3a9b0646689c04fa32ff
2019-05-30 02:35:18 -07:00
John Knox
592bd2671f Fix copy cell wrong cell bug
Summary:
It was relying on hash keys to be in order, which obviously won't work. Logs plugin, on "copy message" was copying a timestamp instead.
Fixed by using the columnOrder state instead.

Reviewed By: danielbuechele

Differential Revision: D15535281

fbshipit-source-id: 2d7db95c16cc4f75c0d9cf14806fcc80cc8e4bd9
2019-05-29 08:43:40 -07:00
John Knox
a630b50a8f Add databases plugin v0 (android) (#441)
Summary:
Adds a plugin for listing the databases, tables and contents of those tables in an android app.
Right now, works with sqlite, but it should be generic enough to work with other db types.

## Changelog

Add initial version of android databases plugin

Creating a PR, I may need to do some cleaning up, but this is to kick off that process.
Pull Request resolved: https://github.com/facebook/flipper/pull/441

Reviewed By: danielbuechele

Differential Revision: D15288831

Pulled By: jknoxville

fbshipit-source-id: 6379ad60d640ea6b0a9473acc03dd6ea81a3a8d4
2019-05-28 10:17:56 -07:00
John Knox
d85a357428 Fix columnSize prop
Summary: I added column size persistence when resizing manually, but broke initial column sizing when a prop is provided. This fixes it.

Reviewed By: passy

Differential Revision: D15392145

fbshipit-source-id: 53f79c520917cd571302502c8b75aa0475567cb9
2019-05-17 06:30:28 -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
John Knox
98d3dd4ebd Add initialSortOrder prop
Summary: Allows for sort order to be preserved and applied from the start.

Reviewed By: danielbuechele

Differential Revision: D15182696

fbshipit-source-id: ad546ce35bf4637ca637589c6c3d6291a4313db7
2019-05-03 11:13:11 -07:00
John Knox
70edb08999 Remember resized column sizes
Summary:
Adds a global inside managed table where, whenever a table key is provided, the column sizes are stored.
Then if a new table is constructed with the same key, it will get the sizes from before.

Reviewed By: danielbuechele

Differential Revision: D15181762

fbshipit-source-id: 98b5a14f8805075928cbe51511609b8b58c512fd
2019-05-03 11:07:31 -07:00
Daniel Büchele
fca7bc93ee horizontal scrolling
Summary:
Adding a property `horizontallyScrollable` the `ManagedTable` that enables horizontal scrolling, if that is required by the table's contents.
By default this behaviour is disabled to not break existing tables.

Reviewed By: jknoxville

Differential Revision: D15166144

fbshipit-source-id: 7a9b76facdbe717deb3d097e0b8883d4b0732d51
2019-05-01 09:32:32 -07:00
Daniel Büchele
99ea11b8e6 createPaste
Reviewed By: jknoxville

Differential Revision: D14224400

fbshipit-source-id: 9a9a8578de00d276d65a7928964eae619f5bc41f
2019-02-28 07:28:25 -08:00
Artur Pyrogovskyi
0a59dc2918 Added onSort and a fix for columnOrder to ManagedTable
Summary:
1. Added onSort() pass-through to ManagedTable which allows to handle sort order changes.

2. columnOrder now gets updated when the corresponding prop is changed indepedently from ref.

Reviewed By: danielbuechele

Differential Revision: D14147857

fbshipit-source-id: 03300629a3316a69be6b745810516966b8060aa6
2019-02-21 02:02:09 -08:00
Pritesh Nandgaonkar
5ad41b48ff Solves the bug which destroyed multi selection on ctrl+click
Summary: Soves the bug which caused the multiselection to clear off when one did ctrl+click

Reviewed By: jknoxville

Differential Revision: D14103906

fbshipit-source-id: 834d79e1c86a89b4d90c26e8db1850c1e8712a5d
2019-02-18 14:44: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
Paulo Pinheiro
a033f583d1 Enable override of context menu on ManagedTable. (#352)
Summary:
This patch add a new prop on ManageTabled called buildContextMenuItems. It allows
to override the current context menu when right click on the ManagedTable rows.
Pull Request resolved: https://github.com/facebook/flipper/pull/352

Reviewed By: danielbuechele

Differential Revision: D13590258

Pulled By: passy

fbshipit-source-id: a90887a97136818611102a2628361c84988efeac
2019-01-09 03:52:56 -08:00
Daniel Büchele
29f6e2ed4f hideHeader
Summary: The `hideHeader` didn't hide the header. Fixed it!

Reviewed By: priteshrnandgaonkar

Differential Revision: D13377067

fbshipit-source-id: 105541169d46b6db1a85e99c8d93ee52f904d261
2018-12-14 10:35:12 -08:00
Daniel Büchele
b0cacc1272 scrollToHighlightedRows
Summary:
Moving the scrolling to highlightedRows from `componentWillReceiveProps` to `componentDidUpdate` to make sure the rows are rendered, when this method is called.

The method is called, whenever the highlighted rows change, and on the first update. The reason why this is called on the first update is described in an inline comment.

Reviewed By: passy

Differential Revision: D13376566

fbshipit-source-id: 311a1f430e08fcfb4e31b39a2c5b34910694917f
2018-12-11 07:57:59 -08:00
Pritesh Nandgaonkar
06588b3d1f Adds crashreporter plugin to fb4a
Summary: Adds crashreporter plugin to fb4a

Reviewed By: jknoxville

Differential Revision: D13278471

fbshipit-source-id: 1baa7520b2806bebdc960077bfda0699b290109b
2018-12-03 05:27:28 -08:00
Daniel Büchele
26dd94f072 selecting rows from outside
Summary: Allows to set the selected rows of a table using the `highlightedRows` property.

Reviewed By: passy

Differential Revision: D9850597

fbshipit-source-id: 62239192113f43ac257d7328b21b386b584a7cfb
2018-09-21 10:52:00 -07:00
Daniel Büchele
d14def44f1 fix table arrow navigation
Summary: Check for `highlightableRows` was wrong.

Reviewed By: passy

Differential Revision: D9602101

fbshipit-source-id: dbab5efb0c2d71c1a2a018bf035f39d2539f5595
2018-08-31 03:12:22 -07:00
Daniel Büchele
73e5824e35 ManagedTable debouncing
Summary:
Removes the fix introduced in D9570518 and upgrading to `react-window@1.1.2` which fixes the problem in the library.

Also finetuning debounce times.

Reviewed By: passy

Differential Revision: D9582591

fbshipit-source-id: 92b008d29f96ce0f11f5cfb5d9e92175ae536ee2
2018-08-30 11:30:36 -07:00
Daniel Büchele
63c8bd4368 fix for missing rows in ManagedTable
Summary:
When starting with an empty table and adding rows, the scrollOffset of the table might end up with a negative value, which causes rows not to be rendered.

See https://github.com/bvaughn/react-window/issues/49 for more details.

This only calls `scrollToItem` when the table is actually scrollable to prevent a negative scrollOffset.

Reviewed By: passy

Differential Revision: D9570518

fbshipit-source-id: 5b08990a353a6d41d0f1bc5c1481d5a5e471bd94
2018-08-30 08:13:07 -07:00
Daniel Büchele
2c905646ec fixing table default props
Summary:
Table was missing support for some properties, that were supported previously, which caused some regressions. Support for the following properties was added:
- `multiHighlight: boolean = false`
- `autoHeight: boolean = false`
- `highlightableRows: boolean = true`
- `onRowHighlighted: Function`

Reviewed By: jknoxville

Differential Revision: D9549384

fbshipit-source-id: 1db2e7e8c6ad483d3d9d3a5814c76c564e9ba7f4
2018-08-29 04:27:25 -07:00
Daniel Büchele
2596e7d42a recalculate row heights on change
Summary: When table rows are chaning, we need to recaluculate all row heights. This was already done when filtering/searching, but there are other occurrences where we need to recalculate the heights (like clearing the table).

Reviewed By: passy

Differential Revision: D9540881

fbshipit-source-id: ef6e94c0330294d8196f946799a436aa5e9ce5c5
2018-08-28 10:29:26 -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
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