Skip to content

Commit

Permalink
[Multiple Datasource][Version Decoupling] Add data source version and…
Browse files Browse the repository at this point in the history
… installed plugins in MDS data source viewer returns (#7172)

* [Multiple Datasource][Version Decoupling] Add data source version and installed plugins in MDS data source viewer returns

Signed-off-by: Zilong Xia <[email protected]>

* Changeset file for PR #7172 created/updated

---------

Signed-off-by: Zilong Xia <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 901e39f)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 71a791b commit 6264d4a
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 14 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/7172.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- [MDS][Version Decoupling] Add dataSourceVersion' and 'installedPlugins in viewer returns ([#7172](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7172))
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ describe('DataSourceAggregatedView: read all view (displayAllCompatibleDataSourc
// Renders normally
expect(component).toMatchSnapshot();
expect(client.find).toBeCalledWith({
fields: ['id', 'title', 'auth.type'],
fields: ['id', 'title', 'auth.type', 'dataSourceVersion', 'installedPlugins'],
perPage: 10000,
type: 'data-source',
});
Expand Down Expand Up @@ -247,7 +247,7 @@ describe('DataSourceAggregatedView: read active view (displayAllCompatibleDataSo
// Should render normally
expect(component).toMatchSnapshot();
expect(client.find).toBeCalledWith({
fields: ['id', 'title', 'auth.type'],
fields: ['id', 'title', 'auth.type', 'dataSourceVersion', 'installedPlugins'],
perPage: 10000,
type: 'data-source',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,13 @@ export class DataSourceAggregatedView extends React.Component<

async componentDidMount() {
this._isMounted = true;
getDataSourcesWithFields(this.props.savedObjectsClient, ['id', 'title', 'auth.type'])
getDataSourcesWithFields(this.props.savedObjectsClient, [

Check warning on line 100 in src/plugins/data_source_management/public/components/data_source_aggregated_view/data_source_aggregated_view.tsx

View check run for this annotation

Codecov / codecov/patch

src/plugins/data_source_management/public/components/data_source_aggregated_view/data_source_aggregated_view.tsx#L100

Added line #L100 was not covered by tests
'id',
'title',
'auth.type',
'dataSourceVersion',
'installedPlugins',
])
.then((fetchedDataSources) => {
const allDataSourcesIdToTitleMap = new Map();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('create data source menu', () => {
const component = render(<TestComponent {...props} />);
expect(component).toMatchSnapshot();
expect(client.find).toBeCalledWith({
fields: ['id', 'title', 'auth.type'],
fields: ['id', 'title', 'auth.type', 'dataSourceVersion', 'installedPlugins'],
perPage: 10000,
type: 'data-source',
});
Expand Down Expand Up @@ -86,7 +86,7 @@ describe('create data source menu', () => {

expect(component).toMatchSnapshot();
expect(client.find).toBeCalledWith({
fields: ['id', 'title', 'auth.type'],
fields: ['id', 'title', 'auth.type', 'dataSourceVersion', 'installedPlugins'],
perPage: 10000,
type: 'data-source',
});
Expand Down Expand Up @@ -158,7 +158,7 @@ describe('when setMenuMountPoint is provided', () => {
await refresh();
expect(component).toMatchSnapshot();
expect(client.find).toBeCalledWith({
fields: ['id', 'title', 'auth.type'],
fields: ['id', 'title', 'auth.type', 'dataSourceVersion', 'installedPlugins'],
perPage: 10000,
type: 'data-source',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('DataSourceMultiSelectable', () => {
);
expect(component).toMatchSnapshot();
expect(client.find).toBeCalledWith({
fields: ['id', 'title', 'auth.type'],
fields: ['id', 'title', 'auth.type', 'dataSourceVersion', 'installedPlugins'],
perPage: 10000,
type: 'data-source',
});
Expand All @@ -68,7 +68,7 @@ describe('DataSourceMultiSelectable', () => {
);
expect(component).toMatchSnapshot();
expect(client.find).toBeCalledWith({
fields: ['id', 'title', 'auth.type'],
fields: ['id', 'title', 'auth.type', 'dataSourceVersion', 'installedPlugins'],
perPage: 10000,
type: 'data-source',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export class DataSourceMultiSelectable extends React.Component<
'id',
'title',
'auth.type',
'dataSourceVersion',
'installedPlugins',
]);

if (fetchedDataSources?.length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('DataSourceSelectable', () => {
);
expect(component).toMatchSnapshot();
expect(client.find).toBeCalledWith({
fields: ['id', 'title', 'auth.type'],
fields: ['id', 'title', 'auth.type', 'dataSourceVersion', 'installedPlugins'],
perPage: 10000,
type: 'data-source',
});
Expand All @@ -76,7 +76,7 @@ describe('DataSourceSelectable', () => {
);
expect(component).toMatchSnapshot();
expect(client.find).toBeCalledWith({
fields: ['id', 'title', 'auth.type'],
fields: ['id', 'title', 'auth.type', 'dataSourceVersion', 'installedPlugins'],
perPage: 10000,
type: 'data-source',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ export class DataSourceSelectable extends React.Component<
'id',
'title',
'auth.type',
'dataSourceVersion',
'installedPlugins',
]);

const dataSourceOptions: DataSourceOption[] = getFilteredDataSources(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('create data source selector', () => {
const component = render(<TestComponent {...props} />);
expect(component).toMatchSnapshot();
expect(client.find).toBeCalledWith({
fields: ['id', 'title', 'auth.type'],
fields: ['id', 'title', 'auth.type', 'dataSourceVersion', 'installedPlugins'],
perPage: 10000,
type: 'data-source',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('DataSourceSelector', () => {
);
expect(component).toMatchSnapshot();
expect(client.find).toBeCalledWith({
fields: ['id', 'title', 'auth.type'],
fields: ['id', 'title', 'auth.type', 'dataSourceVersion', 'installedPlugins'],
perPage: 10000,
type: 'data-source',
});
Expand All @@ -67,7 +67,7 @@ describe('DataSourceSelector', () => {
);
expect(component).toMatchSnapshot();
expect(client.find).toBeCalledWith({
fields: ['id', 'title', 'auth.type'],
fields: ['id', 'title', 'auth.type', 'dataSourceVersion', 'installedPlugins'],
perPage: 10000,
type: 'data-source',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ export class DataSourceSelector extends React.Component<
'id',
'title',
'auth.type',
'dataSourceVersion',
'installedPlugins',
]);

// 2. Process
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function getDataSources(savedObjectsClient: SavedObjectsClientContr
return savedObjectsClient
.find({
type: 'data-source',
fields: ['id', 'description', 'title'],
fields: ['id', 'description', 'title', 'dataSourceVersion', 'installedPlugins'],
perPage: 10000,
})
.then(
Expand All @@ -52,12 +52,16 @@ export async function getDataSources(savedObjectsClient: SavedObjectsClientContr
const id = source.id;
const title = source.get('title');
const description = source.get('description');
const datasourceversion = source.get('dataSourceVersion');
const installedplugins = source.get('installedPlugins');

Check warning on line 56 in src/plugins/data_source_management/public/components/utils.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/data_source_management/public/components/utils.ts#L55-L56

Added lines #L55 - L56 were not covered by tests

return {
id,
title,
description,
sort: `${title}`,
datasourceversion,
installedplugins,
};
}) || []
);
Expand Down

0 comments on commit 6264d4a

Please sign in to comment.