Skip to content

Commit

Permalink
version decoupling support for MDS (#407) (#409)
Browse files Browse the repository at this point in the history
Signed-off-by: sumukhswamy <[email protected]>
  • Loading branch information
sumukhswamy authored Jul 19, 2024
1 parent 2a5ac06 commit 5154e7a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
6 changes: 2 additions & 4 deletions opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"requiredPlugins": [
"navigation"
],
"optionalPlugins": [
"dataSource",
"dataSourceManagement"
]
"optionalPlugins": ["dataSource","dataSourceManagement"],
"supportedOSDataSourceVersions": ">=2.8.0"
}
14 changes: 13 additions & 1 deletion public/components/query_compare/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 {
Expand Down Expand Up @@ -142,6 +145,14 @@ export const Home = ({
if(dataSourceEnabled){
DataSourceMenu = dataSourceManagement.ui.getDataSourceMenu<DataSourceAggregatedViewConfig>();
}

const dataSourceFilterFn = (dataSource: SavedObject<DataSourceAttributes>) => {
const dataSourceVersion = dataSource?.attributes?.dataSourceVersion || "";
return (
semver.satisfies(dataSourceVersion, pluginManifest.supportedOSDataSourceVersions)
);
};

// Get Indexes and Pipelines
useEffect(() => {

Expand All @@ -162,6 +173,7 @@ export const Home = ({
notifications: notifications,
fullWidth: true,
displayAllCompatibleDataSources: true,
dataSourceFilterFn: dataSourceFilterFn
}}
/>
);
Expand Down

0 comments on commit 5154e7a

Please sign in to comment.