Skip to content

Commit

Permalink
Plugin Version decoupling for MDS support (opensearch-project#1003)
Browse files Browse the repository at this point in the history
* support for version decoupling

Signed-off-by: Riya Saxena <[email protected]>

* alerting version support

Signed-off-by: Riya Saxena <[email protected]>

---------

Signed-off-by: Riya Saxena <[email protected]>
(cherry picked from commit 6500ea5)
  • Loading branch information
riysaxen-amzn committed Jul 18, 2024
1 parent 6a5cc77 commit 0685af5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 4 additions & 2 deletions opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@
"opensearchDashboardsUtils"
],
"server": true,
"ui": true
}
"ui": true,
"supportedOSDataSourceVersions": ">=2.13.0",
"requiredOSDataSourcePlugins": ["opensearch-alerting"]
}
12 changes: 12 additions & 0 deletions public/pages/Main/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import {
} from '../../../public/services';
import { MultiDataSourceContext } from '../../../public/utils/MultiDataSourceContext';
import { parseQueryStringAndGetDataSource } from '../utils/helpers';
import * as pluginManifest from "../../../opensearch_dashboards.json";
import semver from "semver";

class Main extends Component {
static contextType = CoreContext;
Expand Down Expand Up @@ -101,6 +103,15 @@ class Main extends Component {
}
};

dataSourceFilterFn = (dataSource) => {
const dataSourceVersion = dataSource?.attributes?.dataSourceVersion || "";
const installedPlugins = dataSource?.attributes?.installedPlugins || [];
return (
semver.satisfies(dataSourceVersion, pluginManifest.supportedOSDataSourceVersions) &&
pluginManifest.requiredOSDataSourcePlugins.every((plugin) => installedPlugins.includes(plugin))
);
};

renderDataSourceComponent(dataSourceType) {
const { setActionMenu } = this.props;
const componentConfig = {
Expand All @@ -110,6 +121,7 @@ class Main extends Component {
: [{ id: this.state.selectedDataSourceId }],
savedObjects: getSavedObjectsClient(),
notifications: getNotifications(),
dataSourceFilter: this.dataSourceFilterFn,
};
if (dataSourceType === 'DataSourceSelectable') {
componentConfig.onSelectedDataSources = this.handleDataSourceChange;
Expand Down

0 comments on commit 0685af5

Please sign in to comment.