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

[MDS] Expose common url key for consumers #6602

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

huyaboo
Copy link
Member

@huyaboo huyaboo commented Apr 22, 2024

Description

This PR adds a common URL key for plugins/other consumers to consume.

Issues Resolved

Closes #6534

Screenshot

Testing the changes

Changelog

  • fix: [MDS] Expose common url key to query for datasource

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Copy link
Contributor

❌ Empty Changelog Section

The Changelog section in your PR description is empty. Please add a valid changelog entry or entries. If you did add a changelog entry, check to make sure that it was not accidentally included inside the comment block in the Changelog section.

Copy link

codecov bot commented Apr 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.44%. Comparing base (75e6087) to head (608dd9a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6602      +/-   ##
==========================================
- Coverage   67.44%   67.44%   -0.01%     
==========================================
  Files        3442     3442              
  Lines       67804    67805       +1     
  Branches    11025    11025              
==========================================
- Hits        45730    45729       -1     
- Misses      19408    19409       +1     
- Partials     2666     2667       +1     
Flag Coverage Δ
Linux_1 33.09% <ø> (ø)
Linux_2 55.06% <ø> (ø)
Linux_3 45.21% <100.00%> (-0.01%) ⬇️
Linux_4 34.87% <100.00%> (+<0.01%) ⬆️
Windows_1 33.11% <ø> (ø)
Windows_2 55.01% <ø> (ø)
Windows_3 45.23% <100.00%> (+<0.01%) ⬆️
Windows_4 34.87% <100.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@huyaboo huyaboo force-pushed the urlkey branch 2 times, most recently from 080ad48 to 17eb0d4 Compare April 23, 2024 18:33
@jackiehanyang
Copy link

Can we hold off on this one and include it in 2.15, given that we're close to the 2.14 code freeze date? It might look like a small change, but it requires the plugin team to go through the development cycle again to adopt this change

@huyaboo
Copy link
Member Author

huyaboo commented Apr 23, 2024

Can we hold off on this one and include it in 2.15, given that we're close to the 2.14 code freeze date? It might look like a small change, but it requires the plugin team to go through the development cycle again to adopt this change

Acknowledged. Moved to 2.15

@huyaboo huyaboo added the multiple datasource multiple datasource project label Apr 24, 2024
@huyaboo huyaboo force-pushed the urlkey branch 5 times, most recently from cd11e03 to 4742741 Compare April 29, 2024 18:44
@huyaboo huyaboo force-pushed the urlkey branch 2 times, most recently from e70eb39 to f5b717b Compare May 6, 2024 16:28
@@ -110,6 +116,7 @@ export class DataSourceManagementPlugin
ui: {
DataSourceSelector: createDataSourceSelector(uiSettings, dataSource),
getDataSourceMenu: <T>() => createDataSourceMenu<T>(),
dataSourceURLKey: DATA_SOURCE_URL_KEY,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi Huy. Could you help me to understand what does this dataSourceURLKey do and how does it help plugin team?

Copy link
Member Author

Choose a reason for hiding this comment

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

Before, plugins had to manage how they wanted to persist the selected datasource across their pages. Most opted for the datasource to be a part of the url since it makes the page bookmark-able and easier than drilling down props. However, this urlkey &dataSource= is not global, meaning different plugins can have different urlkeys. This PR will expose a common key dataSource for them to consume to increase consistency among plugin urls.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Got it. Thanks for explaining it.

@@ -34,6 +39,7 @@ export interface DataSourceManagementPluginSetup {
ui: {
DataSourceSelector: React.ComponentType<DataSourceSelectorProps>;
getDataSourceMenu: <T>() => React.ComponentType<DataSourceMenuProps<T>>;
dataSourceURLKey: string;
Copy link
Contributor

@wanglam wanglam May 9, 2024

Choose a reason for hiding this comment

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

Nit: Shall we use typeof DATA_SOURCE_URL_KEY here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@huyaboo +1, can we use type instead of exposing it like this?

Copy link
Member

@zhongnansu zhongnansu left a comment

Choose a reason for hiding this comment

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

Nit: do we have developer documentation for plugins/consumers about how to use this key? @huyaboo

Signed-off-by: Huy Nguyen <73027756+huyaboo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export a common URL key for plugins to check for datasource
7 participants