-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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 'urlParams' option to pass query parameters to embedded dashboard #24408
feat(embedded-sdk): Add 'urlParams' option to pass query parameters to embedded dashboard #24408
Conversation
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.
@justinpark Friendly reminder for a review here. |
Hello, @john-bodley @justinpark ! Could you please help move this PR forward? This functionality is quite important for us |
Hello folks, could we have feedbacks on this PR: does it have a chance to be merged soon? |
superset-embedded-sdk/src/index.ts
Outdated
@@ -149,7 +154,7 @@ export async function embedDashboard({ | |||
resolve(new Switchboard({ port: ourPort, name: 'superset-embedded-sdk', debug })); | |||
}); | |||
|
|||
iframe.src = `${supersetDomain}/embedded/${id}${dashboardConfig}${filterConfigUrlParams}`; | |||
iframe.src = `${supersetDomain}/embedded/${id}${dashboardConfig}${filterConfigUrlParams}${extraUrlParams}`; |
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.
There might be a conflict between keys in filterConfigUrlParams and extraUrlParams. It would be better to design a unique key-value pair and override its value sequentially, something like
iframe.src = `${supersetDomain}/embedded/${id}${dashboardConfig}${filterConfigUrlParams}${extraUrlParams}`; | |
const getUniqueUrlParams = (urlParams: string[]) => | |
new URLSearchParams( | |
Object.fromEntries( | |
urlParams.map(param => [...new URLSearchParams(param)]).flat(1), | |
), | |
).toString(); | |
const urlParams = getUniqueUrlParams([dashboardConfig, filterConfigUrlParams, extraUrlParams]); | |
iframe.src = `${supersetDomain}/embedded/${id}${urlParams ? `?${urlParams}` : ''}`; |
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.
Good suggestion, @justinpark, thanks! I simplified the computation of all three url params categories, please review.
hey @grvoicu any changes of merging this one? looks reeeeeally helpful!! ❇️ |
This would be really helpful to pre filter dashboards @grvoicu |
…-to-the-embedded-dashboard * master: (1182 commits) fix(ci): mypy pre-commit issues (apache#27161) feat(Alerts and Reports): Modal redesign (apache#26202) refactor: Migrate ErrorBoundary to typescript (apache#27143) chore(tests): Remove unnecessary explicit Flask-SQLAlchemy session expunges (apache#27136) fix(plugins): Apply dashboard filters to comparison query in BigNumber with Time Comparison chart (apache#27138) fix: Duplicated toast messages (apache#27135) docs: add Geotab to users list (apache#27134) fix: Plain error message when visiting a dashboard via permalink without permissions (apache#27132) fix: ID param for DELETE ssh_tunnel endpoint (apache#27130) chore(hail mary): Update package-lock.json via npm-audit-fix (apache#26693) chore: lower cryptography min version to 41.0.2 (apache#27129) docs(miscellaneous): Export Datasoruces: export datasources exports to ZIP (apache#27120) fix(pivot-table-v2): Added forgotten translation pivot table v2 (apache#22840) fix: RLS modal overflow (apache#27128) refactor: Updates some database columns to MediumText (apache#27119) fix: gevent upgrade to 23.9.1 (apache#27112) fix: removes old deprecated sqllab endpoints (apache#27117) feat(storybook): Co-habitating/Upgrading Storybooks to v7 (dependency madness ensues) (apache#26907) fix: bump grpcio, urllib3 and paramiko (apache#27124) chore(internet_port): added new ports and removed unnecessary string class (apache#27078) ...
it's a top notch idea! Which is the status of this merge? |
I am just a few hours away to switch to 'superset-embedded-sdk' if this PR is not merged @justinpark |
hey @justinpark can we have some review maybe? 😄 |
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!
…o embedded dashboard (apache#24408)
…o embedded dashboard (apache#24408)
…o embedded dashboard (apache#24408)
SUMMARY
Add support for using the SQL Templating - Custom Url Parameters feature in embedded dashboards, as requested in #17187 (comment).
This was also implemented in #20259 and #23344, but both pull-requests seem to be stale and with reviewers concerns not fully addressed.
Specifically, this adds the
urlParams
option to thedashboardUiConfig
:BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION