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

chore: Shows the dataset description in the gallery dropdown #16200

Conversation

michael-s-molina
Copy link
Member

@michael-s-molina michael-s-molina commented Aug 11, 2021

SUMMARY

  • Shows the dataset description in the gallery dropdown
  • Lazy load the data source values with search and pagination

Closes #16153

@junlincc @rusackas @jinghua-qa

@villebro After this PR is merged we need to remove the datasets from bootstrap data.

AFTER SCREENSHOTS OR ANIMATED GIF

Screen.Recording.2021-08-12.at.4.21.38.PM.mov

TESTING INSTRUCTIONS

Check the original issue for instructions.

ADDITIONAL INFORMATION

  • Has associated issue:
  • 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 Aug 11, 2021

Codecov Report

Merging #16200 (7accf42) into master (ccfc95f) will decrease coverage by 0.20%.
The diff coverage is 74.40%.

❗ Current head 7accf42 differs from pull request most recent head 6d4f06c. Consider uploading reports for the commit 6d4f06c to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16200      +/-   ##
==========================================
- Coverage   76.73%   76.53%   -0.21%     
==========================================
  Files         996      997       +1     
  Lines       52999    53194     +195     
  Branches     6738     6764      +26     
==========================================
+ Hits        40668    40711      +43     
- Misses      12102    12253     +151     
- Partials      229      230       +1     
Flag Coverage Δ
hive ?
mysql 81.54% <81.38%> (-0.07%) ⬇️
postgres 81.60% <81.38%> (-0.03%) ⬇️
presto ?
python 81.69% <81.38%> (-0.46%) ⬇️
sqlite 81.21% <81.38%> (-0.07%) ⬇️

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

Impacted Files Coverage Δ
superset-frontend/src/addSlice/App.tsx 0.00% <ø> (ø)
superset-frontend/src/components/Form/Form.tsx 100.00% <ø> (ø)
...ontrols/DndColumnSelectControl/DndColumnSelect.tsx 46.42% <ø> (-0.94%) ⬇️
...rontend/src/explore/components/optionRenderers.tsx 100.00% <ø> (ø)
...perset-frontend/src/views/CRUD/chart/ChartList.tsx 72.61% <ø> (ø)
...set-frontend/src/views/CRUD/data/database/types.ts 100.00% <ø> (ø)
...set-frontend/src/views/CRUD/welcome/ChartTable.tsx 73.17% <0.00%> (-1.83%) ⬇️
...c/visualizations/TimeTable/TimeTableChartPlugin.js 75.00% <ø> (ø)
superset/common/query_object.py 90.66% <ø> (ø)
superset/datasets/api.py 91.92% <ø> (ø)
... and 57 more

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 ccfc95f...6d4f06c. Read the comment docs.

@junlincc
Copy link
Member

/testenv up

@github-actions
Copy link
Contributor

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

@junlincc
Copy link
Member

tested locally, LGTM
also tried remove, edit the description, it's reflected accurately in the tooltip

Copy link
Member

@junlincc junlincc left a comment

Choose a reason for hiding this comment

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

product sign-off ✅

@mistercrunch
Copy link
Member

mistercrunch commented Aug 12, 2021

Can we make it an info bubble? That way we see clearly which datasets have a description and which don't, and tooltips don't get in the way if you don't want to see them.

Something like what we do in the metadata panel?
Screen Shot 2021-08-11 at 9 38 05 PM

Also, could be another PR but would love to see this surfaced in a similar way in CRUD list view!

@michael-s-molina michael-s-molina force-pushed the viz-gallery-dataset-description branch 2 times, most recently from f37b0c0 to 71e9aae Compare August 12, 2021 12:20
@michael-s-molina
Copy link
Member Author

michael-s-molina commented Aug 12, 2021

Can we make it an info bubble? That way we see clearly which datasets have a description and which don't, and tooltips don't get in the way if you don't want to see them.

Something like what we do in the metadata panel?
Screen Shot 2021-08-11 at 9 38 05 PM

Also, could be another PR but would love to see this surfaced in a similar way in CRUD list view!

@mistercrunch Currently, the tooltip is always displayed by Ant Design and it's really helpful for cases where the text is truncated. That said, we did some changes in other places to only show the tooltip if the text is truncated and I liked the idea. I agree that having an icon is very helpful in this scenario because we have extra information, that may or may not be present for a dataset. I'll do the requested changes in a follow-up PR because we need to change the Select component and deal with the combination of truncated text, not truncated text, and icon.

@kgabryje
Copy link
Member

When I open the datasets select for the first time, I see a "No data" placeholder for about a second. Can we not show it? Or replace with some spinner?

