From c85826143241a71d9ee081dba7d0ebb69d246821 Mon Sep 17 00:00:00 2001 From: sumukhswamy Date: Wed, 17 Jul 2024 14:56:10 -0700 Subject: [PATCH] version decoupling support for MDS Signed-off-by: sumukhswamy --- opensearch_dashboards.json | 3 ++- public/components/query_compare/home.tsx | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/opensearch_dashboards.json b/opensearch_dashboards.json index 8dcc712..36fb434 100644 --- a/opensearch_dashboards.json +++ b/opensearch_dashboards.json @@ -7,5 +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 }} /> );