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: convert URLShortLinkButton to typescript #19954

Merged
merged 2 commits into from
May 5, 2022

Conversation

ktmud
Copy link
Member

@ktmud ktmud commented May 4, 2022

SUMMARY

Convert URLShortLinkButton to TypeScript (tsx) in preparation for bigger refactor where we support including activeTabs in dashboard urls (currently you can only highlight one tab using location.hash).

No visible changes in the UI.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TESTING INSTRUCTIONS

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

@ktmud ktmud force-pushed the dashboard-mult-tabs-in-location-hash branch from c6da7b0 to c66bd11 Compare May 4, 2022 18:06
@codecov
Copy link

codecov bot commented May 4, 2022

Codecov Report

Merging #19954 (2e2053f) into master (2e2053f) will not change coverage.
The diff coverage is n/a.

❗ Current head 2e2053f differs from pull request most recent head 3304e31. Consider uploading reports for the commit 3304e31 to get more accurate results

@@           Coverage Diff           @@
##           master   #19954   +/-   ##
=======================================
  Coverage   66.28%   66.28%           
=======================================
  Files        1712     1712           
  Lines       63964    63964           
  Branches     6726     6726           
=======================================
  Hits        42396    42396           
  Misses      19856    19856           
  Partials     1712     1712           
Flag Coverage Δ
hive 53.65% <0.00%> (ø)
javascript 51.25% <0.00%> (ø)
mysql 81.99% <0.00%> (ø)
postgres 82.04% <0.00%> (ø)
presto 53.51% <0.00%> (ø)
python 82.47% <0.00%> (ø)
sqlite 81.78% <0.00%> (ø)
unit 48.63% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out 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 2e2053f...3304e31. Read the comment docs.

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.

Looks much nicer now, thanks for cleaning this up! 👍 Minor improvement suggestion, other than that LGTM.

const { addDangerToast } = useToasts();

const getCopyUrl = async () => {
if (dashboardId) {
Copy link
Member

@villebro villebro May 5, 2022

Choose a reason for hiding this comment

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

This got me wondering, can we really have this component without dashboardId being populated: And based on a quick search, this appears to be the only component that's using this, and there dashboardId is always set:

So I think we can clean this up further by making dashboardId mandatory in URLShortLinkButtonProps.

@ktmud
Copy link
Member Author

ktmud commented May 5, 2022

@villebro I made more changes to this PR:

  • Converted AnchorLink component to tsx, too
  • Moved both AnchorLink and URLShortLinkButton to src/dashboards since they really are dashboard only components.
  • Renamed AnchorLinkProps["anchorLinkId"] to AnchorLinkProps["id"]
  • Changed showShortLinkButton to be default and made dashboardId mandatory

filters={filters}
showShortLinkButton
/>
<AnchorLink id={component.id} dashboardId={dashboardId} />
Copy link
Member Author

Choose a reason for hiding this comment

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

Adding dashboardId fixes the bug where the copy button doesn't copy the right URL for section headers in dashboards.

@ktmud ktmud force-pushed the dashboard-mult-tabs-in-location-hash branch 2 times, most recently from ad21c10 to ee3141f Compare May 5, 2022 17:38
@pull-request-size pull-request-size bot added size/XL and removed size/L labels May 5, 2022
@ktmud ktmud force-pushed the dashboard-mult-tabs-in-location-hash branch from ee3141f to 3304e31 Compare May 5, 2022 17:38
@ktmud
Copy link
Member Author

ktmud commented May 5, 2022

Merging to unblock followup PRs

@ktmud ktmud merged commit 54bfd83 into apache:master May 5, 2022
hughhhh pushed a commit to hve-labs/superset that referenced this pull request May 11, 2022
@john-bodley john-bodley deleted the dashboard-mult-tabs-in-location-hash branch June 8, 2022 05:33
philipher29 pushed a commit to ValtechMobility/superset that referenced this pull request Jun 9, 2022
@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 size/XL 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants