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..f2eb7778e8e7 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( @@ -749,7 +773,7 @@ export class CreateDataSourceForm extends React.Component< > 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.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_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/__snapshots__/data_source_home_panel.test.tsx.snap b/src/plugins/data_source_management/public/components/data_source_home_panel/__snapshots__/data_source_home_panel.test.tsx.snap index e4144646e0b0..cda3acc64031 100644 --- a/src/plugins/data_source_management/public/components/data_source_home_panel/__snapshots__/data_source_home_panel.test.tsx.snap +++ b/src/plugins/data_source_management/public/components/data_source_home_panel/__snapshots__/data_source_home_panel.test.tsx.snap @@ -61,9 +61,6 @@ exports[`DataSourceHomePanel renders correctly 1`] = ` - { 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_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..dfb3fc0ae188 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,56 @@ 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,27 +142,48 @@ export const DataSourceHomePanel: React.FC = ({ return ( + {useNewUX && ( + <> + + {canManageDataSource && ( + + )} + + + )} + {!useNewUX && ( + <> + + + + + + + {canManageDataSource ? ( + + + + ) : null} + + + + + + {renderTabs()} + + + )} - - - - - - {canManageDataSource ? ( - - - - ) : null} - - - - - - {renderTabs()} - - - {selectedTabId === 'manageOpensearchDataSources' && featureFlagStatus && ( )} 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..9dc785b13b4e 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 @@ -369,6 +369,7 @@ exports[`DataSourceTable should get datasources successful should render normall }, }, }, + "compressed": true, "toolsRight": @@ -416,6 +417,7 @@ exports[`DataSourceTable should get datasources successful should render normall }, } } + compressed={true} onChange={[Function]} toolsRight={
@@ -504,7 +507,7 @@ exports[`DataSourceTable should get datasources successful should render normall className="euiFormControlLayoutIcons" >