diff --git a/opensearch_dashboards.json b/opensearch_dashboards.json index 5d4c604..03fdcf1 100644 --- a/opensearch_dashboards.json +++ b/opensearch_dashboards.json @@ -7,8 +7,6 @@ "requiredPlugins": [ "navigation" ], - "optionalPlugins": [ - "dataSource", - "dataSourceManagement" - ] + "optionalPlugins": ["dataSource","dataSourceManagement"], + "supportedOSDataSourceVersions": ">=2.8.0" } \ No newline at end of file diff --git a/public/components/query_compare/home.tsx b/public/components/query_compare/home.tsx index f202703..3bf0ee5 100644 --- a/public/components/query_compare/home.tsx +++ b/public/components/query_compare/home.tsx @@ -4,7 +4,7 @@ */ import React, { useEffect, useMemo, useState } from 'react'; -import { ChromeBreadcrumb, CoreStart, MountPoint, NotificationsStart } from '../../../../../src/core/public'; +import { ChromeBreadcrumb, CoreStart, MountPoint, NotificationsStart, SavedObject } from '../../../../../src/core/public'; import { DataSourceAggregatedViewConfig, DataSourceManagementPluginSetup } from '../../../../../src/plugins/data_source_management/public'; import { NavigationPublicPluginStart } from '../../../../../src/plugins/navigation/public'; import { QUERY_NUMBER_ONE, QUERY_NUMBER_TWO, ServiceEndpoints } from '../../../common'; @@ -15,7 +15,10 @@ import { Flyout } from '../common/flyout'; import { CreateIndex } from './create_index'; import { SearchResult } from './search_result'; +import semver from "semver"; +import { DataSourceAttributes } from '../../../../../src/plugins/data_source/common/data_sources'; import { DataSourceMenuProps, DataSourceOption } from '../../../../../src/plugins/data_source_management/public/components/data_source_menu/types'; +import * as pluginManifest from "../../../opensearch_dashboards.json"; import './home.scss'; interface QueryExplorerProps { @@ -142,6 +145,14 @@ export const Home = ({ if(dataSourceEnabled){ DataSourceMenu = dataSourceManagement.ui.getDataSourceMenu(); } + + const dataSourceFilterFn = (dataSource: SavedObject) => { + const dataSourceVersion = dataSource?.attributes?.dataSourceVersion || ""; + return ( + semver.satisfies(dataSourceVersion, pluginManifest.supportedOSDataSourceVersions) + ); + }; + // Get Indexes and Pipelines useEffect(() => { @@ -162,6 +173,7 @@ export const Home = ({ notifications: notifications, fullWidth: true, displayAllCompatibleDataSources: true, + dataSourceFilterFn: dataSourceFilterFn }} /> );