Also, when datasets description is very long (like World Bank Health Data from test datasets) has a very long description that doesn't fit in the tooltip. Can we show 3 dots at the end or something?
image

}) => ({
value: `${item.id}__${item.datasource_type}`,
label: item.table_name,
title: `${item.table_name}\n\n${
Copy link
Member

Choose a reason for hiding this comment

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

Can we replace \n\n with a span with some padding, so that we have more control over the spacings and can use grid unit from theme?

Copy link
Member

@geido geido left a comment

Choose a reason for hiding this comment

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

The implementation looks good. However, I also share some concerns about these tooltips.

Why aren't we using the Antd Tooltip as everywhere else? I feel like this is harder to read.

I think we shouldn't be showing "No description" where there is no description available.

@michael-s-molina
Copy link
Member Author

@kgabryje @geido Thanks for the comments!

When I open the datasets select for the first time, I see a "No data" placeholder for about a second. Can we not show it? Or replace with some spinner?

This is the default behavior of the Select component. We can try to change that but I would like to only change the Select's code after we write the tests for the component to avoid regressions at this point. It's a little tricky because of the sync and async modes. I'll add your suggestion to the component's list of improvements.

Also, when datasets description is very long (like World Bank Health Data from test datasets) has a very long description that doesn't fit in the tooltip. Can we show 3 dots at the end or something?

Yes. Will do.

Can we replace \n\n with a span with some padding, so that we have more control over the spacings and can use grid unit from theme?

Yes. Will do.

Why aren't we using the Antd Tooltip as everywhere else? I feel like this is harder to read.

I was using the native feature of the Ant Design Select. To use our tooltip we need to change the component. I'll add your suggestion to the component's list of improvements.

I think we shouldn't be showing "No description" where there is no description available.

The idea here was to show the user that he has the possibility to add a description. We'll add the info bubble in a follow-up PR according to @mistercrunch suggestions. I'm imagining that the icon will only appear for items that have a description so your concern will disappear.

@michael-s-molina
Copy link
Member Author

michael-s-molina commented Aug 12, 2021

@kgabryje @geido I was able to change the tooltip without modifying the Select component! With that, all your requests with the exception of the 'No data' were implemented.

I updated the PR's description with the latest video.

This PR is the base for another important PR so let's treat the following improvements in follow-up PRs:

  • Show icons for datasets that contain descriptions @mistercrunch
  • Apply the same logic to the CRUD list view @mistercrunch
  • Only show tooltips when necessary (truncated items or datasets with descriptions)

@rusackas
Copy link
Member

/testenv up

@github-actions
Copy link
Contributor

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

.tooltip-description {
margin-top: ${theme.gridUnit * 2}px;
display: -webkit-box;
-webkit-line-clamp: 20;
Copy link
Member

Choose a reason for hiding this comment

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

Ooh, you don't get to use that every day.

@rusackas
Copy link
Member

Love the new tooltips, but it might be nice to position them so they hang off the right side of the Select option. Right now, the tooltip covers the other menu items, which means it gets in the way of selecting anything. Kind of frustrating.

tooltip covers menu

Comment on lines 179 to 180
<Tooltip
title={
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<Tooltip
title={
<Tooltip
placement="right"
title={

@villebro
Copy link
Member

I love the lazy loading of datasource data! As we now no longer need it in bootstrap data, we can pull it out with this change to make page loading marginally faster/lighter:

diff --git a/superset/views/chart/views.py b/superset/views/chart/views.py
index 68c19cc2c..01b9e53ca 100644
--- a/superset/views/chart/views.py
+++ b/superset/views/chart/views.py
@@ -62,15 +62,7 @@ class SliceModelView(
     @expose("/add", methods=["GET", "POST"])
     @has_access
     def add(self) -> FlaskResponse:
-        datasources = [
-            {"value": str(d.id) + "__" + d.type, "label": repr(d)}
-            for d in security_manager.get_user_datasources()
-        ]
         payload = {
-            "datasources": sorted(
-                datasources,
-                key=lambda d: d["label"].lower() if isinstance(d["label"], str) else "",
-            ),
             "common": common_bootstrap_payload(),
             "user": bootstrap_user_data(g.user),
         }

Other than that I love @rusackas propsal to place the tooltip on the right - LGTM after these changes.

Copy link
Member

@geido geido left a comment

Choose a reason for hiding this comment

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

LGTM with the suggestions above!

@michael-s-molina
Copy link
Member Author

@rusackas I was able to adjust the tooltip positioning. Now, I'm presenting the tooltip at the row level, always preserving the visibility of the items independently of the content length.

Screen.Recording.2021-08-13.at.1.03.53.PM.mov

@villebro I removed the bootstrap data according to your instructions. Thanks!

@rusackas
Copy link
Member

/testenv up

@github-actions
Copy link
Contributor

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

@michael-s-molina michael-s-molina merged commit 720e5b1 into apache:master Aug 13, 2021
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

amitmiran137 pushed a commit that referenced this pull request Aug 16, 2021
…gies

* upstream/master: (64 commits)
  check roles before fetching reports (#16260)
  chore: upgrade mypy and add type guards (#16227)
  fix: pivot columns with ints for name (#16259)
  chore(pylint): Bump Pylint to 2.9.6 (#16146)
  fix examples tab for dashboard (#16253)
  chore: bump superset-ui packages to 0.17.84 (#16251)
  chore: Shows the dataset description in the gallery dropdown (#16200)
  fix(Dashboard): Omnibar dropdown visibility and keyboard commands (#16168)
  chore: bump py version for integration test (#16213)
  fix: skip perms on query context update (#16250)
  refactor: external metadata fetch API (#16193)
  feat(dao): admin can remove self from object owners (#15149)
  fix(dashboard): cross filter chart highlight when filters badge icon clicked (#16233)
  fix: validate_parameters and query (#16241)
  fix: Remove Advanced Analytics tag for 2 charts (#16240)
  Revert "feat: Changing Dataset names (#16199)" (#16235)
  feat: Allow users to connect via legacy SQLA form (#16201)
  fix: remove encryption from db params (#16214)
  fix(Explore): Show the tooltip only when label does not fit the container in METRICS/FILTERS/GROUP BY/SORT BY of the DATA panel (#16060)
  Show/hide tooltips (#16192)
  ...

# Conflicts:
#	superset/tasks/caching/cache_strategy.py
opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
…16200)

* chore: Shows the dataset description in the gallery dropdown

* chore: Adjusts the tooltip positioning, fixes the search and removes unnecessary bootstrap data
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 28, 2021
…16200)

* chore: Shows the dataset description in the gallery dropdown

* chore: Adjusts the tooltip positioning, fixes the search and removes unnecessary bootstrap data
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.4.0 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 size/L viz:gallery 🚢 1.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[gallery]show description of dataset in gallery dropdown(?)
7 participants