Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sql lab): table selector should display all the selected tables #19257

Conversation

diegomedina248
Copy link
Contributor

@diegomedina248 diegomedina248 commented Mar 18, 2022

SUMMARY

On the left panel in the SQL Lab editor, we can select a db, schema & table combination and it will query the schema for us.

Initial change
This PR updates the UI interaction so that, once a table is selected, is not persisted in that select. The reason being a user can select multiple tables and the schemas are all shown below.

After discussions
This PR updates the UI interaction so that the table select display all the selected tables, as opposed to clearing it.
Now, both the table select & the table list below are linked together bidirectionally and in sync.

The select is closed after each selection, considering that most of the time the user will want to pick a single table to work on (interaction up for debate).

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:

Screen.Recording.2022-03-18.at.12.11.03.mov

After:

Screen.Recording.2022-03-25.at.19.06.23.mov

TESTING INSTRUCTIONS

  1. Go to SQL Lab
  2. Select a DB
  3. Select a Schema
  4. Select tables

Ensure after each table selection, the schema appears below (it appears at the end, so you might need to scroll)
Ensure the select contains all the selected tables, and that both the select. & list have the same tables.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented Mar 18, 2022

Codecov Report

Merging #19257 (bbdb674) into master (2b53578) will decrease coverage by 0.00%.
The diff coverage is 60.52%.

@@            Coverage Diff             @@
##           master   #19257      +/-   ##
==========================================
- Coverage   66.67%   66.67%   -0.01%     
==========================================
  Files        1676     1676              
  Lines       64715    64735      +20     
  Branches     6506     6511       +5     
==========================================
+ Hits        43151    43164      +13     
- Misses      19878    19885       +7     
  Partials     1686     1686              
Flag Coverage Δ
javascript 51.33% <60.52%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...end/src/components/Datasource/DatasourceEditor.jsx 69.36% <ø> (ø)
...nd/src/views/CRUD/data/dataset/AddDatasetModal.tsx 41.66% <ø> (ø)
...d/src/SqlLab/components/SqlEditorLeftBar/index.tsx 44.89% <13.33%> (-11.86%) ⬇️
...et-frontend/src/components/TableSelector/index.tsx 75.55% <91.30%> (+7.26%) ⬆️
...d/plugins/plugin-chart-echarts/src/Funnel/types.ts 100.00% <0.00%> (ø)
.../plugins/plugin-chart-echarts/src/Treemap/types.ts 100.00% <0.00%> (ø)
...c/views/CRUD/data/database/DatabaseModal/index.tsx 32.90% <0.00%> (ø)
...uperset-ui-core/src/query/types/AnnotationLayer.ts 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2b53578...bbdb674. Read the comment docs.

@diegomedina248 diegomedina248 force-pushed the fix/table-selector-should-clear-once-selected branch from 59c4054 to d56076b Compare March 18, 2022 15:57
@rusackas
Copy link
Member

This works, but it feels a little unique/strange in how it works compared to other Select menus. Would it make sense to have it be a multiple select, so that ALL your choices persist? Then removing an item from the selection could remove the preview just like clicking the close button above the field list itself (which is also not a consistent pattern in Superset, really).

cc @yousoph we can let this through, but a little piece of me wants to tap the brakes and have a brief design thinking moment here.

@diegomedina248
Copy link
Contributor Author

This works, but it feels a little unique/strange in how it works compared to other Select menus. Would it make sense to have it be a multiple select, so that ALL your choices persist? Then removing an item from the selection could remove the preview just like clicking the close button above the field list itself (which is also not a consistent pattern in Superset, really).

cc @yousoph we can let this through, but a little piece of me wants to tap the brakes and have a brief design thinking moment here.

Agreed, but I think it's worth a bigger discussion, cause the database & schema are required to perform the query, but the table is not, so I think it shouldn't belong in the same place. The table is there to get the table schema, which is nice, but feels disconnected.

However, I feel like the solution in the PR is a bit better than the current one, so while we discuss a better approach, it's worth considering.

@yousoph
Copy link
Member

yousoph commented Mar 22, 2022

One other change that might help is that the most recently selected table should appear at the top of the list in the left panel, so you have more feedback after you select your table. These 2 changes together were how the left panel used to work, I believe - they both broke some time ago

@rusackas
Copy link
Member

One other change that might help is that the most recently selected table should appear at the top of the list in the left panel, so you have more feedback after you select your table. These 2 changes together were how the left panel used to work, I believe - they both broke some time ago

That's fixed by this (merged) PR. 🎉

Copy link
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but pinging @michael-s-molina and/or @geido who know the Select component quite well, in case they see an alternative approach.

@michael-s-molina
Copy link
Member

Would it make sense to have it be a multiple select so that ALL your choices persist? Then removing an item from the selection could remove the preview just like clicking the close button above the field list itself (which is also not a consistent pattern in Superset, really).

I totally agree with this. The ability to quickly remove one or all items without scrolling and keeping the behavior consistent with other Selects is essential. Right now, the behavior is really weird. I also agree with Diego's assessment that things look disconnected and need a design review (it's already happening). I think we should apply @rusackas suggestion before merging.

Pinging @jess-dillard and @kasiazjc to consider this discussion in the new designs.

@kasiazjc
Copy link
Contributor

kasiazjc commented Mar 22, 2022

