From 1dc096054c0ce8008635889406c65ee7673a7756 Mon Sep 17 00:00:00 2001
From: Wei Wang
Date: Fri, 23 Aug 2024 16:09:39 -0700
Subject: [PATCH 1/3] Implement new page header for admin data sources page
Signed-off-by: Wei Wang
---
.../opensearch_dashboards.json | 2 +-
.../public/components/breadcrumbs.ts | 12 +-
.../create_form/create_data_source_form.tsx | 34 ++++-
.../components/header/header.tsx | 1 +
.../create_data_source_wizard.tsx | 8 +-
.../create_data_source_panel.tsx | 37 +++++-
.../data_source_home_panel.tsx | 117 +++++++++++++++---
.../data_source_table/data_source_table.tsx | 1 +
.../direct_query_connection_detail.tsx | 20 ++-
.../configure_amazon_s3_data_source.tsx | 90 ++++++++++----
.../configure_direct_query_data_sources.tsx | 101 ++++-----------
.../configure_prometheus_data_source.tsx | 52 +++++---
.../query_permissions.tsx | 2 +-
.../edit_form/edit_data_source_form.tsx | 50 +++++---
.../components/header/header.tsx | 42 ++++++-
.../edit_data_source/edit_data_source.tsx | 5 +
.../mount_management_section.tsx | 23 +++-
.../data_source_management/public/types.ts | 2 +
18 files changed, 413 insertions(+), 186 deletions(-)
diff --git a/src/plugins/data_source_management/opensearch_dashboards.json b/src/plugins/data_source_management/opensearch_dashboards.json
index fb37a16eea0f..86f5d0b5d11f 100644
--- a/src/plugins/data_source_management/opensearch_dashboards.json
+++ b/src/plugins/data_source_management/opensearch_dashboards.json
@@ -3,7 +3,7 @@
"version": "opensearchDashboards",
"server": true,
"ui": true,
- "requiredPlugins": ["management", "indexPatternManagement"],
+ "requiredPlugins": ["navigation", "management", "indexPatternManagement"],
"optionalPlugins": ["dataSource"],
"requiredBundles": ["opensearchDashboardsReact", "dataSource", "opensearchDashboardsUtils"],
"extraPublicDirs": ["public/components/utils"],
diff --git a/src/plugins/data_source_management/public/components/breadcrumbs.ts b/src/plugins/data_source_management/public/components/breadcrumbs.ts
index e1ac30bddb88..0980e931d5fb 100644
--- a/src/plugins/data_source_management/public/components/breadcrumbs.ts
+++ b/src/plugins/data_source_management/public/components/breadcrumbs.ts
@@ -28,14 +28,14 @@ export function getCreateBreadcrumbs() {
},
];
}
-export function getCreateOpenSearchDataSourceBreadcrumbs() {
+export function getCreateOpenSearchDataSourceBreadcrumbs(useNewUX: boolean) {
return [
...getCreateBreadcrumbs(),
{
text: i18n.translate(
'dataSourcesManagement.dataSources.createOpenSearchDataSourceBreadcrumbs',
{
- defaultMessage: 'Open Search',
+ defaultMessage: useNewUX ? 'Connect OpenSearch Cluster' : 'Open Search',
}
),
href: `/configure/OpenSearch`,
@@ -43,14 +43,14 @@ export function getCreateOpenSearchDataSourceBreadcrumbs() {
];
}
-export function getCreateAmazonS3DataSourceBreadcrumbs() {
+export function getCreateAmazonS3DataSourceBreadcrumbs(useNewUX: boolean) {
return [
...getCreateBreadcrumbs(),
{
text: i18n.translate(
'dataSourcesManagement.dataSources.createAmazonS3DataSourceBreadcrumbs',
{
- defaultMessage: 'Amazon S3',
+ defaultMessage: useNewUX ? 'Connect Amazon S3' : 'Amazon S3',
}
),
href: `/configure/AmazonS3AWSGlue`,
@@ -58,14 +58,14 @@ export function getCreateAmazonS3DataSourceBreadcrumbs() {
];
}
-export function getCreatePrometheusDataSourceBreadcrumbs() {
+export function getCreatePrometheusDataSourceBreadcrumbs(useNewUX: boolean) {
return [
...getCreateBreadcrumbs(),
{
text: i18n.translate(
'dataSourcesManagement.dataSources.createPrometheusDataSourceBreadcrumbs',
{
- defaultMessage: 'Prometheus',
+ defaultMessage: useNewUX ? 'Connect Prometheus' : 'Prometheus',
}
),
href: `/configure/Prometheus`,
diff --git a/src/plugins/data_source_management/public/components/create_data_source_wizard/components/create_form/create_data_source_form.tsx b/src/plugins/data_source_management/public/components/create_data_source_wizard/components/create_form/create_data_source_form.tsx
index 7fec74bdc0f9..fabb4a7a1a82 100644
--- a/src/plugins/data_source_management/public/components/create_data_source_wizard/components/create_form/create_data_source_form.tsx
+++ b/src/plugins/data_source_management/public/components/create_data_source_wizard/components/create_form/create_data_source_form.tsx
@@ -23,6 +23,8 @@ import {
} from '@elastic/eui';
import { i18n } from '@osd/i18n';
import { FormattedMessage } from '@osd/i18n/react';
+import { NavigationPublicPluginStart } from 'src/plugins/navigation/public';
+import { ApplicationStart } from 'opensearch-dashboards/public';
import { AuthenticationMethodRegistry } from '../../../../auth_registry';
import { SigV4Content, SigV4ServiceName } from '../../../../../../data_source/common/data_sources';
import {
@@ -47,6 +49,9 @@ import {
} from '../../../utils';
export interface CreateDataSourceProps {
+ useNewUX: boolean;
+ navigation: NavigationPublicPluginStart;
+ application: ApplicationStart;
existingDatasourceNamesList: string[];
handleSubmit: (formValues: DataSourceAttributes) => void;
handleTestConnection: (formValues: DataSourceAttributes) => void;
@@ -367,21 +372,41 @@ export class CreateDataSourceForm extends React.Component<
return null;
};
+ description = [
+ {
+ renderComponent: (
+
+
+
+ ),
+ },
+ ];
+
/* Render methods */
/* Render header*/
renderHeader = () => {
- return ;
+ return this.props.useNewUX ? (
+
+ ) : (
+
+ );
};
/* Render Section header*/
renderSectionHeader = (i18nId: string, defaultMessage: string) => {
return (
<>
-
-
+
+
-
+
>
);
@@ -554,7 +579,6 @@ export class CreateDataSourceForm extends React.Component<
<>
{this.renderHeader()}
-
{/* Endpoint section */}
{this.renderSectionHeader(
diff --git a/src/plugins/data_source_management/public/components/create_data_source_wizard/components/header/header.tsx b/src/plugins/data_source_management/public/components/create_data_source_wizard/components/header/header.tsx
index 75eda9af9809..c6caa900b436 100644
--- a/src/plugins/data_source_management/public/components/create_data_source_wizard/components/header/header.tsx
+++ b/src/plugins/data_source_management/public/components/create_data_source_wizard/components/header/header.tsx
@@ -45,6 +45,7 @@ export const Header = () => {
+
diff --git a/src/plugins/data_source_management/public/components/create_data_source_wizard/create_data_source_wizard.tsx b/src/plugins/data_source_management/public/components/create_data_source_wizard/create_data_source_wizard.tsx
index 0be281a20a38..e589d4fee72a 100644
--- a/src/plugins/data_source_management/public/components/create_data_source_wizard/create_data_source_wizard.tsx
+++ b/src/plugins/data_source_management/public/components/create_data_source_wizard/create_data_source_wizard.tsx
@@ -37,15 +37,18 @@ export const CreateDataSourceWizard: React.FunctionComponent().services;
/* State Variables */
const [existingDatasourceNamesList, setExistingDatasourceNamesList] = useState([]);
const [isLoading, setIsLoading] = useState(false);
+ const useNewUX = uiSettings.get('home:useNewHomePage');
/* Set breadcrumb */
useEffectOnce(() => {
- setBreadcrumbs(getCreateOpenSearchDataSourceBreadcrumbs());
+ setBreadcrumbs(getCreateOpenSearchDataSourceBreadcrumbs(useNewUX));
getExistingDataSourceNames();
});
@@ -128,6 +131,9 @@ export const CreateDataSourceWizard: React.FunctionComponent
props.history.push('/create')}
diff --git a/src/plugins/data_source_management/public/components/data_source_creation_panel/create_data_source_panel.tsx b/src/plugins/data_source_management/public/components/data_source_creation_panel/create_data_source_panel.tsx
index 7e6761d51254..8228c82e4ca1 100644
--- a/src/plugins/data_source_management/public/components/data_source_creation_panel/create_data_source_panel.tsx
+++ b/src/plugins/data_source_management/public/components/data_source_creation_panel/create_data_source_panel.tsx
@@ -3,9 +3,10 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import { EuiFlexGroup, EuiFlexItem, EuiPageHeader, EuiPanel } from '@elastic/eui';
+import { EuiFlexGroup, EuiFlexItem, EuiPageHeader, EuiPanel, EuiText } from '@elastic/eui';
import React, { useEffect } from 'react';
import { RouteComponentProps } from 'react-router-dom';
+import { FormattedMessage } from '@osd/i18n/react';
import { CreateDataSourcePanelHeader } from './create_data_source_panel_header';
import { CreateDataSourceCardView } from './create_data_source_card_view';
import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public';
@@ -14,24 +15,56 @@ import { DataSourceManagementContext } from '../../types';
interface CreateDataSourcePanelProps extends RouteComponentProps {
featureFlagStatus: boolean;
+ useNewUX: boolean;
}
export const CreateDataSourcePanel: React.FC = ({
featureFlagStatus,
+ useNewUX,
...props
}) => {
const {
chrome,
+ application,
setBreadcrumbs,
notifications: { toasts },
uiSettings,
+ navigation,
} = useOpenSearchDashboards().services;
useEffect(() => {
setBreadcrumbs(getCreateBreadcrumbs());
}, [setBreadcrumbs]);
- return (
+ const { HeaderControl } = navigation.ui;
+ const description = [
+ {
+ renderComponent: (
+
+
+
+ ),
+ },
+ ];
+
+ return useNewUX ? (
+ <>
+
+
+
+
+
+
+
+
+ >
+ ) : (
diff --git a/src/plugins/data_source_management/public/components/data_source_home_panel/data_source_home_panel.tsx b/src/plugins/data_source_management/public/components/data_source_home_panel/data_source_home_panel.tsx
index 3291885a8b60..3f3d88077ab5 100644
--- a/src/plugins/data_source_management/public/components/data_source_home_panel/data_source_home_panel.tsx
+++ b/src/plugins/data_source_management/public/components/data_source_home_panel/data_source_home_panel.tsx
@@ -13,7 +13,12 @@ import {
EuiTab,
EuiPageHeader,
EuiPanel,
+ EuiButtonGroup,
+ EuiText,
+ EuiLink,
} from '@elastic/eui';
+import { TopNavControlButtonData, TopNavControlComponentData } from 'src/plugins/navigation/public';
+import { FormattedMessage } from '@osd/i18n/react';
import { DataSourceHeader } from './data_source_page_header';
import { DataSourceTableWithRouter } from '../data_source_table/data_source_table';
import { ManageDirectQueryDataConnectionsTable } from '../direct_query_data_sources_components/direct_query_data_connection/manage_direct_query_data_connections_table';
@@ -24,10 +29,12 @@ import { DataSourceManagementContext } from '../../types';
interface DataSourceHomePanelProps extends RouteComponentProps {
featureFlagStatus: boolean;
+ useNewUX: boolean;
}
export const DataSourceHomePanel: React.FC = ({
featureFlagStatus,
+ useNewUX,
...props
}) => {
const {
@@ -37,6 +44,8 @@ export const DataSourceHomePanel: React.FC = ({
savedObjects,
uiSettings,
application,
+ docLinks,
+ navigation,
} = useOpenSearchDashboards().services;
const defaultTabId = featureFlagStatus
@@ -44,6 +53,7 @@ export const DataSourceHomePanel: React.FC = ({
: 'manageDirectQueryDataSources';
const [selectedTabId, setSelectedTabId] = useState(defaultTabId);
const canManageDataSource = !!application.capabilities?.dataSource?.canManage;
+ const { HeaderControl } = navigation.ui;
useEffect(() => {
setBreadcrumbs(getListBreadcrumbs());
@@ -53,6 +63,55 @@ export const DataSourceHomePanel: React.FC = ({
setSelectedTabId(id);
};
+ const description = [
+ {
+ renderComponent: (
+
+
+
+ Learn more
+
+
+ ),
+ },
+ ];
+
+ const createDataSourceButton = [
+ {
+ id: 'Create data source',
+ label: 'Create data source connection',
+ testId: 'createDataSourceButton',
+ run: () => props.history.push('/create'),
+ fill: true,
+ iconType: 'plus',
+ controlType: 'button',
+ } as TopNavControlButtonData,
+ ];
+
+ const connectionTypeButton = [
+ {
+ renderComponent: (
+ onSelectedTabChanged(id)}
+ />
+ ),
+ } as TopNavControlComponentData,
+ ];
+
const tabs = [
...(featureFlagStatus
? [
@@ -82,25 +141,47 @@ export const DataSourceHomePanel: React.FC = ({
return (
+ {useNewUX && (
+ <>
+
+ {canManageDataSource && (
+
+ )}
+
+ >
+ )}
-
-
-
-
-
-
- {canManageDataSource ? (
-
-
-
- ) : null}
-
-
-
-
-
- {renderTabs()}
-
+ {!useNewUX && (
+ <>
+
+
+
+
+
+
+ {canManageDataSource ? (
+
+
+
+ ) : null}
+
+
+
+
+
+ {renderTabs()}
+
+ >
+ )}
{selectedTabId === 'manageOpensearchDataSources' && featureFlagStatus && (
diff --git a/src/plugins/data_source_management/public/components/data_source_table/data_source_table.tsx b/src/plugins/data_source_management/public/components/data_source_table/data_source_table.tsx
index bc75e5a17ad3..d2efbf3441f2 100644
--- a/src/plugins/data_source_management/public/components/data_source_table/data_source_table.tsx
+++ b/src/plugins/data_source_management/public/components/data_source_table/data_source_table.tsx
@@ -122,6 +122,7 @@ export const DataSourceTable = ({ history }: RouteComponentProps) => {
const search = {
toolsRight: renderToolsRight(),
+ compressed: true,
box: {
incremental: true,
schema: {
diff --git a/src/plugins/data_source_management/public/components/direct_query_data_sources_components/connection_detail/direct_query_connection_detail.tsx b/src/plugins/data_source_management/public/components/direct_query_data_sources_components/connection_detail/direct_query_connection_detail.tsx
index 5746454e946d..aad3db2260c9 100644
--- a/src/plugins/data_source_management/public/components/direct_query_data_sources_components/connection_detail/direct_query_connection_detail.tsx
+++ b/src/plugins/data_source_management/public/components/direct_query_data_sources_components/connection_detail/direct_query_connection_detail.tsx
@@ -19,13 +19,7 @@ import {
EuiCard,
EuiAccordion,
} from '@elastic/eui';
-import {
- ApplicationStart,
- HttpStart,
- IUiSettingsClient,
- NotificationsStart,
- SavedObjectsStart,
-} from 'opensearch-dashboards/public';
+import { ApplicationStart, HttpStart, NotificationsStart } from 'opensearch-dashboards/public';
import { useLocation, useParams } from 'react-router-dom';
import { escapeRegExp } from 'lodash';
import { DATACONNECTIONS_BASE } from '../../../constants';
@@ -60,6 +54,7 @@ interface DirectQueryDataConnectionDetailProps {
notifications: NotificationsStart;
application: ApplicationStart;
setBreadcrumbs: (breadcrumbs: any) => void;
+ useNewUX: boolean;
}
export const DirectQueryDataConnectionDetail: React.FC = ({
@@ -68,6 +63,7 @@ export const DirectQueryDataConnectionDetail: React.FC {
const [observabilityDashboardsExists, setObservabilityDashboardsExists] = useState(false);
const { dataSourceName } = useParams<{ dataSourceName: string }>();
@@ -427,15 +423,17 @@ export const DirectQueryDataConnectionDetail: React.FC
+
-
- {datasourceDetails.name}
-
+ {!useNewUX && (
+
+ {datasourceDetails.name}
+
+ )}
diff --git a/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_source_configuration/amazon_s3/configure_amazon_s3_data_source.tsx b/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_source_configuration/amazon_s3/configure_amazon_s3_data_source.tsx
index 7eeeda357304..38bbca779815 100644
--- a/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_source_configuration/amazon_s3/configure_amazon_s3_data_source.tsx
+++ b/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_source_configuration/amazon_s3/configure_amazon_s3_data_source.tsx
@@ -7,7 +7,6 @@ import React, { useState } from 'react';
import { RouteComponentProps, withRouter } from 'react-router-dom';
import {
EuiPanel,
- EuiTitle,
EuiSpacer,
EuiText,
EuiLink,
@@ -17,6 +16,9 @@ import {
EuiCompressedSelect,
EuiCallOut,
} from '@elastic/eui';
+import { NavigationPublicPluginStart } from 'src/plugins/navigation/public';
+import { ApplicationStart } from 'opensearch-dashboards/public';
+import { FormattedMessage } from '@osd/i18n/react';
import { useOpenSearchDashboards } from '../../../../../../opensearch_dashboards_react/public';
import { AuthMethod } from '../../../constants';
import { QueryPermissionsConfiguration } from '../query_permissions';
@@ -25,6 +27,9 @@ import { AuthDetails } from '../direct_query_data_source_auth_details';
import { NameRow } from '../name_row';
interface ConfigureS3DatasourceProps extends RouteComponentProps {
+ useNewUX: boolean;
+ navigation: NavigationPublicPluginStart;
+ application: ApplicationStart;
roles: Role[];
selectedQueryPermissionRoles?: Role[];
setSelectedQueryPermissionRoles: React.Dispatch>;
@@ -49,6 +54,9 @@ interface ConfigureS3DatasourceProps extends RouteComponentProps {
export const ConfigureS3DatasourcePanel: React.FC = (props) => {
const {
+ useNewUX,
+ navigation,
+ application,
setNameForRequest,
setDetailsForRequest,
setArnForRequest,
@@ -83,29 +91,67 @@ export const ConfigureS3DatasourcePanel: React.FC =
{ value: 'noauth', text: 'No authentication' },
];
+ const description = [
+ {
+ renderComponent: (
+
+
+ {docLinks && (
+
+ Learn more
+
+ )}
+
+ ),
+ },
+ ];
+
+ const callOut = (
+
+
+ {`Make sure you connected to Amazon S3 via AWS Glue Data Catalog with Amazon EMR as an execution engine. `}
+ {docLinks && (
+
+ Learn more
+
+ )}
+
+
+ );
+
return (
+ {!useNewUX && {`Configure Amazon S3 data source`}
}
+ {useNewUX ? (
+ <>
+
+
+ >
+ ) : (
+ <>
+
+ {callOut}
+ >
+ )}
- {`Configure Amazon S3 data source`}
-
-
-
-
- {`Connect to Amazon S3 via AWS Glue Data Catalog with Amazon EMR as an execution engine. `}
- {docLinks && (
-
- Learn more
-
- )}
-
-
-
-
Data source details
@@ -129,7 +175,7 @@ export const ConfigureS3DatasourcePanel: React.FC =
-
+
AWS Glue Data Catalog authentication details
@@ -171,7 +217,7 @@ export const ConfigureS3DatasourcePanel: React.FC =
-
+
AWS Glue Data Catalog index store details
diff --git a/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_source_configuration/configure_direct_query_data_sources.tsx b/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_source_configuration/configure_direct_query_data_sources.tsx
index 11201fe9d538..a45e853de2d9 100644
--- a/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_source_configuration/configure_direct_query_data_sources.tsx
+++ b/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_source_configuration/configure_direct_query_data_sources.tsx
@@ -8,19 +8,15 @@ import {
EuiFlexItem,
EuiPage,
EuiPageBody,
- EuiSpacer,
- EuiSteps,
- EuiPageSideBar,
EuiBottomBar,
EuiButtonEmpty,
EuiButton,
+ EuiSpacer,
} from '@elastic/eui';
import React, { useEffect, useState, useCallback } from 'react';
import { RouteComponentProps, useParams, withRouter } from 'react-router-dom';
import { ConfigureS3DatasourcePanel } from './amazon_s3/configure_amazon_s3_data_source';
import { ConfigurePrometheusDatasourcePanel } from './prometheus/configure_prometheus_data_source';
-import { ReviewS3Datasource } from './amazon_s3/review_amazon_s3_data_source';
-import { ReviewPrometheusDatasource } from './prometheus/review_prometheus_data_source';
import { useOpenSearchDashboards } from '../../../../../opensearch_dashboards_react/public';
import { DataSourceManagementContext, DirectQueryDatasourceType, Role } from '../../../types';
import { DatasourceTypeToDisplayName, UrlToDatasourceType } from '../../../constants';
@@ -35,10 +31,12 @@ import { DATACONNECTIONS_BASE } from '../../../constants';
interface ConfigureDatasourceProps extends RouteComponentProps {
notifications: NotificationsStart;
+ useNewUX: boolean;
}
export const DirectQueryDataSourceConfigure: React.FC = ({
notifications,
+ useNewUX,
history,
}) => {
const { type: urlType } = useParams<{ type: string }>();
@@ -47,6 +45,8 @@ export const DirectQueryDataSourceConfigure: React.FC
setBreadcrumbs,
notifications: { toasts },
http,
+ navigation,
+ application,
} = useOpenSearchDashboards().services;
const [error, setError] = useState('');
@@ -63,17 +63,7 @@ export const DirectQueryDataSourceConfigure: React.FC
const [roles, setRoles] = useState([]);
const [hasSecurityAccess, setHasSecurityAccess] = useState(true);
const [selectedQueryPermissionRoles, setSelectedQueryPermissionRoles] = useState([]);
- const [page, setPage] = useState<'configure' | 'review'>('configure');
const type = UrlToDatasourceType[urlType];
- const ConfigureDatasourceSteps = [
- {
- title: 'Configure data source',
- status: page === 'review' ? 'complete' : undefined,
- },
- {
- title: 'Review configuration',
- },
- ];
const formatError = (errorName: string, errorMessage: string, errorDetails: string) => {
return {
@@ -159,7 +149,6 @@ export const DirectQueryDataSourceConfigure: React.FC
notifications.toasts.addError(formattedError, {
title: 'Could not create data source',
});
- setPage('configure');
});
}, [
authMethod,
@@ -196,16 +185,16 @@ export const DirectQueryDataSourceConfigure: React.FC
let breadcrumbs;
switch (urlType) {
case 'AmazonS3AWSGlue':
- breadcrumbs = getCreateAmazonS3DataSourceBreadcrumbs();
+ breadcrumbs = getCreateAmazonS3DataSourceBreadcrumbs(useNewUX);
break;
case 'Prometheus':
- breadcrumbs = getCreatePrometheusDataSourceBreadcrumbs();
+ breadcrumbs = getCreatePrometheusDataSourceBreadcrumbs(useNewUX);
break;
default:
breadcrumbs = getCreateBreadcrumbs();
}
setBreadcrumbs(breadcrumbs);
- }, [urlType, setBreadcrumbs, http]);
+ }, [urlType, setBreadcrumbs, http, useNewUX]);
const ConfigureDatasource = (configurationProps: {
datasourceType: DirectQueryDatasourceType;
@@ -215,6 +204,9 @@ export const DirectQueryDataSourceConfigure: React.FC
case 'S3GLUE':
return (
case 'PROMETHEUS':
return (
}
};
- const ReviewDatasourceConfiguration = (configurationProps: { datasourceType: string }) => {
- const { datasourceType } = configurationProps;
- switch (datasourceType) {
- case 'S3GLUE':
- return (
- setPage('configure')}
- />
- );
- case 'PROMETHEUS':
- return (
- setPage('configure')}
- />
- );
- default:
- return <>>;
- }
- };
-
const ReviewSaveOrCancel = useCallback(() => {
return (
@@ -324,44 +286,25 @@ export const DirectQueryDataSourceConfigure: React.FC
setPage('configure')}
- color="ghost"
- size="s"
- iconType="arrowLeft"
- data-test-subj="previousButton"
- >
- Previous
-
-
-
- (page === 'review' ? createDatasource() : setPage('review'))}
+ onClick={() => createDatasource()}
size="s"
- iconType="arrowRight"
+ iconType="check"
+ color="secondary"
fill
- data-test-subj="nextButton"
+ data-test-subj="createButton"
>
- {page === 'configure'
- ? `Review Configuration`
- : `Connect to ${DatasourceTypeToDisplayName[type]}`}
+ {`Connect to ${DatasourceTypeToDisplayName[type]}`}
);
- }, [page, history, createDatasource, type]);
+ }, [history, createDatasource, type]);
return (
-
-
-
-
+
- {page === 'configure' ? (
-
- ) : (
-
- )}
+
diff --git a/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_source_configuration/prometheus/configure_prometheus_data_source.tsx b/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_source_configuration/prometheus/configure_prometheus_data_source.tsx
index 3d1b02bb60ac..74b425dffdc7 100644
--- a/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_source_configuration/prometheus/configure_prometheus_data_source.tsx
+++ b/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_source_configuration/prometheus/configure_prometheus_data_source.tsx
@@ -12,10 +12,12 @@ import {
EuiCompressedFieldText,
EuiCompressedTextArea,
EuiCompressedSelect,
- EuiCompressedFieldPassword,
EuiForm,
} from '@elastic/eui';
import React, { useState } from 'react';
+import { NavigationPublicPluginStart } from 'src/plugins/navigation/public';
+import { ApplicationStart } from 'opensearch-dashboards/public';
+import { FormattedMessage } from '@osd/i18n/react';
import { AuthMethod, OPENSEARCH_DOCUMENTATION_URL } from '../../../constants';
import { QueryPermissionsConfiguration } from '../query_permissions';
import { Role } from '../../../../types';
@@ -23,6 +25,9 @@ import { AuthDetails } from '../direct_query_data_source_auth_details';
import { NameRow } from '../name_row';
interface ConfigurePrometheusDatasourceProps {
+ useNewUX: boolean;
+ navigation: NavigationPublicPluginStart;
+ application: ApplicationStart;
roles: Role[];
selectedQueryPermissionRoles: Role[];
setSelectedQueryPermissionRoles: React.Dispatch>;
@@ -51,6 +56,9 @@ interface ConfigurePrometheusDatasourceProps {
export const ConfigurePrometheusDatasourcePanel = (props: ConfigurePrometheusDatasourceProps) => {
const {
+ useNewUX,
+ navigation,
+ application,
setNameForRequest,
setDetailsForRequest,
setStoreForRequest,
@@ -84,22 +92,36 @@ export const ConfigurePrometheusDatasourcePanel = (props: ConfigurePrometheusDat
{ value: 'awssigv4', text: 'AWS Signature Version 4' },
];
+ const description = (
+
+
+
+ Learn more
+
+
+ );
+
return (
-
- {`Configure Prometheus data source`}
-
-
-
- {`Connect to Prometheus with OpenSearch and OpenSearch Dashboards. `}
-
- Learn more
-
-
-
+ {!useNewUX && {`Configure Prometheus data source`}
}
+ {useNewUX ? (
+
+ ) : (
+ <>
+
+ {description}
+
+ >
+ )}
-
+
Data source details
@@ -124,7 +146,7 @@ export const ConfigurePrometheusDatasourcePanel = (props: ConfigurePrometheusDat
-
+
Prometheus data location
@@ -149,7 +171,7 @@ export const ConfigurePrometheusDatasourcePanel = (props: ConfigurePrometheusDat
-
+
Authentication details
diff --git a/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_source_configuration/query_permissions.tsx b/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_source_configuration/query_permissions.tsx
index 26570bae318b..69748897f466 100644
--- a/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_source_configuration/query_permissions.tsx
+++ b/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_source_configuration/query_permissions.tsx
@@ -70,7 +70,7 @@ export const QueryPermissionsConfiguration = (props: PermissionsConfigurationPro
-
+
Query permissions
diff --git a/src/plugins/data_source_management/public/components/edit_data_source/components/edit_form/edit_data_source_form.tsx b/src/plugins/data_source_management/public/components/edit_data_source/components/edit_form/edit_data_source_form.tsx
index 48e40dbfd88f..37dcb27c114f 100644
--- a/src/plugins/data_source_management/public/components/edit_data_source/components/edit_form/edit_data_source_form.tsx
+++ b/src/plugins/data_source_management/public/components/edit_data_source/components/edit_form/edit_data_source_form.tsx
@@ -26,6 +26,8 @@ import {
import { i18n } from '@osd/i18n';
import { FormattedMessage } from '@osd/i18n/react';
import deepEqual from 'fast-deep-equal';
+import { ApplicationStart } from 'opensearch-dashboards/public';
+import { NavigationPublicPluginStart } from 'src/plugins/navigation/public';
import { AuthenticationMethodRegistry } from '../../../../auth_registry';
import { SigV4Content, SigV4ServiceName } from '../../../../../../data_source/common/data_sources';
import { Header } from '../header';
@@ -49,6 +51,9 @@ import { UpdateAwsCredentialModal } from '../update_aws_credential_modal';
import { extractRegisteredAuthTypeCredentials, getDefaultAuthMethod } from '../../../utils';
export interface EditDataSourceProps {
+ navigation: NavigationPublicPluginStart;
+ application: ApplicationStart;
+ useNewUX: boolean;
existingDataSource: DataSourceAttributes;
existingDatasourceNamesList: string[];
isDefault: boolean;
@@ -643,6 +648,9 @@ export class EditDataSourceForm extends React.Component {
return (
{
return (
-
+
{
- {
-
- }
-
+
+
+ {
+
+ }
+
+
}
description={
@@ -763,7 +773,7 @@ export class EditDataSourceForm extends React.Component {
return (
-
+
{
{
return (
-
+
{
- {
-
- }
-
+
+
+ {
+
+ }
+
+
}
>
{this.renderCredentialsSection()}
diff --git a/src/plugins/data_source_management/public/components/edit_data_source/components/header/header.tsx b/src/plugins/data_source_management/public/components/edit_data_source/components/header/header.tsx
index 3e76ab838f9d..6775c659e6c1 100644
--- a/src/plugins/data_source_management/public/components/edit_data_source/components/header/header.tsx
+++ b/src/plugins/data_source_management/public/components/edit_data_source/components/header/header.tsx
@@ -18,10 +18,18 @@ import {
} from '@elastic/eui';
import { i18n } from '@osd/i18n';
import { FormattedMessage } from '@osd/i18n/react';
+import {
+ NavigationPublicPluginStart,
+ TopNavControlComponentData,
+} from 'src/plugins/navigation/public';
+import { ApplicationStart } from 'opensearch-dashboards/public';
import { useOpenSearchDashboards } from '../../../../../../opensearch_dashboards_react/public';
import { DataSourceManagementContext } from '../../../../types';
export const Header = ({
+ navigation,
+ application,
+ useNewUX,
showDeleteIcon,
isFormValid,
onClickDeleteIcon,
@@ -31,6 +39,9 @@ export const Header = ({
isDefault,
canManageDataSource,
}: {
+ navigation: NavigationPublicPluginStart;
+ application: ApplicationStart;
+ useNewUX: boolean;
showDeleteIcon: boolean;
isFormValid: boolean;
onClickDeleteIcon: () => void;
@@ -67,6 +78,7 @@ export const Header = ({
iconType={isDefaultDataSourceState ? 'starFilled' : 'starEmpty'}
aria-label={setDefaultAriaLabel}
data-test-subj="editSetDefaultDataSource"
+ iconSize="s"
>
{isDefaultDataSourceState ? 'Default' : 'Set as default'}
@@ -88,14 +100,13 @@ export const Header = ({
setIsDeleteModalVisible(true);
}}
iconType="trash"
- iconSize="m"
- size="m"
aria-label={i18n.translate(
'dataSourcesManagement.editDataSource.deleteThisDataSource',
{
defaultMessage: 'Delete this Data Source',
}
)}
+ iconSize="s"
/>
@@ -154,6 +165,7 @@ export const Header = ({
onClickTestConnection();
}}
data-test-subj="datasource-edit-testConnectionButton"
+ iconSize="s"
>
+
+ {/* Test default button */}
+ {renderDefaultIcon()}
+ {/* Test connection button */}
+ {renderTestConnectionButton()}
+ {/* Delete icon button */}
+ {canManageDataSource ? (
+ {showDeleteIcon ? renderDeleteButton() : null}
+ ) : null}
+
+
+ ),
+ } as TopNavControlComponentData,
+ ];
+
+ return useNewUX ? (
+
+ ) : (
{/* Title */}
diff --git a/src/plugins/data_source_management/public/components/edit_data_source/edit_data_source.tsx b/src/plugins/data_source_management/public/components/edit_data_source/edit_data_source.tsx
index fbf63aaecb0d..5163506c9e3a 100644
--- a/src/plugins/data_source_management/public/components/edit_data_source/edit_data_source.tsx
+++ b/src/plugins/data_source_management/public/components/edit_data_source/edit_data_source.tsx
@@ -47,6 +47,7 @@ export const EditDataSource: React.FunctionComponent().services;
const dataSourceID: string = props.match.params.id;
@@ -54,6 +55,7 @@ export const EditDataSource: React.FunctionComponent(defaultDataSource);
const [existingDatasourceNamesList, setExistingDatasourceNamesList] = useState([]);
const [isLoading, setIsLoading] = useState(false);
+ const useNewUX = uiSettings.get('home:useNewHomePage');
/* Fetch data source by id*/
useEffectOnce(() => {
@@ -155,6 +157,9 @@ export const EditDataSource: React.FunctionComponent
{dataSource && dataSource.endpoint ? (
@@ -62,11 +67,16 @@ export async function mountManagementSection(
notifications={notifications}
setBreadcrumbs={params.setBreadcrumbs}
application={application}
+ useNewUX={useNewUX}
/>
{canManageDataSource && (
-
+
)}
{featureFlagStatus && canManageDataSource && (
@@ -76,7 +86,10 @@ export async function mountManagementSection(
)}
{canManageDataSource && (
-
+
)}
{featureFlagStatus && (
@@ -85,7 +98,11 @@ export async function mountManagementSection(
)}
-
+
diff --git a/src/plugins/data_source_management/public/types.ts b/src/plugins/data_source_management/public/types.ts
index d09591147001..dc3c54505acc 100644
--- a/src/plugins/data_source_management/public/types.ts
+++ b/src/plugins/data_source_management/public/types.ts
@@ -16,6 +16,7 @@ import {
import { ManagementAppMountParams } from 'src/plugins/management/public';
import { i18n } from '@osd/i18n';
import { EuiComboBoxOptionOption } from '@elastic/eui';
+import { NavigationPublicPluginStart } from 'src/plugins/navigation/public';
import { AuthType } from '../../data_source/common/data_sources';
import { SigV4ServiceName } from '../../data_source/common/data_sources';
import { OpenSearchDashboardsReactContextValue } from '../../opensearch_dashboards_react/public';
@@ -33,6 +34,7 @@ export interface DataSourceManagementContext {
overlays: OverlayStart;
http: HttpSetup;
docLinks: DocLinksStart;
+ navigation: NavigationPublicPluginStart;
setBreadcrumbs: ManagementAppMountParams['setBreadcrumbs'];
authenticationMethodRegistry: AuthenticationMethodRegistry;
}
From 96fcf3977966419dfe539fd0e9f2d98f05ad6cad Mon Sep 17 00:00:00 2001
From: Wei Wang
Date: Mon, 26 Aug 2024 16:23:48 -0700
Subject: [PATCH 2/3] update unit tests for page header change
Signed-off-by: Wei Wang
---
.../create_data_source_panel.test.tsx | 3 +-
.../data_source_home_panel.test.tsx | 12 ++++-
.../data_source_table.test.tsx.snap | 28 ++++------
...figure_amazon_s3_data_source.test.tsx.snap | 27 ++++++----
...igure_prometheus_data_source.test.tsx.snap | 52 ++++++++++---------
.../edit_data_source.test.tsx | 7 ++-
.../mount_management_section.test.tsx | 24 ++++++++-
7 files changed, 98 insertions(+), 55 deletions(-)
diff --git a/src/plugins/data_source_management/public/components/data_source_creation_panel/create_data_source_panel.test.tsx b/src/plugins/data_source_management/public/components/data_source_creation_panel/create_data_source_panel.test.tsx
index 5884dadc5876..235446ffbfea 100644
--- a/src/plugins/data_source_management/public/components/data_source_creation_panel/create_data_source_panel.test.tsx
+++ b/src/plugins/data_source_management/public/components/data_source_creation_panel/create_data_source_panel.test.tsx
@@ -10,8 +10,8 @@ import { CreateDataSourcePanelHeader } from './create_data_source_panel_header';
import { CreateDataSourceCardView } from './create_data_source_card_view';
import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public';
import { getCreateBreadcrumbs } from '../breadcrumbs';
-import { DataSourceManagementContext } from '../../types';
import { RouteComponentProps } from 'react-router-dom';
+import { navigationPluginMock } from 'src/plugins/navigation/public/mocks';
jest.mock('../../../../opensearch_dashboards_react/public');
jest.mock('../breadcrumbs');
@@ -34,6 +34,7 @@ describe('CreateDataSourcePanel', () => {
},
},
uiSettings: {},
+ navigation: navigationPluginMock.createStartContract(),
},
};
diff --git a/src/plugins/data_source_management/public/components/data_source_home_panel/data_source_home_panel.test.tsx b/src/plugins/data_source_management/public/components/data_source_home_panel/data_source_home_panel.test.tsx
index 1f451b1531e9..aab2971ae7eb 100644
--- a/src/plugins/data_source_management/public/components/data_source_home_panel/data_source_home_panel.test.tsx
+++ b/src/plugins/data_source_management/public/components/data_source_home_panel/data_source_home_panel.test.tsx
@@ -10,9 +10,9 @@ import { EuiTab } from '@elastic/eui';
import { DataSourceHomePanel } from './data_source_home_panel';
import { DataSourceTableWithRouter } from '../data_source_table/data_source_table';
import { ManageDirectQueryDataConnectionsTable } from '../direct_query_data_sources_components/direct_query_data_connection/manage_direct_query_data_connections_table';
-import { CreateButton } from '../create_button';
import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public';
import { getListBreadcrumbs } from '../breadcrumbs';
+import { navigationPluginMock } from 'src/plugins/navigation/public/mocks';
jest.mock('../../../../opensearch_dashboards_react/public');
jest.mock('../breadcrumbs');
@@ -42,6 +42,16 @@ describe('DataSourceHomePanel', () => {
savedObjects: {},
uiSettings: {},
application: { capabilities: { dataSource: { canManage: true } } },
+ docLinks: {
+ links: {
+ opensearchDashboards: {
+ dataSource: {
+ guide: 'https://opensearch.org/docs/latest/dashboards/discover/multi-data-sources/',
+ },
+ },
+ },
+ },
+ navigation: navigationPluginMock.createStartContract(),
},
};
diff --git a/src/plugins/data_source_management/public/components/data_source_table/__snapshots__/data_source_table.test.tsx.snap b/src/plugins/data_source_management/public/components/data_source_table/__snapshots__/data_source_table.test.tsx.snap
index 3f12831b546b..770b2ab00efa 100644
--- a/src/plugins/data_source_management/public/components/data_source_table/__snapshots__/data_source_table.test.tsx.snap
+++ b/src/plugins/data_source_management/public/components/data_source_table/__snapshots__/data_source_table.test.tsx.snap
@@ -140,7 +140,6 @@ exports[`DataSourceTable should get datasources failed should render empty table
>
@@ -416,6 +416,7 @@ exports[`DataSourceTable should get datasources successful should render normall
},
}
}
+ compressed={true}
onChange={[Function]}
toolsRight={
@@ -236,14 +236,17 @@ exports[`ConfigureS3DatasourcePanel renders correctly 1`] = `
+
-
+
Data source details
@@ -448,9 +451,11 @@ exports[`ConfigureS3DatasourcePanel renders correctly 1`] = `
className="euiSpacer euiSpacer--l"
/>
-
+
AWS Glue Data Catalog authentication details
@@ -645,9 +650,11 @@ exports[`ConfigureS3DatasourcePanel renders correctly 1`] = `
className="euiSpacer euiSpacer--l"
/>
-
+
AWS Glue Data Catalog index store details
@@ -1199,9 +1206,11 @@ exports[`ConfigureS3DatasourcePanel renders correctly 1`] = `
-
+
Query permissions
diff --git a/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_source_configuration/prometheus/__snapshots__/configure_prometheus_data_source.test.tsx.snap b/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_source_configuration/prometheus/__snapshots__/configure_prometheus_data_source.test.tsx.snap
index 2032dacce601..7cf177579596 100644
--- a/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_source_configuration/prometheus/__snapshots__/configure_prometheus_data_source.test.tsx.snap
+++ b/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_source_configuration/prometheus/__snapshots__/configure_prometheus_data_source.test.tsx.snap
@@ -106,17 +106,25 @@ exports[`ConfigurePrometheusDatasourcePanel renders correctly 1`] = `
@@ -161,9 +157,11 @@ exports[`ConfigurePrometheusDatasourcePanel renders correctly 1`] = `