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

[Backport 2.x][MDS] Observability Datasource Plugin migration with MDS support for Data Connection Table #7371

Merged
merged 4 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all 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 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))
2 changes: 2 additions & 0 deletions changelogs/fragments/7163.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- [MDS] Fix the dsm plugin setup when mds feature flag is disabled ([#7163](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7163))
2 changes: 2 additions & 0 deletions changelogs/fragments/7371.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- [MDS] Observability Datasource Plugin migration with MDS support for Data Connection Table ([#7371](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7371))
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.

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
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 { DEFAULT_DATA_SOURCE_UI_SETTINGS_ID } from '../../common';

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.

Loading
Loading