Commit Graph

14 Commits

Author SHA1 Message Date
Michel Weststrate
966d748ace Some fixes in rendering legacy plugins
Summary:
Some exploratory testing on all iOS and Android plugins, to see how they behave inside Sandy, and fixed some layout glitches (some were also present without Sandy)

General fixes:
* Introduced some niceties like searchbox resizing properly, and toolbars wrapping automatically in Sandy, rather than buttons becoming invisible
* Containers don't grow anymore by default, but take size of contents
* ScrollContainer child is now a Layout.Vertical. Layout.Vertical should be used as default container everywhere (e.g. Tabs, Panels) in the future
* Fixed layout issue if a split container had only 1 visible child
* DetailsSidebar now scrolls vertically by default
* Details sidebar would sometimes render content in-place rather than in the reserved area
* AppSelector dropdown and Plugin list will now properly ellipse (...) if there is not enough space

Plugin fixes:
* Long database / table names in Database plugin would break layout

Also fixes https://github.com/facebook/flipper/issues/1611

Reviewed By: passy

Differential Revision: D24454188

fbshipit-source-id: c60c867270900a1d4f28587d47067c6ec1072ede
2020-10-22 09:41:11 -07:00
Chaiwat Ekkaewnumchai
a50c373631 Calculate Editable when Used
Summary:
In D21788243, John suggested the field should be calculated when needed not precomputed. This diff does so by moving calculation logic to the component and removing the field

This also fixes the crashing bug when switching to Structure tab, changing table, and switching back to Data tab.

Reviewed By: mweststrate

Differential Revision: D21906983

fbshipit-source-id: 5a9522a5ba3f504108282fb27deae25b5eadc693
2020-06-08 09:00:03 -07:00
Chaiwat Ekkaewnumchai
54bf6440de Allow to Edit only When There Is Primary Key in Table
Summary: To be able to edit correct cell, identifiers are needed. Assume that the primary key is unique, this should be safe to allow the query to find exactly one row to edit

Reviewed By: jknoxville

Differential Revision: D21788239

fbshipit-source-id: b09d1b6da1b46cbc961f08010467e973546acbef
2020-06-02 01:47:06 -07:00
Chaiwat Ekkaewnumchai
b57612a116 Allow to Edit Cell in Detail Sidebar
Summary: This diff adds edit button to detail sidebar to allow user to edit column he/she wants to

Reviewed By: jknoxville

Differential Revision: D21788243

fbshipit-source-id: 4bdcef62114d5a6282ba85bc2bd1b5d039322e50
2020-06-02 01:47:06 -07:00
Chaiwat Ekkaewnumchai
5a2221e6cd Add Logic to Edit And Update Database on Both Client And Server
Summary:
This logic relies on the logic on client side, specifically `SqliteDatabaseDriver.java` in specifying some keys to retrieve useful data in `currentStructure`. This will be error-prone if developer writes their own data driver which doesn't follow the same naming as the data driver used as model.
Also, this diff adds util file to deal with query for updating database on client side.

I decided to construct query clause on server side so that the client side change is not needed.

Reviewed By: jknoxville

Differential Revision: D21788241

fbshipit-source-id: cf9a920c3e5b7b29f619bc3f00e68616b3445cab
2020-06-02 01:47:06 -07:00
Chaiwat Ekkaewnumchai
fe17ddce1a Change UpdatePage Reducer
Summary: The different is small after the change from storing pre-rendered data to raw data. Hence, the diff changes it to match `currentPage` to ease the assignment (used in next diffs)

Reviewed By: jknoxville

Differential Revision: D21788245

fbshipit-source-id: 87bdbce33f0615bf31878797a74fce5d5969db7b
2020-06-02 01:47:05 -07:00
Chaiwat Ekkaewnumchai
d6b617a952 Change Execute Action Parameter
Summary: `'Execute'` action was previously used only for execute tab which assumed the input will come from the state. This changes so that it can take any input attached to parameters (more explanation about the design in <insert diff number>)

Reviewed By: jknoxville

Differential Revision: D21788244

fbshipit-source-id: 8fb8ecb8f8df84f4854f70432e7a1fdb531403e9
2020-06-02 01:47:05 -07:00
Chaiwat Ekkaewnumchai
741f3591e6 Get Table Structure Even without Accessing The Page
Summary: This diff helps obtaining metadata for using to edit row

Reviewed By: jknoxville

Differential Revision: D21788246

fbshipit-source-id: bf01eff8866c82f001575d59cc2886b6cdd39dc5
2020-06-02 01:47:04 -07:00
Chaiwat Ekkaewnumchai
046b8ceac6 Refactor Structure Page
Summary:
This refactor has the following changes:
- Change way to store data: raw data instead of rendered data
- Move render function to separated function component file
- Remove repetitive pattern

Reviewed By: jknoxville

Differential Revision: D21739468

fbshipit-source-id: 1f7e7ae902c3b55f3863300aaed26c2adda898ac
2020-05-27 07:14:39 -07:00
Chaiwat Ekkaewnumchai
9ae0511f16 Refactor Data Used And Passed to Detail Sidebar
Summary:
As suggested in the previous diff, I change the way to store row values. Now, (kinda) raw values are stored instead of processed values that can be used directly for `ManagedTable`. This simplifies logic in detail sidebar.

I'm not sure what the effect to performance.

Reviewed By: mweststrate

Differential Revision: D21621896

fbshipit-source-id: 472be3caa955ca32f876f81095af21e9c17cb159
2020-05-19 09:12:56 -07:00
Chaiwat Ekkaewnumchai
11b233b516 Allow Long Text to Be Shown in The Sidebar
Summary:
This allows long text to be seen on the sidebar in database plugin. Also, remove weird padding in the sidebar and separate sidebar component to a new file

Refactoring is in the next diff

Reviewed By: mweststrate

Differential Revision: D21550672

fbshipit-source-id: 3e80be16783719e18392fe3d8f8068caf9283f8f
2020-05-19 09:12:56 -07:00
Chaiwat Ekkaewnumchai
ee2369950f Sort Result From ID instead of Using Directly from Result
Summary:
As mentioned in [the first comment in the Github issue](https://github.com/facebook/flipper/issues/989#issuecomment-616673590), we were mixing database `id` given from client and `index + 1` on server side. After investigating, most are used correctly; it searches `id` from given database `name`. However, there are a few (if not one) that, in my opinion, was used incorrectly. For example, [`tableOption`](https://fburl.com/diffusion/vlo7xbo1) assumed `id - 1` is the index, which is sometime incorrect.

This diff sorts the database listed from client by `id` before storing in the state.

Changelog: Fixed wrong order assumption on server side

Reviewed By: jknoxville

Differential Revision: D21496345

fbshipit-source-id: 5e15f776356b0357ac14fbde6c2a11efd76cd1e1
2020-05-12 04:54:31 -07:00
Chaiwat Ekkaewnumchai
736d681562 Add Detail to Selected Row
Summary:
- Add detail sidebar to data tab. This reuses `renderSidebar` from SQL tab
- `renderTable` function is moved into the component to easier access `renderSidebar`

Reviewed By: mweststrate

Differential Revision: D21406942

fbshipit-source-id: 5c79489a80931b1133c0a28ca5897a27ba9dd6b8
2020-05-07 06:15:51 -07:00
Chaiwat Ekkaewnumchai
7d2101c68f Convert Database Plugin to TypeScript
Summary:
Mainly convert `js` to `tsx`
Additional change:
- Try not to directly change object value in reduce function
- Add emotion styled when there is error using style prop directly

Reviewed By: nikoant

Differential Revision: D21406943

fbshipit-source-id: 30312fa0b0d2d70fa52c5ff9db747e1a83beb270
2020-05-06 07:35:02 -07:00