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

Re-add dashboard short links #5398

Merged
merged 8 commits into from
Aug 3, 2018
Merged

Re-add dashboard short links #5398

merged 8 commits into from
Aug 3, 2018

Conversation

jaylindquist
Copy link

This PR re-adds the changes from #4760 to include a short link button for dashboards that was accidentally removed in #4528.

Additionally:

  • The button is now available to all users, not just those with save permissions
  • The shortened link will include all active dashboard filters so users can share filtered dashboards with each other

* Make the short link available to all users
* Include filters in the short link for dashboards
@mistercrunch mistercrunch requested a review from williaster July 16, 2018 15:29
@codecov-io
Copy link

codecov-io commented Jul 17, 2018

Codecov Report

Merging #5398 into master will decrease coverage by 0.09%.
The diff coverage is 89.47%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #5398     +/-   ##
=========================================
- Coverage   63.28%   63.18%   -0.1%     
=========================================
  Files         349      351      +2     
  Lines       22121    22204     +83     
  Branches     2457     2466      +9     
=========================================
+ Hits        13999    14030     +31     
- Misses       8108     8159     +51     
- Partials       14       15      +1
Impacted Files Coverage Δ
...erset/assets/src/dashboard/util/getDashboardUrl.js 100% <100%> (ø)
...erset/assets/src/components/URLShortLinkButton.jsx 92.3% <100%> (+0.3%) ⬆️
...uperset/assets/src/dashboard/components/Header.jsx 63.95% <81.25%> (+4.65%) ⬆️
...src/dashboard/components/HeaderActionsDropdown.jsx 81.63% <88.88%> (-0.19%) ⬇️
...perset/assets/src/components/URLShortLinkModal.jsx 92.85% <92.85%> (ø)
superset/assets/src/modules/visUtils.js 58.33% <0%> (-16.67%) ⬇️
superset/connectors/sqla/views.py 64.34% <0%> (-6.13%) ⬇️
superset/assets/src/explore/store.js 21.95% <0%> (-1.13%) ⬇️
...rc/explore/components/controls/AnnotationLayer.jsx 22.66% <0%> (-0.7%) ⬇️
...uperset/assets/src/SqlLab/components/ResultSet.jsx 84.21% <0%> (-0.64%) ⬇️
... and 21 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 3b6cafc...0c7c33a. Read the comment docs.

@mistercrunch
Copy link
Member

🏆 !
Can you share a screenshot of what it looks like?

@jaylindquist
Copy link
Author

jaylindquist commented Jul 19, 2018

It's the same as the change by @hughhhh in #4760

dashboard-short-url-modal

When a user does not have the ability to save the dashboard:

dashboard-short-url-modal-nosave

@williaster
Copy link
Contributor

williaster commented Jul 20, 2018 via email

Copy link
Contributor

@williaster williaster left a comment

Choose a reason for hiding this comment

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

This looks good overall, but I'd request the following tweaks:

  1. move the link button into the dropdown
  2. remove the icon and instead use text inside the dropdown "Share dashboard" (or something like this)
  3. when a user doesn't have permissions to save, "Edit" is disabled but you can still click the dropdown to see the "Share dashboard" link

You may also need to rebase this if @graceguo-supercat 's PR to remove the v1<>v2 switch gets in first. (#5418).

@jaylindquist
Copy link
Author

Sorry for the late response on this PR:

  • The short link is now a menu item with a modal instead of a button with a pop-over to match other options (e.g. refresh interval)
  • Read-only users now have a menu with a disabled "Edit dashboard" button with the following options:
    • Force refresh
    • Auto refresh
    • Share dashboard
  • The "Email dashboard link" menu item is now replaced with "Share dashboard"

Read-only view:
dash-link-readonly

Edit mode for users who can save dashboards:
dash-link-cansave

New modal:
dash-link-modal

Copy link
Contributor

@williaster williaster left a comment

Choose a reason for hiding this comment

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

This looks great, thanks for making the changes! I had a couple nit comments but I think we could also just merge it.

return wrapper;
}

it('read-only', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit -- I would make each of these (read only, write, write + edit) nested describe blocks and then have on it() per assertion because it's easier for debugging. I'm really psyched that you wrote tests for this tho so not a blocker.


import getDashboardUrl from '../../../../src/dashboard/util/getDashboardUrl';

describe('getChartIdsFromLayout', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

👏

ref={this.setModalRef}
isMenuItem={this.props.isMenuItem}
triggerNode={this.props.triggerNode}
beforeOpen={this.getCopyUrl.bind(this)}
Copy link
Contributor

Choose a reason for hiding this comment

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

I would bind this in the constructor, otherwise it's a new function per render. not a huge deal since this isn't rendered a lot, but we'll have a lint rule soon to enforce.

@mistercrunch mistercrunch merged commit aa9b30c into apache:master Aug 3, 2018
@williaster
Copy link
Contributor

thanks @jaylindquist !

@jaylindquist jaylindquist deleted the jay/dashboard-shortlink branch August 6, 2018 12:46
wenchma pushed a commit to wenchma/incubator-superset that referenced this pull request Nov 16, 2018
* Re-add dashboard short links

* Make the short link available to all users
* Include filters in the short link for dashboards

* Remove duplicate key causing linter error

* Change URL Short link button into a menu item with Modal

* Split out tests, bind URL short link in constructor
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.28.0 labels Feb 27, 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 🚢 0.28.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants