Commit Graph

29 Commits

Author SHA1 Message Date
Andrey Goncharov
97b8b8a1c4 Split flipper-plugin package
Summary:
flipper-server-companion depends on flipper-plugin. flipper-plugin includes dependencies that run only in a browser. Splitting flipper-plugin into core and browser packages helps to avoid including browser-only dependencies into flipper-server bundle.
As a result, bundle size could be cut in half. Subsequently, RSS usage drops as there is twice as less code to process for V8.

Note: it currently breaks external flipper-data-source package. It will be restored in subsequent diffs

Reviewed By: lblasa

Differential Revision: D38658285

fbshipit-source-id: 751b11fa9f3a2d938ce166687b8310ba8b059dee
2022-09-15 10:02:19 -07:00
Feiyu Wong
499275af8a Add keyboard shortcut to support quick selecting recent searches
Summary:
Currently there's no way of quickly selecting recent searches other than manually opening the recent search history and then clicking one of the search terms. This diff seeks to add a new feature that would allow not only a keyboard short cut to open the recent search history drop down but also number the most recent 5 search terms so that the user could quickly select them with a number on their keyboard

Additionally, fixed bug found in terms of the search bar not showing the current search value correctly

`Changelog`: Introduced keyboard shortcut(ctrl + f) option to toggle the search history dropdown along with numbers attached to the options in order to quickly navigate to recent search terms. Have to first enable the option(search shortcut) in menu in order to use the feature. Also added a new button in the options menu that would trigger the search result toggle as triggered by the keyboard shortcut `ctrl` before(`ctrl` + `t` now)

WARNING: The current behavior of "ctrl" toggling back and forth to focus the selected item has been migrated to "ctrl + t" key combo

Reviewed By: mweststrate

Differential Revision: D37685738

fbshipit-source-id: a7ac4dd3dceb846a98258de2d884ebc279ee5995
2022-07-27 11:37:59 -07:00
Feiyu Wong
3fbf1215ec Refactored DataView to be the primary data driver for DataTable instead
Summary:
In order to accomplish multi-panel mode, we need to use multiple data views on the same data source so that the filters can be applied differently, etc.

This diff serves to refactor DataTable and some of its associated classes to use DataView as the primary driver for data management. Additionally, the diff refactored the state to allow multi-paneling to be on the DataPanel layer instead of the DataTable layer for ease of usage

This is the last diff of the larger stack which introduces the multi-panel mode feature. A possible next step could be allowing infinite(up to a certain limit) panels to be populated.

Changelog: Introduced side by side view feature for `DataTable`. There is now a new boolean for `DataTable` props called `enableMultiPanels`. If this is passed in, then the table will have an option to open a different "side panel" using a completely different dataview which allows different filters, searches, etc.

Reviewed By: mweststrate

Differential Revision: D37685390

fbshipit-source-id: 51e35f59da1ceba07ba8d379066970b57ab1734e
2022-07-22 09:16:37 -07:00
Feiyu Wong
53b89f485a Add Toggle to control showing full search history instead of filtered list
Summary:
This diff adds a new menu option to the Logs plugin which allows for enabling/disabling the automatic filtering of search terms in the search history as user types.

Additionally, fixed bug regarding the search term that's used is not actually showing correctly. This is caused by the search value being set in the input search bar instead of the autoComplete component level

Differential Revision: D37555209

fbshipit-source-id: 8a76299f7e1a4b0a3adfa6a4dd883d17f1e7a442
2022-07-14 06:21:45 -07:00
Michel Weststrate
d162bcc2a4 Fix sorting order of selection during exports
Summary:
See https://fb.workplace.com/100051336486185/videos/469885544533059/

I couldn't reproduce it myself, but it is reported that when copying logs, the order of the selection is not preserve. Diving into the example there is a block of rows (around the 1.09 timestamp) that appear 'too early' in the output.

In flipper we sort the selection before copying the data by row index. This is to make sure if the user has multiple selections, they appear in the order of the logs (including any applied sorting), rather than in the order of which the user selected them.

However, when sorting numbers, JavaScript by coerces them to strings first (wtf JS), so the issue can be prevented by explicitly providing a sort function. Proof: {F749329864}

