Skip to content

Commit

Permalink
added version decoupling for neo MDS suypport
Browse files Browse the repository at this point in the history
Signed-off-by: sumukhswamy <sumukhhs@amazon.com>
  • Loading branch information
sumukhswamy committed Jul 17, 2024
1 parent 2bb8eb0 commit 9a55970
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"opensearchDashboardsVersion": "3.0.0",
"server": true,
"ui": true,
"supportedOSDataSourceVersions": ">=0.7.0",
"requiredOSDataSourcePlugins": ["opensearch-sql","opensearch-observability"],
"requiredPlugins": ["navigation", "opensearchDashboardsReact", "opensearchDashboardsUtils"],
"optionalPlugins": ["observabilityDashboards", "dataSource", "dataSourceManagement"]
}
14 changes: 14 additions & 0 deletions public/components/Main/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@ import { IHttpResponse } from 'angular';
import { createBrowserHistory } from 'history';
import _ from 'lodash';
import React from 'react';
import semver from "semver";

Check failure on line 25 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Replace `"semver"` with `'semver'`
import {
ChromeBreadcrumb,
CoreStart,
MountPoint,
NotificationsStart,
SavedObject,
SavedObjectsStart,
} from '../../../../../src/core/public';
import { DataSourceAttributes } from '../../../../../src/plugins/data_source/common/data_sources';
import {
DataSourceManagementPluginSetup,
DataSourceSelectableConfig,
Expand All @@ -38,6 +41,7 @@ import { OPENSEARCH_SQL_INIT_QUERY } from '../../../common/constants';
import { AsyncApiResponse, AsyncQueryStatus } from '../../../common/types';
import { executeAsyncQuery } from '../../../common/utils/async_query_helpers';
import { fetchDataSources } from '../../../common/utils/fetch_datasources';
import * as pluginManifest from "../../../opensearch_dashboards.json";

Check failure on line 44 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Replace `"../../../opensearch_dashboards.json"` with `'../../../opensearch_dashboards.json'`
import { MESSAGE_TAB_LABEL } from '../../utils/constants';
import {
Tree,
Expand Down Expand Up @@ -905,6 +909,15 @@ export class Main extends React.Component<MainProps, MainState> {
this.fetchFlintDataSources();
};

dataSourceFilterFn = (dataSource: SavedObject<DataSourceAttributes>) => {
const dataSourceVersion = dataSource?.attributes?.dataSourceVersion || "";

Check failure on line 913 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Replace `""` with `''`
const installedPlugins = dataSource?.attributes?.installedPlugins || [];
return (
semver.satisfies(dataSourceVersion, pluginManifest.supportedOSDataSourceVersions) &&
pluginManifest.requiredOSDataSourcePlugins.every((plugin) => installedPlugins.includes(plugin))

Check failure on line 917 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Replace `·installedPlugins.includes(plugin)` with `⏎········installedPlugins.includes(plugin)⏎······`
);
};

DataSourceMenu = this.props.dataSourceManagement?.ui?.getDataSourceMenu<
DataSourceSelectableConfig
>();
Expand Down Expand Up @@ -1014,6 +1027,7 @@ export class Main extends React.Component<MainProps, MainState> {
notifications: this.props.notifications,
fullWidth: true,
onSelectedDataSources: this.onSelectedDataSource,
dataSourceFilter: this.dataSourceFilterFn

Check failure on line 1030 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Insert `,`
}}
/>
)}
Expand Down

0 comments on commit 9a55970

Please sign in to comment.