Would it make sense to have it be a multiple select so that ALL your choices persist? Then removing an item from the selection could remove the preview just like clicking the close button above the field list itself (which is also not a consistent pattern in Superset, really).

I totally agree with this. The ability to quickly remove one or all items without scrolling and keeping the behavior consistent with other Selects is essential. Right now, the behavior is really weird. I also agree with Diego's assessment that things look disconnected and need a design review (it's already happening). I think we should apply @rusackas suggestion before merging.

Pinging @jess-dillard and @kasiazjc to consider this discussion in the new designs.

I think the "after" is really confusing (and I would not recommend it) as there is no easy/immediate way to remove the selected schema table and you cannot quickly preview the selected schema tables.

Is there a reason why this cannot be a multiple select and we added this flow instead?

@ghost
Copy link

ghost commented Mar 22, 2022

Agree with @kasiazjc that this field should be a multi-select and we should show all selections in the input box. Typically this is done as displaying the selections as tags so users can quickly remove them from the input box, but I can't think of anywhere else in the app we have this pattern.

@kasiazjc
Copy link
Contributor

Agree with @kasiazjc that this field should be a multi-select and we should show all selections in the input box. Typically this is done as displaying the selections as tags so users can quickly remove them from the input box, but I can't think of anywhere else in the app we have this pattern.

@jess-dillard you mean, where/if do we have the multiselect with tags in the app? We do, in filters, so we already have this pattern.

@ghost
Copy link

ghost commented Mar 23, 2022

@kasiazjc Ah yes, I couldn't remember if/where we used it. I'd recommend using this pattern here as well, allowing the user to populate tags in the table input field as they multi-select tables. Then they can remove the table from the field and sidebar by either removing the tag from the field (which would remove the columns from the sidebar) or the columns from the sidebar (which would remove the tag from the field). Also agree with @yousoph that table columns should be added to the sidebar in reverse order as the user adds them (most recently added table appears first in the sidebar).

Copy link
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The people have spoken :)

@diegomedina248 let's change to multi-select. Thanks!

@diegomedina248 diegomedina248 force-pushed the fix/table-selector-should-clear-once-selected branch from d56076b to 0fa6677 Compare March 25, 2022 22:04
@pull-request-size pull-request-size bot added size/L and removed size/M labels Mar 25, 2022
@diegomedina248 diegomedina248 changed the title fix(sql lab): table selector should clear once selected fix(sql lab): table selector should display all the selected tables Mar 25, 2022
@diegomedina248
Copy link
Contributor Author

@rusackas @yousoph @michael-s-molina @kasiazjc @jess-dillard

Interaction updated as discussed in the thread.
PR description & "after" video updated as well.
Let me know your thoughts.

Thanks!

@michael-s-molina
Copy link
Member

@diegomedina248 Thanks for addressing the suggestions.

The default behavior of the multi-select component is to keep the popup open while the user is doing the selections. In this PR, if I'm trying to select multiple tables, it's really annoying because every selection closes the popup. Is it possible to keep it open?

It would be nice to set allowClear to the multiple select version as well.

The changes to the TableSelector affected other modules. The dataset editor is not showing the selected table anymore.

Screen.Recording.2022-03-28.at.8.02.27.AM.mov

@diegomedina248
Copy link
Contributor Author

@diegomedina248 Thanks for addressing the suggestions.

The default behavior of the multi-select component is to keep the popup open while the user is doing the selections. In this PR, if I'm trying to select multiple tables, it's really annoying because every selection closes the popup. Is it possible to keep it open?

It would be nice to set allowClear to the multiple select version as well.

The changes to the TableSelector affected other modules. The dataset editor is not showing the selected table anymore.

Screen.Recording.2022-03-28.at.8.02.27.AM.mov

@michael-s-molina Thanks for the comments, addressed your suggestions there.

On the multi-select behavior, the reason I originally collapsed the select after each selection was done considering that, in most cases, you would want to select just one.
However, I understand that it departs from the expected UX, so removed that behavior

@yousoph
Copy link
Member

yousoph commented Mar 28, 2022

/testenv up

@github-actions
Copy link
Contributor

@yousoph Ephemeral environment spinning up at http://34.219.242.154:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@yousoph
Copy link
Member

yousoph commented Mar 28, 2022

I agree with @diegomedina248 here that in most cases you'll want to select just one table at a time.

@jess-dillard what are your thoughts on the multi select component behaving differently here than in other places where it's used and closing once one item it selected?

@ghost
Copy link

ghost commented Mar 28, 2022

@yousoph @diegomedina248 I think it should behave consistently with other multi-selects – if there's not a need to view more than one table at once, then we should use a single select and change the sidebar information every time a new table is selected.

@yousoph
Copy link
Member

yousoph commented Mar 28, 2022

Ok! I think multi-select makes more sense than single select here so users can see multiple tables / previews, so I think the behavior as you have it works for the selector.

Copy link
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for all the due diligence on this, everyone! It's a team effort!

@rusackas rusackas merged commit 26a0f05 into apache:master Apr 13, 2022
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

philipher29 pushed a commit to ValtechMobility/superset that referenced this pull request Jun 9, 2022
…pache#19257)

* fix: table Selector should clear once selected

* Multi select

* Add tests

* refactor

* PR comments
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.0.0 and removed 🚢 2.0.1 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels Preset-Patch size/L 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants