diff --git a/common/utils/shared.ts b/common/utils/shared.ts index d85aab000..d8b919a4a 100644 --- a/common/utils/shared.ts +++ b/common/utils/shared.ts @@ -3,6 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ +import semver from 'semver'; +import { SavedObject } from '../../../../src/core/public'; +import { DataSourceAttributes } from '../../../../src/plugins/data_source/common/data_sources'; +import * as pluginManifest from '../../opensearch_dashboards.json'; import { coreRefs } from '../../public/framework/core_refs'; /** @@ -62,3 +66,12 @@ export const basePathLink = (link: string): string => { return link; } }; + +export const dataSourceFilterFn = (dataSource: SavedObject) => { + const dataSourceVersion = dataSource?.attributes?.dataSourceVersion || ''; + const installedPlugins = dataSource?.attributes?.installedPlugins || []; + return ( + semver.satisfies(dataSourceVersion, pluginManifest.supportedOSDataSourceVersions) && + pluginManifest.requiredOSDataSourcePlugins.every((plugin) => installedPlugins.includes(plugin)) + ); +}; diff --git a/opensearch_dashboards.json b/opensearch_dashboards.json index 8ec5d0402..1527bd898 100644 --- a/opensearch_dashboards.json +++ b/opensearch_dashboards.json @@ -27,5 +27,8 @@ ], "configPath": [ "observability" - ] + ], + "supportedOSDataSourceVersions": ">=2.9.0", + "requiredOSDataSourcePlugins": ["opensearch-sql","opensearch-observability"] + } \ No newline at end of file diff --git a/public/components/custom_panels/__tests__/__snapshots__/custom_panel_view.test.tsx.snap b/public/components/custom_panels/__tests__/__snapshots__/custom_panel_view.test.tsx.snap index 6bb678ffe..e21d4d876 100644 --- a/public/components/custom_panels/__tests__/__snapshots__/custom_panel_view.test.tsx.snap +++ b/public/components/custom_panels/__tests__/__snapshots__/custom_panel_view.test.tsx.snap @@ -303,7 +303,7 @@ exports[`Panels View Component render panel view container and refresh panel 1`] class="euiToolTipAnchor" >