-
Notifications
You must be signed in to change notification settings - Fork 16.5k
feat(embedded-sdk): Add resolvePermalinkUrl callback for custom permalink URLs #36924
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(embedded-sdk): Add resolvePermalinkUrl callback for custom permalink URLs #36924
Conversation
Code Review Agent Run #0452f7Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
superset-frontend/src/dashboard/components/URLShortLinkButton/index.tsx
Outdated
Show resolved
Hide resolved
|
CodeAnt AI finished reviewing your PR. |
Code Review Agent Run #c9a4e1Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Code Review Agent Run #d38128Actionable Suggestions - 0Additional Suggestions - 1
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
Hey @michael-s-molina, This is a very nice feature! Thanks for working on this. 🙌 I tried testing this locally, but it's not working properly for me, unsure if I'm missing something. Here's what I tried:
const myLightDashboard = supersetEmbeddedSdk.embedDashboard({
id: dashboardId,
supersetDomain: supersetDomain,
mountPoint: document.getElementById("dashboard-container"),
fetchGuestToken: async () => fetchGuestTokenFromBackend(),
dashboardUiConfig: {
hideTitle: false,
hideChartControls: false,
},
resolvePermalinkUrl: ({ key }) => {
return `https://my-app.com/analytics/share/${key}`;
},
});Everything loads fine, but the Share options still give me a Also, while you're working on this, I wonder if you would want to re-add anchor links from tabs and headers in embedded dashboards? I removed them back here, as they don't really work for embedded users (you can't really use that link and shouldn't even have access to it). My only concern here would be how to make this configureable: as you can imagine, not all Embedded Orgs would want to display permalinks. The Share options can be hidden through perms (in case the Guest Role has permission to create permalink or not) but the anchor links for tabs/headers are not managed via perms. Some options:
Second option seems like the best move here. WDYT? |
|
CodeAnt AI is running Incremental review Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
@Vitor-Avila I fixed the bug and also added a way for consumers to configure iframe's allow property which is required for copy/paste and other operations. Screen.Recording.2026-01-09.at.11.34.28.mov |
@Vitor-Avila Let's handle this a follow-up PR given the parallel discussion regarding the options. |
Code Review Agent Run #4be3b4Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
justinpark
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@michael-s-molina thanks for fixing this flow. I agree we can tackle that in a follow up. Another thing I noticed is that while I can get the permalink key, using it via |
SUMMARY
This PR adds a
resolvePermalinkUrlcallback to the Embedded SDK that allows host applications to customize the permalink URLs generated when users click share buttons inside an embedded dashboard.Problem:
When users click "Copy Link" on a chart or dashboard inside an embedded Superset dashboard, the generated permalink uses Superset's domain (e.g.,
https://superset.example.com/superset/dashboard/p/xyz789/). Host applications often need full control over the permalink URL to use their own domain, paths, and query parameters.Solution:
resolvePermalinkUrlcallback to the SDK'sembedDashboard()optionshttps://my-app.com/analytics/share/xyz789)Architecture:
Additional fix:
DashboardPage.tsxextracts the anchor from the permalink state and scrolls to the element after hydration.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A - This is an SDK API change, not a UI change.
TESTING INSTRUCTIONS
Test custom permalink URLs in embedded mode:
https://my-app.com/share/xyz789)Test fallback behavior (no callback):
resolvePermalinkUrlcallbackTest permalink restoration with anchor:
Test non-embedded mode still works:
ADDITIONAL INFORMATION