Skip to content

Commit

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

Signed-off-by: sumukhswamy <[email protected]>

* linter changes

Signed-off-by: sumukhswamy <[email protected]>

* updated manifest file

Signed-off-by: sumukhswamy <[email protected]>

* updated lowest version to 1

Signed-off-by: sumukhswamy <[email protected]>

---------

Signed-off-by: sumukhswamy <[email protected]>
  • Loading branch information
sumukhswamy authored Jul 18, 2024
1 parent 7a8616e commit 9aa33d7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
2 changes: 2 additions & 0 deletions opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"opensearchDashboardsVersion": "3.0.0",
"server": true,
"ui": true,
"supportedOSDataSourceVersions": ">=1.0.0",
"requiredOSDataSourcePlugins": ["opensearch-sql"],
"requiredPlugins": ["navigation", "opensearchDashboardsReact", "opensearchDashboardsUtils"],
"optionalPlugins": ["observabilityDashboards", "dataSource", "dataSourceManagement"]
}
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 9aa33d7

Please sign in to comment.