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

[Backport 2.x] [Multiple Datasource][Version Decoupling] Add data source version and installed plugins in MDS data source viewer returns #7184

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@

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 @@
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 @@
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
Loading