Skip to content

Commit

Permalink
added version decoupling for neo MDS support (#353) (#354)
Browse files Browse the repository at this point in the history
* added version decoupling for neo MDS suypport



* linter changes



* updated manifest file



* updated lowest version to 1



---------

Signed-off-by: sumukhswamy <sumukhhs@amazon.com>
  • Loading branch information
sumukhswamy committed Jul 18, 2024
1 parent cfd9161 commit f29f587
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
4 changes: 3 additions & 1 deletion opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@
"observabilityDashboards",
"dataSource",
"dataSourceManagement"
]
],
"supportedOSDataSourceVersions": ">=1.0.0",
"requiredOSDataSourcePlugins": ["opensearch-sql"]
}
32 changes: 25 additions & 7 deletions public/components/Main/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@ import { IHttpResponse } from 'angular';
import { createBrowserHistory } from 'history';
import _ from 'lodash';
import React from 'react';
import semver from 'semver';
import {
ChromeBreadcrumb,
CoreStart,
MountPoint,
NotificationsStart,
SavedObject,
SavedObjectsStart,
} from '../../../../../src/core/public';
import { DataSourceAttributes } from '../../../../../src/plugins/data_source/common/data_sources';
import {
DataSourceManagementPluginSetup,
DataSourceSelectableConfig,
Expand All @@ -38,6 +41,7 @@ import { OPENSEARCH_SQL_INIT_QUERY } from '../../../common/constants';
import { AsyncApiResponse, AsyncQueryStatus } from '../../../common/types';
import { executeAsyncQuery } from '../../../common/utils/async_query_helpers';
import { fetchDataSources } from '../../../common/utils/fetch_datasources';
import * as pluginManifest from '../../../opensearch_dashboards.json';
import { MESSAGE_TAB_LABEL } from '../../utils/constants';
import {
Tree,
Expand Down Expand Up @@ -288,7 +292,7 @@ export class Main extends React.Component<MainProps, MainState> {
dataSourceOptions: [],
selectedMDSDataConnectionId: '',
mdsClusterName: '',
flintDataConnections: false
flintDataConnections: false,
};
this.httpClient = this.props.httpClient;
this.updateSQLQueries = _.debounce(this.updateSQLQueries, 250).bind(this);
Expand Down Expand Up @@ -900,11 +904,22 @@ export class Main extends React.Component<MainProps, MainState> {
mdsClusterName: clusterName,
cluster: 'Indexes',
selectedDatasource: [{ label: 'OpenSearch', key: '' }],
isAccelerationFlyoutOpened: false
isAccelerationFlyoutOpened: false,
});
this.fetchFlintDataSources();
};

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

DataSourceMenu = this.props.dataSourceManagement?.ui?.getDataSourceMenu<
DataSourceSelectableConfig
>();
Expand Down Expand Up @@ -1014,22 +1029,25 @@ export class Main extends React.Component<MainProps, MainState> {
notifications: this.props.notifications,
fullWidth: true,
onSelectedDataSources: this.onSelectedDataSource,
dataSourceFilter: this.dataSourceFilterFn,
}}
/>
)}
<EuiPage paddingSize="none">
<EuiPanel grow={true} style={{marginRight: '10px'}}>
<EuiPanel grow={true} style={{ marginRight: '10px' }}>
<EuiPageSideBar
style={{
maxWidth: '400px',
width: '400px',
height: 'calc(100vh - 254px)',
}}
>
<EuiTitle size='xs'>
<p><b>{this.state.mdsClusterName}</b></p>
</EuiTitle>
<EuiSpacer size='s'/>
<EuiTitle size="xs">
<p>
<b>{this.state.mdsClusterName}</b>
</p>
</EuiTitle>
<EuiSpacer size="s" />
{this.state.flintDataConnections && (
<EuiFlexGroup direction="row" gutterSize="s">
<EuiFlexItem grow={false}>
Expand Down

0 comments on commit f29f587

Please sign in to comment.