Skip to content

Conversation

@Qxisylolo
Copy link
Contributor

@Qxisylolo Qxisylolo commented May 30, 2025

Description

this pr supports scope in data source selector.

Screenshot

  1. in a workspace, open dev tools
2025-05-30.16.09.47.mov
  1. in a workspace, visit alert
截屏2025-05-30 16 13 15
  1. out of a workspace, visit dev tools
2025-05-30.16.13.48.mov
  1. in a workspace, visit sample data
截屏2025-08-05 11 55 18
  1. in a workspace, visit notebook
截屏2025-08-05 12 15 04

Testing the changes

Changelog

  • feat: support scope in data source selector

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

opensearch-changeset-bot bot added a commit to Qxisylolo/OpenSearch-Dashboards that referenced this pull request May 30, 2025
@Qxisylolo Qxisylolo force-pushed the feat/support_scope_in_ds_selector branch from c1a6097 to 79bbb9f Compare May 30, 2025 08:20
opensearch-changeset-bot bot added a commit to Qxisylolo/OpenSearch-Dashboards that referenced this pull request May 30, 2025
@codecov
Copy link

codecov bot commented May 30, 2025

Codecov Report

❌ Patch coverage is 75.00000% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.71%. Comparing base (958df3f) to head (d311955).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...c/components/data_source_menu/data_source_menu.tsx 85.71% 0 Missing and 1 partial ⚠️
...ents/data_source_selector/data_source_selector.tsx 66.66% 0 Missing and 1 partial ⚠️
...c/components/drop_down_header/drop_down_header.tsx 50.00% 0 Missing and 1 partial ⚠️
...rc/plugins/data_source_management/public/plugin.ts 50.00% 1 Missing ⚠️
src/plugins/dev_tools/public/application.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9832   +/-   ##
=======================================
  Coverage   61.70%   61.71%           
=======================================
  Files        4227     4227           
  Lines      107599   107607    +8     
  Branches    17474    17477    +3     
=======================================
+ Hits        66399    66406    +7     
+ Misses      36746    36745    -1     
- Partials     4454     4456    +2     
Flag Coverage Δ
Linux_1 27.68% <5.26%> (-0.01%) ⬇️
Linux_2 41.16% <ø> (ø)
Linux_3 39.54% <75.00%> (?)
Linux_4 32.73% <26.31%> (+<0.01%) ⬆️
Windows_1 27.69% <5.26%> (-0.01%) ⬇️
Windows_2 41.13% <ø> (ø)
Windows_3 39.55% <75.00%> (+<0.01%) ⬆️
Windows_4 32.73% <26.31%> (+<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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Qxisylolo Qxisylolo force-pushed the feat/support_scope_in_ds_selector branch from c27cc59 to 568386c Compare June 6, 2025 05:58
@Qxisylolo Qxisylolo requested a review from raintygao as a code owner June 6, 2025 05:58
onSelectedDataSource: (dataSourceOption: DataSourceOption[]) => void;
disabled: boolean;
fullWidth: boolean;
getWorkspaces: () => WorkspacesStart;
Copy link
Contributor

@yubonluo yubonluo Jun 10, 2025

Choose a reason for hiding this comment

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

Why getWorkspaces was added into this Props, I think we just used it in this component, could we just use getWorkspace function directly and do not need to update src/plugins/data_source_management/public/components/data_source_selector/create_data_source_selector.tsx.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, updated, thanks

import { DataSourceItem } from '../data_source_item';
import './data_source_selector.scss';
import { DataSourceOption } from '../data_source_menu/types';
import { getWorkspaces } from '../utils';
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: you can add getWorkspaces at line 23.

) {
const { hideLocalCluster } = dataSourcePluginSetup;
return (props: DataSourceSelectorProps) => (
return (props: Omit<DataSourceSelectorProps, 'getWorkspaces'>) => (
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: do not need to use Omit and delete 'getWorkspaces'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated, thanks~

Qxisylolo and others added 8 commits August 4, 2025 11:05
Signed-off-by: Qxisylolo <qianxisy@amazon.com>
Signed-off-by: Qxisylolo <qianxisy@amazon.com>
Signed-off-by: Qxisylolo <qianxisy@amazon.com>
Signed-off-by: Qxisylolo <qianxisy@amazon.com>
Signed-off-by: Qxisylolo <qianxisy@amazon.com>
Signed-off-by: Qxisylolo <qianxisy@amazon.com>
@Qxisylolo Qxisylolo force-pushed the feat/support_scope_in_ds_selector branch from d5da686 to b3b47d9 Compare August 4, 2025 05:02
@Qxisylolo Qxisylolo requested a review from ps48 as a code owner August 4, 2025 05:02
savedObjects: client,
notifications,
},
scope: UiSettingScope.WORKSPACE,
Copy link
Member

Choose a reason for hiding this comment

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

Shall we use Global as default scope?

},
scope: UiSettingScope.WORKSPACE,
uiSettings,
hideLocalCluster: false,
Copy link
Member

Choose a reason for hiding this comment

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

We should keep hideLocalCluster: true.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh sorry. I paste the wrong line. updated

hideLocalCluster,
application,
onManageDataSource,
scope,
Copy link
Member

Choose a reason for hiding this comment

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

For other plugins that have integrated with MDS, they do not need to manually pass scope right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes.

disabled={false}
hideLocalCluster={false}
fullWidth={false}
scope={UiSettingScope.WORKSPACE}
Copy link
Member

Choose a reason for hiding this comment

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

Workspace is still a feature that requires feature flag, shall we make it GLOBAL?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

Signed-off-by: Qxisylolo <qianxisy@amazon.com>
Signed-off-by: Qxisylolo <qianxisy@amazon.com>
@Qxisylolo Qxisylolo force-pushed the feat/support_scope_in_ds_selector branch from b562667 to 2a83031 Compare August 5, 2025 03:55
Copy link
Member

@SuZhou-Joe SuZhou-Joe left a comment

Choose a reason for hiding this comment

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

Thanks for the comprehensive change.

@SuZhou-Joe SuZhou-Joe merged commit b475eec into opensearch-project:main Aug 5, 2025
82 of 83 checks passed
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.

6 participants