Reviewed By: lblasa

Differential Revision: D37596975

fbshipit-source-id: 820e03350034e7af8148200a58a8c858b358acd8
2022-07-04 04:13:04 -07:00
Luke De Feo
1353e0630b Fix free text search
Summary:
In diff D36663929 (e07d5c5bfe) the behaviour of data table was changed so that it only searched fields that were columns in the table. Due to user request we are restoring the functionality where you can search and it will look in all top level fields in the underlying object for the row

changelog: Fixed 'free text search' for data table. E.g network plugin

Reviewed By: mweststrate

Differential Revision: D37552492

fbshipit-source-id: 00ec942b2a2336c19a7d067d85cc6c81b8a175e1
2022-07-04 00:49:36 -07:00
Feiyu Wong
f46cf2b0ce Added color options for highlighting search terms
Summary:
This diff builds on the previous ones by enabling other colors to be used as highlights for the search terms. Current color options are: yellow(default), red, blue, green. Possible extensions to this feature could include allow the user to enter a custom hex-color string and use that as the highlight color.

Changelog: DataTable will now have option to have its search terms highlighted in the search results by toggling and customizing the highlight colors in the menu bar

Reviewed By: mweststrate

Differential Revision: D37383163

fbshipit-source-id: c81e383c0570ef5efbf3171b92b81a8fb2e55ea7
2022-06-29 10:36:52 -07:00
Feiyu Wong
24a314054e Added highlight search setting and toggle in menu to trigger
Summary:
Created search highlight settings to be stored as part of persisted state. Added toggle/menu option in the dropdown.

This diff serves as the start of the stack that introduces highlighting the search terms in the search results of flipper. Currently, the results returned do not show why(the key word) they are appearing.

The next diffs will introduce not only the actual highlighting but also "custom"-ish color-picking for the highlights. The colors will be chosen from the sub-menu where the highlighting is enabled.

Reviewed By: mweststrate

Differential Revision: D37229735

fbshipit-source-id: d681f8e7b7fdfce8135c2c3fa81d8450447565c1
2022-06-29 10:36:52 -07:00
Luke De Feo
48bebdc665 Improve typing of getValueAtPath
Summary: Context: https://www.internalfb.com/diff/D36663929 (e07d5c5bfe)?dst_version_fbid=701770760940095&transaction_fbid=714786499947486

Reviewed By: antonk52

Differential Revision: D36782095

fbshipit-source-id: 2eb29d70aa641d386b129bf957320b718e97c298
2022-06-07 04:29:16 -07:00
Michel Weststrate
f2bf48d4e4 DataTable delighter: Introduce search history
Summary:
Getting the behavior exactly right was tricky, now settled on the following:

* Don't automatically show the search history (the default) but introduce an explicit button to toggle it, as opening it by default was pretty obtrusive in testing
* Items are added to the history when using return / explicitly clicking search, to only get "clean" entries into the history, and not half complete searches. Needing to press enter might be to subtle since datatable will also search without that, but not searching on keypress felt as a regression as well.
* Introduced a menu item for clearing the search history
* Search history is persisted like search filters.

Yay to Antd's AutoComplete, which is really straightforward and cleanly composes with Input.Search.

Changelog: DataTable will now keep a history of search items when hitting <return> to search. Use the history button to bring up the history.

Reviewed By: aigoncharov

Differential Revision: D36736821

fbshipit-source-id: 8d18b85308a39bd1644057371040855d199545c7
2022-06-07 04:04:01 -07:00
Michel Weststrate
36b78131b7 update control filter toggling implementation
Summary:
The `Control` button press, that hides the current search filter, had some specific logic to make sure that the current selection remained visible. Since this is now generically supported, this is no longer needed.

Also updated the `Control` button behavior to also toggle back the search filter if needed, which was never finished in the original implementation.

Changelog: DataTable: pressing the control key can be used to temporarily turn the current search filter on and off.

Reviewed By: aigoncharov

Differential Revision: D36736494

fbshipit-source-id: 2c4949efa0d6935735f61ee43f9268b7e27d1fcf
2022-06-07 04:04:01 -07:00
Michel Weststrate
2037cf0595 preserve selection during filter changes
Summary:
During filter changes, DataTable would loose any selections made, which was posted multiple times as papercut

