-
Notifications
You must be signed in to change notification settings - Fork 885
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
[MD] Expose picker using function in data source management plugin setup #6030
Conversation
Signed-off-by: Lu Yu <nluyu@amazon.com>
Signed-off-by: Lu Yu <nluyu@amazon.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6030 +/- ##
=======================================
Coverage 67.13% 67.13%
=======================================
Files 3316 3317 +1
Lines 64015 64016 +1
Branches 10256 10256
=======================================
+ Hits 42975 42977 +2
+ Misses 18547 18546 -1
Partials 2493 2493
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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, thanks for this fix!
return { registerAuthenticationMethod }; | ||
return { | ||
registerAuthenticationMethod, | ||
getDataSourcePicker: createClusterSelector(), |
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.
So if I am understanding correctly, this will expose a function getDataSourcePicker
, that plugins should be able to consume via optionalPlugins
?
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.
Exactly!
@@ -16,7 +16,7 @@ export const LocalCluster: ClusterOption = { | |||
id: '', | |||
}; | |||
|
|||
interface ClusterSelectorProps { | |||
export interface ClusterSelectorProps { |
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.
export interface ClusterSelectorProps { | |
export interface DataSourceSelectorProps { |
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.
Cut another issue to address the naming #6038
@@ -16,7 +16,7 @@ export const LocalCluster: ClusterOption = { | |||
id: '', | |||
}; | |||
|
|||
interface ClusterSelectorProps { | |||
export interface ClusterSelectorProps { | |||
savedObjectsClient: SavedObjectsClientContract; | |||
notifications: ToastsStart; | |||
onSelectedDataSource: (clusterOption: ClusterOption[]) => void; |
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.
onSelectedDataSource: (clusterOption: ClusterOption[]) => void; | |
onSelectedDataSource: (dataSourceOption: DataSourceOption[]) => void; |
@@ -16,7 +16,7 @@ export const LocalCluster: ClusterOption = { | |||
id: '', | |||
}; | |||
|
|||
interface ClusterSelectorProps { | |||
export interface ClusterSelectorProps { | |||
savedObjectsClient: SavedObjectsClientContract; | |||
notifications: ToastsStart; | |||
onSelectedDataSource: (clusterOption: ClusterOption[]) => void; |
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.
onSelectedDataSource: (clusterOption: ClusterOption[]) => void; | |
onSelectedDataSource: (dataSourceOption: DataSourceOption[]) => void; |
@@ -16,7 +16,7 @@ export const LocalCluster: ClusterOption = { | |||
id: '', | |||
}; | |||
|
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.
could we rename this file to DataSourceSelector.tsx
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import { createClusterSelector } from './create_cluster_selector'; |
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.
import { createClusterSelector } from './create_cluster_selector'; | |
import { dataSourceSelector } from './data_source_selector'; |
return { registerAuthenticationMethod }; | ||
return { | ||
registerAuthenticationMethod, | ||
getDataSourcePicker: createClusterSelector(), |
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.
getDataSourcePicker: createClusterSelector(), | |
getDataSourcePicker: createDataSourceSelector(), |
import React from 'react'; | ||
import { ClusterSelector, ClusterSelectorProps } from './cluster_selector'; | ||
|
||
export function createClusterSelector() { |
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.
export function createClusterSelector() { | |
export function createDataSourceSelector() { |
@@ -7,6 +7,7 @@ import { DataSourcePluginSetup } from 'src/plugins/data_source/public'; | |||
import { CoreSetup, CoreStart, Plugin } from '../../../core/public'; | |||
|
|||
import { PLUGIN_NAME } from '../common'; | |||
import { createClusterSelector } from './components/cluster_selector/create_cluster_selector'; |
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.
import { createClusterSelector } from './components/cluster_selector/create_cluster_selector'; | |
import { createDataSourceSelector } from './components/datasource_selector/create_datasource_selector'; |
@@ -17,6 +18,7 @@ import { | |||
AuthenticationMethodRegistery, | |||
} from './auth_registry'; | |||
import { noAuthCredentialAuthMethod, sigV4AuthMethod, usernamePasswordAuthMethod } from './types'; | |||
import { ClusterSelectorProps } from './components/cluster_selector/cluster_selector'; |
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.
import { ClusterSelectorProps } from './components/cluster_selector/cluster_selector'; | |
import { DataSourceSelectorProps } from './components/datasource_selector/datasource_selector'; |
@@ -26,6 +28,7 @@ export interface DataSourceManagementSetupDependencies { | |||
|
|||
export interface DataSourceManagementPluginSetup { | |||
registerAuthenticationMethod: (authMethodValues: AuthenticationMethod) => void; | |||
getDataSourcePicker: React.ComponentType<ClusterSelectorProps>; |
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.
getDataSourcePicker: React.ComponentType<ClusterSelectorProps>; | |
getDataSourcePicker: React.ComponentType<DataSourceSelectorProps>; |
@@ -19,6 +19,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) | |||
- [Discover] Fix table cell content overflowing in Safari ([#5948](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5948)) | |||
- [BUG][MD]Fix schema for test connection to separate validation based on auth type ([#5997](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5997)) | |||
- [Discover] Enable 'Back to Top' Feature in Discover for scrolling to top ([#6008](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6008)) | |||
- [BUG][MD]Expose picker using function in data source management plugin setup([#6030](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6030)) |
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.
- [BUG][MD]Expose picker using function in data source management plugin setup([#6030](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6030)) | |
- [BUG][MD]Expose DataSourceSelector using function in data source management plugin setup([#6030](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6030)) |
@@ -16,7 +16,7 @@ export const LocalCluster: ClusterOption = { | |||
id: '', | |||
}; | |||
|
|||
interface ClusterSelectorProps { | |||
export interface ClusterSelectorProps { | |||
savedObjectsClient: SavedObjectsClientContract; | |||
notifications: ToastsStart; | |||
onSelectedDataSource: (clusterOption: ClusterOption[]) => void; |
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.
onSelectedDataSource: (clusterOption: ClusterOption[]) => void; | |
onSelectedDataSource: (dataSourceOption: DataSourceOption[]) => void; |
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
|
||
describe('create cluster selector', () => { |
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.
describe('create cluster selector', () => { | |
describe('create datasource selector', () => { |
hideLocalCluster: false, | ||
fullWidth: false, | ||
}; | ||
const TestComponent = createClusterSelector(); |
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.
const TestComponent = createClusterSelector(); | |
const TestComponent = createDataSourceSelector(); |
*/ | ||
|
||
import React from 'react'; | ||
import { ClusterSelector, ClusterSelectorProps } from './cluster_selector'; |
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.
import { ClusterSelector, ClusterSelectorProps } from './cluster_selector'; | |
import { DataSourceSelector, DataSourceSelectorProps } from './datasource_selector'; |
import { ClusterSelector, ClusterSelectorProps } from './cluster_selector'; | ||
|
||
export function createClusterSelector() { | ||
return (props: ClusterSelectorProps) => <ClusterSelector {...props} />; |
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.
return (props: ClusterSelectorProps) => <ClusterSelector {...props} />; | |
return (props: DataSourceSelectorProps) => <DataSourceSelector {...props} />; |
…tup (#6030) * expose picker using function in plugin setup Signed-off-by: Lu Yu <nluyu@amazon.com> * add changelog and test Signed-off-by: Lu Yu <nluyu@amazon.com> --------- Signed-off-by: Lu Yu <nluyu@amazon.com> (cherry picked from commit 49d1649) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
…tup (#6030) (#6037) * expose picker using function in plugin setup Signed-off-by: Lu Yu <nluyu@amazon.com> * add changelog and test Signed-off-by: Lu Yu <nluyu@amazon.com> --------- Signed-off-by: Lu Yu <nluyu@amazon.com> (cherry picked from commit 49d1649) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
This change exposes data source picker as a function in the data source management plugin.
Issues Resolved
Fixes #6018
Screenshot
exposepicker.mp4
Testing the changes
The following was performed in the recording above:
node scripts/build_opensearch_dashboards_platform_plugins.js
is successfulyarn build
for alerting plugin is successfulCheck List
yarn test:jest
yarn test:jest_integration