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

feat(dashboard): Chart title click redirects to Explore in new tab #20111

Merged
merged 1 commit into from
May 23, 2022

Conversation

kgabryje
Copy link
Member

SUMMARY

This PR makes the chart title in dashboard clickable - redirects to Explore on click. It's basically a shortcut for clicking options -> Edit chart.
On hover the title gets underlined + tooltip appears with prompt to click "Click to edit chart name in a new tab".
This effect is active only in non edit mode and when user has access to Explore

BEFORE/AFTER SCREENSHOTS

Screen.Recording.2022-05-18.at.15.09.00.mov

TESTING INSTRUCTIONS

Flow 1

  1. Go to dashboard
  2. Hover over a chart title - it should get underlined and a tooltip should appear
  3. Click and verify that you got redirected to Explore in a new tab

Flow 2

  1. Go to dashboard's edit mode
  2. Hover over chart title - no underline or tooltip should appear
  3. Click chart title - you should be able to edit the title, click doesn't redirect to Explore

Flow 3

  1. Login as a user without access to Explore and go to dashboard
  2. Nothing should happen when you hover over a chart title

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 May 18, 2022

Codecov Report

Merging #20111 (9160d7d) into master (9cdaa28) will increase coverage by 0.00%.
The diff coverage is 86.36%.

❗ Current head 9160d7d differs from pull request most recent head 9da3d82. Consider uploading reports for the commit 9da3d82 to get more accurate results

@@           Coverage Diff           @@
##           master   #20111   +/-   ##
=======================================
  Coverage   66.46%   66.46%           
=======================================
  Files        1721     1721           
  Lines       64463    64471    +8     
  Branches     6794     6799    +5     
=======================================
+ Hits        42844    42850    +6     
- Misses      19891    19892    +1     
- Partials     1728     1729    +1     
Flag Coverage Δ
javascript 51.36% <75.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...end/src/dashboard/components/SliceHeader/index.tsx 86.27% <60.00%> (-0.96%) ⬇️
superset/databases/commands/test_connection.py 98.64% <92.85%> (-1.36%) ⬇️
...et-frontend/src/components/EditableTitle/index.tsx 70.00% <100.00%> (ø)
superset-frontend/src/components/Modal/Modal.tsx 86.15% <100.00%> (+0.21%) ⬆️
...nd/src/views/CRUD/data/dataset/AddDatasetModal.tsx 41.66% <100.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 9cdaa28...9da3d82. Read the comment docs.

@@ -104,9 +104,18 @@ const SliceHeader: FC<SliceHeaderProps> = ({
[crossFilterValue],
);

const handleClickTitle =
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 use useCallback/useMemo to keep the same function reference?

Copy link
Member Author

Choose a reason for hiding this comment

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

It actually is the same reference! We don't create a new function here, only either assign the one from props or undefined. So unless onExploreChart changes on every render (and if it does, we should fix it there), the reference will stay the same

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

I love this new flow, IMO it totally makes sense. One mostly unrelated comment + I wonder if we couldn't just remove the old menu item as it's now kinda redundant:
image

Comment on lines +114 to +116
sliceName
? t('Click to edit %s in a new tab', sliceName)
: t('Click to edit chart in a new tab'),
Copy link
Member

Choose a reason for hiding this comment

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

I'm kind of surprised by sliceName being optional:
image
Not a blocker, but would be interesting to see if it really should be optional.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think those checks are for the edge case where sliceName is an empty string (not sure if it's possible to achieve such state)

@kgabryje kgabryje merged commit b746e6f into apache:master May 23, 2022
@kgabryje
Copy link
Member Author

I wonder if we couldn't just remove the old menu item as it's now kinda redundant

The purpose of keeping the "Edit chart" action item is to avoid confusion among current users who are used to going to explore via the chart menu
CC @kasiazjc

philipher29 pushed a commit to ValtechMobility/superset that referenced this pull request Jun 9, 2022
@ktmud
Copy link
Member

ktmud commented Jun 14, 2022

The hover link isn't very discoverable so I don't think we can remove the link in 3 dots menu. I'm also curious, why do we decide to open the link in new tab when clicking from title but changed the link in the menu to open in the same tab?

This kind of back and forth and inconsistency would be confusing to users, too.

@kgabryje
Copy link
Member Author

Yeah, it should be consistent... I think we should stay on the same tab in both cases

@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.0.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 preset-io size/M 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants