Skip to content

Commit

Permalink
[Backport 2.x][MDS] Observability Datasource Plugin migration with MD…
Browse files Browse the repository at this point in the history
…S support for Data Connection Table (#7371)

* [MDS] Observability Datasource Plugin migration with MDS support (#7143)

* Observability Datasource Plugin migration with MDS support

Signed-off-by: Ryan Liang <jiallian@amazon.com>

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

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* Add tests for home panel

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* Fix the snapshot for mds

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* Add tests for data source creation panel

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* Add tests for dq data connection table

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* Add tests for dq configuration

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* Add readonly for s3glue doc link

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* Add tests for s3 prometheus creation and review

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* Fix mount feature flag behavior and tests

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* Shorten file names

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* Shorten file names again

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* Experiment 1

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* Fix the visbuilder failure 1

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* Fix the setter of datasource setup in vis_type_timeseries

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* Synced branch

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* Fix the readonly in doc link and add change log

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* Fix the create opensearch datasource's cancel button redirection

Signed-off-by: Ryan Liang <jiallian@amazon.com>

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

Signed-off-by: Ryan Liang <jiallian@amazon.com>

---------

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* [MDS] Fix the dsm plugin setup when mds feature flag is disabled (#7163)

* Fix the dsm plugin setup when mds feature flag is disabled

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* Changeset file for PR #7163 created/updated

---------

Signed-off-by: Ryan Liang <jiallian@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>

* Changeset file for PR #7371 created/updated

* Fix snapshots

Signed-off-by: Ryan Liang <jiallian@amazon.com>

---------

Signed-off-by: Ryan Liang <jiallian@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 704f2fa)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent d59e3ea commit 9eb1896
Show file tree
Hide file tree
Showing 71 changed files with 10,331 additions and 3,522 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))
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.

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 { 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

0 comments on commit 9eb1896

Please sign in to comment.