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(dashboard): copy permalink to dashboard chart #19772

Merged
merged 3 commits into from
Apr 19, 2022

Conversation

villebro
Copy link
Member

SUMMARY

The PR #18181 changed dashboard chart permalinks to link to explore view, while previously they would create a permalink to the dashboard with an anchor pointing to the chart. This changes this behavior back to how it was originally implemented.

AFTER

Now the permalink will link to the dashboard with the chart anchor:

new-chart-perma.mp4

BEFORE

Before the permalink sent the user to explore:

old-dash-perma.mp4

TESTING INSTRUCTIONS

  1. go to the Video Games Dashboard
  2. Go to the "Explore Trends" tab
  3. Copy a permalink from one of the charts
  4. follow the permalink and see where you end up

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

@pull-request-size pull-request-size bot added size/M and removed size/S labels Apr 19, 2022
@codecov
Copy link

codecov bot commented Apr 19, 2022

Codecov Report

Merging #19772 (38f75bd) into master (594523e) will increase coverage by 0.01%.
The diff coverage is 65.21%.

❗ Current head 38f75bd differs from pull request most recent head c4862e2. Consider uploading reports for the commit c4862e2 to get more accurate results

@@            Coverage Diff             @@
##           master   #19772      +/-   ##
==========================================
+ Coverage   66.49%   66.51%   +0.01%     
==========================================
  Files        1689     1690       +1     
  Lines       64614    64614              
  Branches     6650     6655       +5     
==========================================
+ Hits        42966    42978      +12     
+ Misses      19947    19936      -11     
+ Partials     1701     1700       -1     
Flag Coverage Δ
javascript 51.19% <65.21%> (+0.03%) ⬆️

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

Impacted Files Coverage Δ
superset-frontend/src/components/Chart/Chart.jsx 52.54% <0.00%> (+2.54%) ⬆️
...dashboard/components/SliceHeaderControls/index.tsx 66.66% <ø> (ø)
.../src/explore/components/ControlPanelsContainer.tsx 79.80% <ø> (ø)
superset-frontend/src/utils/urlUtils.ts 46.93% <ø> (ø)
.../explore/components/ExploreViewContainer/index.jsx 52.29% <10.00%> (-0.61%) ⬇️
...t-frontend/src/explore/components/ExploreAlert.tsx 58.33% <58.33%> (ø)
.../src/utils/getChartRequiredFieldsMissingMessage.ts 66.66% <66.66%> (ø)
...et-frontend/src/components/Chart/ChartRenderer.jsx 54.23% <100.00%> (+1.60%) ⬆️
...ontend/src/components/URLShortLinkButton/index.jsx 93.75% <100.00%> (ø)
...dashboard/components/menu/ShareMenuItems/index.tsx 90.00% <100.00%> (+8.18%) ⬆️
... and 3 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 594523e...c4862e2. Read the comment docs.

Copy link
Member

@ktmud ktmud 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 a couple of nits.

Should we include this in v1.5 release? I'd assume it breaks a lot of users' workflow.

@@ -49,23 +45,17 @@ const ShareMenuItems = (props: ShareMenuItemProps) => {
addDangerToast,
addSuccessToast,
dashboardId,
formData,
hash,
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 trying to understand what hash means and how it is used but couldn't wrap my head around it very easily. Can it be named to something more unique so it's more searchable?

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 would have personally gone with anchor, but

  1. the previous implementation used the term hash
  2. I found references to hash elsewhere, too: https://www.w3schools.com/jsref/prop_anchor_hash.asp

So I went with hash. Since it's already in the schema, I think it might be a good idea to leave it like that, but I'm happy to change it if you feel even remotely strongly about this.

Copy link
Member

Choose a reason for hiding this comment

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

I think it's okay to keep it as long as it is pushed downward to when the URL is actually used. Or we can add some comments.

@@ -310,13 +311,14 @@ class SliceHeaderControls extends React.PureComponent<

{supersetCanShare && (
<ShareMenuItems
dashboardId={dashboardId}
hash={componentId}
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
hash={componentId}
dashboardComponentId={componentId}

Can we push down the concept of hash to only when we interact with the URL? It took me a while to realize what it really means.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good idea, I like it 👍

const nativeFiltersKey = getUrlParam(URL_PARAMS.nativeFiltersKey);
let filterState = {};
if (nativeFiltersKey && dashboardId) {
filterState = await getFilterValue(dashboardId, nativeFiltersKey);
}
return getDashboardPermalink(String(dashboardId), filterState);
return getDashboardPermalink(String(dashboardId), filterState, hash);
Copy link
Member

Choose a reason for hiding this comment

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

Would be nice if we make this more explicit:

Suggested change
return getDashboardPermalink(String(dashboardId), filterState, hash);
return getDashboardPermalink({
dashboardId, # need to relax the type restriction in `getDashboardPermalink` as well
filterState,
hash: dashboardComponentId
});

@villebro
Copy link
Member Author

@ktmud I believe this should address your comments: c4862e2

Should we include this in v1.5 release? I'd assume it breaks a lot of users' workflow.

There's already a -1 vote on 1.5.0rc3. So if you feel this is important for 1.5.0, for the sake of formality I'd love it if you could vote a -1 in reference to this regression, so we can kill it and get rc4 up for vote asap.

Copy link
Member

@ktmud ktmud left a comment

Choose a reason for hiding this comment

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

LGTM!

@villebro villebro merged commit e061955 into apache:master Apr 19, 2022
@villebro villebro deleted the villebro/dashboard-share-chart branch April 20, 2022 05:31
villebro added a commit that referenced this pull request Apr 25, 2022
* fix(dashboard): copy permalink to dashboard chart

* lint

* address comments

(cherry picked from commit e061955)
philipher29 pushed a commit to ValtechMobility/superset that referenced this pull request Jun 9, 2022
* fix(dashboard): copy permalink to dashboard chart

* lint

* address comments
@mistercrunch mistercrunch added 🍒 1.5.0 🍒 1.5.1 🍒 1.5.2 🍒 1.5.3 🏷️ 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 lts-v1 preset-io size/M 🍒 1.5.0 🍒 1.5.1 🍒 1.5.2 🍒 1.5.3 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants