Skip to content

Commit

Permalink
[MDS] Observability Datasource Plugin migration with MDS support (ope…
Browse files Browse the repository at this point in the history
…nsearch-project#7143)

* Observability Datasource Plugin migration with MDS support

Signed-off-by: Ryan Liang <[email protected]>

* Switch to use doc services for doc links of configuration of s3 datasource

Signed-off-by: Ryan Liang <[email protected]>

* Add tests for home panel

Signed-off-by: Ryan Liang <[email protected]>

* Fix the snapshot for mds

Signed-off-by: Ryan Liang <[email protected]>

* Add tests for data source creation panel

Signed-off-by: Ryan Liang <[email protected]>

* Add tests for dq data connection table

Signed-off-by: Ryan Liang <[email protected]>

* Add tests for dq configuration

Signed-off-by: Ryan Liang <[email protected]>

* Add readonly for s3glue doc link

Signed-off-by: Ryan Liang <[email protected]>

* Add tests for s3 prometheus creation and review

Signed-off-by: Ryan Liang <[email protected]>

* Fix mount feature flag behavior and tests

Signed-off-by: Ryan Liang <[email protected]>

* Shorten file names

Signed-off-by: Ryan Liang <[email protected]>

* Shorten file names again

Signed-off-by: Ryan Liang <[email protected]>

* Experiment 1

Signed-off-by: Ryan Liang <[email protected]>

* Fix the visbuilder failure 1

Signed-off-by: Ryan Liang <[email protected]>

* Fix the setter of datasource setup in vis_type_timeseries

Signed-off-by: Ryan Liang <[email protected]>

* Synced branch

Signed-off-by: Ryan Liang <[email protected]>

* Fix the readonly in doc link and add change log

Signed-off-by: Ryan Liang <[email protected]>

* Fix the create opensearch datasource's cancel button redirection

Signed-off-by: Ryan Liang <[email protected]>

* Add more test cases for breadscrumb changes and mount behavior based on the plugin registration

Signed-off-by: Ryan Liang <[email protected]>

---------

Signed-off-by: Ryan Liang <[email protected]>
  • Loading branch information
RyanL1997 authored Jul 1, 2024
1 parent ddf1a41 commit 9ac3184
Show file tree
Hide file tree
Showing 68 changed files with 10,175 additions and 2,291 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/7143.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- [MDS] Observability Datasource Plugin migration with MDS support ([#7143](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7143))
3 changes: 3 additions & 0 deletions src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@ export class DocLinksService {
dataSource: {
// https://opensearch.org/docs/latest/dashboards/discover/multi-data-sources/
guide: `${OPENSEARCH_DASHBOARDS_VERSIONED_DOCS}discover/multi-data-sources/`,
// https://opensearch.org/docs/latest/dashboards/management/S3-data-source/
s3DataSource: `${OPENSEARCH_DASHBOARDS_VERSIONED_DOCS}management/S3-data-source/`,
},
visualize: {
// https://opensearch.org/docs/latest/dashboards/visualize/viz-index/
Expand Down Expand Up @@ -821,6 +823,7 @@ export interface DocLinksStart {
readonly browser: string;
readonly dataSource: {
readonly guide: string;
readonly s3DataSource: string;
};
readonly visualize: Record<string, string>;
readonly management: Record<string, string>;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/plugins/data_source_management/opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "opensearchDashboards",
"server": false,
"ui": true,
"requiredPlugins": ["management", "dataSource", "indexPatternManagement"],
"optionalPlugins": [],
"requiredPlugins": ["management", "indexPatternManagement"],
"optionalPlugins": ["dataSource"],
"requiredBundles": ["opensearchDashboardsReact", "dataSource", "opensearchDashboardsUtils"],
"extraPublicDirs": ["public/components/utils"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { getCreateBreadcrumbs, getEditBreadcrumbs, getListBreadcrumbs } from './breadcrumbs';
import {
getCreateBreadcrumbs,
getEditBreadcrumbs,
getListBreadcrumbs,
getCreateOpenSearchDataSourceBreadcrumbs,
getCreateAmazonS3DataSourceBreadcrumbs,
getCreatePrometheusDataSourceBreadcrumbs,
} from './breadcrumbs';
import { mockDataSourceAttributesWithAuth } from '../mocks';

describe('DataSourceManagement: breadcrumbs.ts', () => {
Expand All @@ -26,4 +33,25 @@ describe('DataSourceManagement: breadcrumbs.ts', () => {
expect(bc[1].text).toBe(mockDataSourceAttributesWithAuth.title);
expect(bc[1].href).toBe(`/${mockDataSourceAttributesWithAuth.id}`);
});

test('get create OpenSearch breadcrumb', () => {
const bc = getCreateOpenSearchDataSourceBreadcrumbs();
expect(bc.length).toBe(3);
expect(bc[2].text).toBe('Open Search');
expect(bc[2].href).toBe('/configure/OpenSearch');
});

test('get create Amazon S3 breadcrumb', () => {
const bc = getCreateAmazonS3DataSourceBreadcrumbs();
expect(bc.length).toBe(3);
expect(bc[2].text).toBe('Amazon S3');
expect(bc[2].href).toBe('/configure/AmazonS3AWSGlue');
});

test('get create Prometheus breadcrumb', () => {
const bc = getCreatePrometheusDataSourceBreadcrumbs();
expect(bc.length).toBe(3);
expect(bc[2].text).toBe('Prometheus');
expect(bc[2].href).toBe('/configure/Prometheus');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,50 @@ export function getCreateBreadcrumbs() {
},
];
}
export function getCreateOpenSearchDataSourceBreadcrumbs() {
return [
...getCreateBreadcrumbs(),
{
text: i18n.translate(
'dataSourcesManagement.dataSources.createOpenSearchDataSourceBreadcrumbs',
{
defaultMessage: 'Open Search',
}
),
href: `/configure/OpenSearch`,
},
];
}

export function getCreateAmazonS3DataSourceBreadcrumbs() {
return [
...getCreateBreadcrumbs(),
{
text: i18n.translate(
'dataSourcesManagement.dataSources.createAmazonS3DataSourceBreadcrumbs',
{
defaultMessage: 'Amazon S3',
}
),
href: `/configure/AmazonS3AWSGlue`,
},
];
}

export function getCreatePrometheusDataSourceBreadcrumbs() {
return [
...getCreateBreadcrumbs(),
{
text: i18n.translate(
'dataSourcesManagement.dataSources.createPrometheusDataSourceBreadcrumbs',
{
defaultMessage: 'Prometheus',
}
),
href: `/configure/Prometheus`,
},
];
}

export function getEditBreadcrumbs(dataSource: DataSourceAttributes) {
return [
Expand Down
27 changes: 27 additions & 0 deletions src/plugins/data_source_management/public/components/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import { i18n } from '@osd/i18n';
import { DataSourceOption } from './data_source_menu/types';
import { DatasourceType } from '../types';

export const LocalCluster: DataSourceOption = {
label: i18n.translate('dataSource.localCluster', {
Expand All @@ -19,3 +20,29 @@ export const NO_COMPATIBLE_DATASOURCES_MESSAGE = 'No compatible data sources are
export const ADD_COMPATIBLE_DATASOURCES_MESSAGE = 'Add a compatible data source.';

export const DEFAULT_DATA_SOURCE_UI_SETTINGS_ID = 'defaultDataSource';

export const OPENSEARCH_DOCUMENTATION_URL =
'https://opensearch.org/docs/latest/dashboards/management/data-sources/';

export const OPENSEARCH_S3_DOCUMENTATION_URL =
'https://opensearch.org/docs/latest/dashboards/management/S3-data-source/';

export const OPENSEARCH_ACC_DOCUMENTATION_URL =
'https://opensearch.org/docs/latest/dashboards/management/accelerate-external-data/';
export const QUERY_RESTRICTED = 'query-restricted';
export const QUERY_ALL = 'query-all';

export const DatasourceTypeToDisplayName: { [key in DatasourceType]: string } = {
PROMETHEUS: 'Prometheus',
S3GLUE: 'Amazon S3',
};

export const PrometheusURL = 'Prometheus';
export const AmazonS3URL = 'AmazonS3AWSGlue';

export const UrlToDatasourceType: { [key: string]: DatasourceType } = {
[PrometheusURL]: 'PROMETHEUS',
[AmazonS3URL]: 'S3GLUE',
};

export type AuthMethod = 'noauth' | 'basicauth' | 'awssigv4';
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('Datasource Management: Create Datasource Wizard', () => {
await component.find(formIdentifier).first().prop('handleCancel')();
});

expect(history.push).toBeCalledWith('');
expect(history.push).toBeCalledWith('/create');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
DataSourceTableItem,
ToastMessageItem,
} from '../../types';
import { getCreateBreadcrumbs } from '../breadcrumbs';
import { getCreateOpenSearchDataSourceBreadcrumbs } from '../breadcrumbs';
import { CreateDataSourceForm } from './components/create_form';
import {
createSingleDataSource,
Expand Down Expand Up @@ -45,7 +45,7 @@ export const CreateDataSourceWizard: React.FunctionComponent<CreateDataSourceWiz

/* Set breadcrumb */
useEffectOnce(() => {
setBreadcrumbs(getCreateBreadcrumbs());
setBreadcrumbs(getCreateOpenSearchDataSourceBreadcrumbs());
getExistingDataSourceNames();
});

Expand Down Expand Up @@ -130,7 +130,7 @@ export const CreateDataSourceWizard: React.FunctionComponent<CreateDataSourceWiz
<CreateDataSourceForm
handleSubmit={handleSubmit}
handleTestConnection={handleTestConnection}
handleCancel={() => props.history.push('')}
handleCancel={() => props.history.push('/create')}
existingDatasourceNamesList={existingDatasourceNamesList}
/>
{isLoading ? <LoadingMask /> : null}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9ac3184

Please sign in to comment.