I didn't implement preserving multi line selections. That should be straightforward, but wasn't sure that'd be desirable or not.

Changelog: DataTable: Data tables will now preserve the current selection and scroll it into view when changing the search filter.

Reviewed By: aigoncharov

Differential Revision: D36736496

fbshipit-source-id: 401ef351c847f58a5d411cf9f352390f6a110b24
2022-06-07 04:04:01 -07:00
Luke De Feo
e07d5c5bfe Added support for dotted key paths in Data table column
Summary:
This adds support for the key of DataTableColumn to be a dotted path into a nested object, e.g foo.bar. Currently the typescript types only allow a top level key to be set, making this feature currently unusuable from plugin code.

While this could be addressed in a future commit the intention of this is to allow the user to add custom fields into their table columns at run time

Note there is a side effect to free text search from this commit. Previously it would search all top keys in the object. Now it will only search in columns that are in the table.

changelog: Searching data table will now only search columns in the table, rather than all top level attributes of the object

Reviewed By: mweststrate

Differential Revision: D36663929

fbshipit-source-id: 3688e9f26aa7e1828f8e9ee69f8e6f86268c8a54
2022-05-30 04:37:25 -07:00
Anton Nikolaev
8d07b7b644 Quick action for resetting all datatable filters
Summary:
As we persist column filters between sessions - sometimes it's not obvious that they are applied.

This diff adds "Reset filters" action just near message "No records match the current search / filter criteria" to make it obvious that some records are hidden because of filters and let user quickly disable filters to see all items.

The same action also added to datatable's context menu.

Changelog:
Quick action "Reset filters" for datatable-based plugins which is shown in context menu and in empty table when all items filtered out.

Reviewed By: timur-valiev

Differential Revision: D36600535

fbshipit-source-id: 782e7f863f2f52d7f6017685bdebcb1feeb97dbd
2022-05-24 04:51:19 -07:00
Andrey Goncharov
88b72043b4 Persist "inversed" table filter
Summary: Persist "inversed" filtering between sessions

Reviewed By: antonk52

Differential Revision: D35113051

fbshipit-source-id: 466d94c7041e44398b5bd89ed9560c7d026ab2fd
2022-03-24 07:58:27 -07:00
Jong Hyun Park
035ba5613c Add neighbouring lines feature to Flipper Logs plugin
Summary:
Adding a feature to Flipper's Logs plugin where:
1) you search for something,
2) click on a line among the filtered search results,
3) press control,
4) get taken back to unfiltered list of all messages, centered on your selected line

This is to help debugging where the user may add a print statement but the error happens after it, and it's difficult to catch without a lot of scrolling.

Reviewed By: mweststrate

Differential Revision: D33446285

fbshipit-source-id: 19aa472a12de074e561dbe37b44821fc29bf5c91
2022-02-25 10:07:42 -08:00
Michel Weststrate
25e585b819 fix data tables not remembering their defaults
Summary:
Changelog: Data tables will now remember their configuration by default and share it across different applications

As reported, column configurations were often not remembered across restarts. This was caused by two things
1. persisting config was by default turned off
2. the persistence key was based on pluginKey, that includes device and client identification, rather than purely the plugin name.

Reviewed By: cekkaewnumchai

Differential Revision: D33364780

fbshipit-source-id: 6c38182dc35e3cce23b858f931d554111b080c97
2022-01-04 04:08:23 -08:00
Andres Suarez
79023ee190 Update copyright headers from Facebook to Meta
Reviewed By: bhamodi

Differential Revision: D33331422

fbshipit-source-id: 016e8dcc0c0c7f1fc353a348b54fda0d5e2ddc01
2021-12-27 14:31:45 -08:00
Anton Kastritskiy
4a4cc21d89 Refine DataSource id to use actual key type instead of a wide string type
Summary: Current implementation uses type `string` as a key for indexing items stored in datasource. However, users can provide any key as an index which means that the type of index item can be anything, not only string. This diff introduces a more refined types for the key. It adds another requirement to provide a key property to a generic which is used to infer the index type.

