Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added version decoupling for neo MDS support #353

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": ">=0.7.0",
sumukhswamy marked this conversation as resolved.
Show resolved Hide resolved
"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 { 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 { 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 All @@ -57,8 +61,8 @@

interface ResponseData {
ok: boolean;
resp: any;

Check warning on line 64 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
body: any;

Check warning on line 65 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
}

export interface ResponseDetail<T> {
Expand All @@ -68,11 +72,11 @@
}

export interface TranslateResult {
[key: string]: any;

Check warning on line 75 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
}

export interface QueryMessage {
text: any;

Check warning on line 79 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
className: string;
}

Expand All @@ -92,13 +96,13 @@
[key: string]: {
nodes: Tree;
expandedRow?: {};
selectedNodes?: { [key: string]: any };

Check warning on line 99 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
};
}

export interface DataRow {
rowId: number;
data: { [key: string]: any };

Check warning on line 105 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
}

interface MainProps {
Expand Down Expand Up @@ -146,7 +150,7 @@
}

const SUCCESS_MESSAGE = 'Success';
const errorQueryResponse = (queryResultResponseDetail: any) => {

Check warning on line 153 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const errorMessage =
queryResultResponseDetail.errorMessage +
', this query is not runnable. \n \n' +
Expand Down Expand Up @@ -174,7 +178,7 @@
const dataRows: DataRow[] = [];

const schema: object[] = _.get(responseObj, 'schema');
const datarows: any[][] = _.get(responseObj, 'datarows');

Check warning on line 181 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
let queryType = 'default';

for (const column of schema.values()) {
Expand All @@ -199,7 +203,7 @@
}

for (const [id, field] of datarows.entries()) {
const row: { [key: string]: any } = {};

Check warning on line 206 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
row.TABLE_NAME = field[index];
const dataRow: DataRow = {
rowId: id,
Expand All @@ -212,7 +216,7 @@
case 'describe':
case 'default':
for (const [id, field] of schema.entries()) {
let alias: any = null;

Check warning on line 219 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
try {
alias = _.get(field, 'alias');
} catch (e) {
Expand Down Expand Up @@ -288,7 +292,7 @@
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 @@
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 @@
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
Loading