Reviewed By: mweststrate, aigoncharov

Differential Revision: D31895751

fbshipit-source-id: 19ba907bd6f35df87e3fa442db5fc5cec6af174d
2021-10-28 10:44:01 -07:00
Michel Weststrate
6c7b69803f Add support for negative filters
Summary:
Changelog: Add support for negative filters in data tables

As requested per somewhere on workplace but couldn't find it back :)

Reviewed By: nikoant

Differential Revision: D29486096

fbshipit-source-id: 467c8598f6d09afc9a5ed85affb6c51840afe00c
2021-06-30 10:42:32 -07:00
Michel Weststrate
0aadb862ee Use DataList
Summary:
With new abstraction, `DataList` matches what the plugin trying to render.

Should fix:
https://fb.workplace.com/groups/flippersupport/permalink/1145431339270856/

Changelog: [MobileConfig] Fix issues with scrolling not working and several other improvements

Reviewed By: cekkaewnumchai

Differential Revision: D28314408

fbshipit-source-id: 4d8fbe3d8e868f737750203cd568d94bae8b4108
2021-06-16 07:14:54 -07:00
Michel Weststrate
23c0781127 Minor keyboard navigation around fix
Summary: Fixed minor keyboard navigation annoyance: pressing arrow down on the last entry would remove selection, then jump to first row. Pressing up on first row would deselect then select first again. After this change the first/last item is kept selected in those cases

Reviewed By: passy

Differential Revision: D28958705

fbshipit-source-id: 01dbce3971ed965eae3b74e6706fef96aa86df66
2021-06-08 06:44:51 -07:00
Michel Weststrate
bc647972e1 Type improvements
Summary: some type simplifications, that makes it easier to reuse data sources and helps type inference

Reviewed By: passy

Differential Revision: D28413380

fbshipit-source-id: 261a8b981bf18a00edc3075926bd668322e1c37d
2021-06-07 08:09:53 -07:00
Michel Weststrate
44521315c4 Set up separate package build
Summary:
Added a microbundle based build setup to the data-source folder to be able to package just that folder.

For simplicity / iteration speed, this is only used to publish externally. Our own code still references the source files directly.

More strict separation can be done later if there is external adoption.

Reviewed By: nikoant

Differential Revision: D28056699

fbshipit-source-id: a011b615cfffeff8ecb879bd7281a71085cea965
2021-05-10 07:03:40 -07:00
Michel Weststrate
84e2646909 Reorganise for easier extraction
Summary:
To make the DataSource abstraction reusable for other teams and an upcoming talk, this diff moves all DataSource storage & virtualization logic in one folder.

Will set up a build process and demo project in later diffs.

Reviewed By: nikoant

Differential Revision: D28056700

fbshipit-source-id: 7cfe5b40bbbe387da711f765a604a45029d451c7
2021-05-10 07:03:39 -07:00
Michel Weststrate
84d65b1a77 DataTable tweaks
Summary: Found a small issue in the column width calculation where initial invisible columns still got space assigned.

Reviewed By: passy

Differential Revision: D28221659

fbshipit-source-id: ef052533bc37bc833bab72979803ce36bcf50e61
2021-05-06 04:27:59 -07:00
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
Michel Weststrate
faf8588097 Minor improvements
Summary:
Some styling fixes and minor improvements in DataTable, used by network plugin:

- be able to customise the context menu
- be able to customise how entire rows are copied and presented on the clipboard to be able to deviate from the standard JSON
- deeplink handling was made async, this gives the plugin the opportunity to first handle initial setup and rendering before trying to jump somewhere which is a typical use case for deeplinking

Reviewed By: passy

Differential Revision: D27947186

fbshipit-source-id: a56f081d60520c4bc2ad3c547a8ca5b9357e71a1
2021-04-23 09:29:59 -07:00
Michel Weststrate
cd27e4c010 Folder rename datatable -> data-table
Summary: just a rename, as we will have `data-inspector` folder as well in next diffs.

Reviewed By: passy

Differential Revision: D27591891

fbshipit-source-id: b1fe92cbf4be1633e623e59b694efc3f687c3413
2021-04-07 07:55:12 -07:00