From 0f9c8ad900bae8c8a27ecd2f586ab82006352fd8 Mon Sep 17 00:00:00 2001 From: tygao Date: Thu, 29 Aug 2024 17:08:15 +0800 Subject: [PATCH] feat: update header description for dsm when in workspace Signed-off-by: tygao --- .../data_source_home_panel.tsx | 67 ++++++++++++------- .../acceleration_table.test.tsx.snap | 2 +- .../mount_management_section.tsx | 13 +++- .../data_source_management/public/types.ts | 2 + 4 files changed, 57 insertions(+), 27 deletions(-) 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 dfb3fc0ae188..918d85d8b2cc 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 @@ -14,11 +14,11 @@ import { EuiPageHeader, EuiPanel, EuiButtonGroup, - EuiText, - EuiLink, } from '@elastic/eui'; import { TopNavControlButtonData, TopNavControlComponentData } from 'src/plugins/navigation/public'; -import { FormattedMessage } from '@osd/i18n/react'; +import { i18n } from '@osd/i18n'; +import { useObservable } from 'react-use'; +import { of } from 'rxjs'; 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'; @@ -26,6 +26,7 @@ import { CreateButton } from '../create_button'; import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public'; import { getListBreadcrumbs } from '../breadcrumbs'; import { DataSourceManagementContext } from '../../types'; +import { TopNavControlDescriptionData } from '../../../../navigation/public'; interface DataSourceHomePanelProps extends RouteComponentProps { featureFlagStatus: boolean; @@ -44,6 +45,7 @@ export const DataSourceHomePanel: React.FC = ({ savedObjects, uiSettings, application, + workspaces, docLinks, navigation, } = useOpenSearchDashboards().services; @@ -54,6 +56,7 @@ export const DataSourceHomePanel: React.FC = ({ const [selectedTabId, setSelectedTabId] = useState(defaultTabId); const canManageDataSource = !!application.capabilities?.dataSource?.canManage; const { HeaderControl } = navigation.ui; + const currentWorkspace = useObservable(workspaces ? workspaces.currentWorkspace$ : of(null)); useEffect(() => { setBreadcrumbs(getListBreadcrumbs()); @@ -63,27 +66,6 @@ export const DataSourceHomePanel: React.FC = ({ setSelectedTabId(id); }; - const description = [ - { - renderComponent: ( - - - - Learn more - - - ), - }, - ]; - const createDataSourceButton = [ { id: 'Create data source', @@ -156,7 +138,42 @@ export const DataSourceHomePanel: React.FC = ({ )} )} diff --git a/src/plugins/data_source_management/public/components/direct_query_data_sources_components/acceleration_management/__snapshots__/acceleration_table.test.tsx.snap b/src/plugins/data_source_management/public/components/direct_query_data_sources_components/acceleration_management/__snapshots__/acceleration_table.test.tsx.snap index 088b43734609..69f5e6c63bbc 100644 --- a/src/plugins/data_source_management/public/components/direct_query_data_sources_components/acceleration_management/__snapshots__/acceleration_table.test.tsx.snap +++ b/src/plugins/data_source_management/public/components/direct_query_data_sources_components/acceleration_management/__snapshots__/acceleration_table.test.tsx.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AccelerationTable Component matches snapshot 1`] = `"

Accelerations

Accelerations optimize query performance by indexing external data into OpenSearch.
Last updated at:
3/14/2024, 4:05:53 AM

Actions
Name
Status
Refreshing
Type
materialized
Database
default
Table
-
Refresh Type
Auto refresh
Destination Index
flint_mys3_default_http_count_view
Name
Status
Refreshing
Type
materialized
Database
default
Table
-
Refresh Type
Auto refresh
Destination Index
flint_mys3_default_http_count_view_alt
Name
Status
Deleted
Type
materialized
Database
default
Table
-
Refresh Type
Auto refresh
Destination Index
flint_mys3_default_http_logs
Name
Status
Active
Type
skipping
Database
default
Table
http_logs
Refresh Type
Manual
Destination Index
-
Name
Status
Refreshing
Type
materialized
Database
other
Table
-
Refresh Type
Auto refresh
Destination Index
flint_mys3_other_http_count_view
"`; +exports[`AccelerationTable Component matches snapshot 1`] = `"

Accelerations

Accelerations optimize query performance by indexing external data into OpenSearch.
Last updated at:
2024/3/14 04:05:53

Actions
Name
Status
Refreshing
Type
materialized
Database
default
Table
-
Refresh Type
Auto refresh
Destination Index
flint_mys3_default_http_count_view
Name
Status
Refreshing
Type
materialized
Database
default
Table
-
Refresh Type
Auto refresh
Destination Index
flint_mys3_default_http_count_view_alt
Name
Status
Deleted
Type
materialized
Database
default
Table
-
Refresh Type
Auto refresh
Destination Index
flint_mys3_default_http_logs
Name
Status
Active
Type
skipping
Database
default
Table
http_logs
Refresh Type
Manual
Destination Index
-
Name
Status
Refreshing
Type
materialized
Database
other
Table
-
Refresh Type
Auto refresh
Destination Index
flint_mys3_other_http_count_view
"`; diff --git a/src/plugins/data_source_management/public/management_app/mount_management_section.tsx b/src/plugins/data_source_management/public/management_app/mount_management_section.tsx index 545a76ec2736..e31f8e2eef17 100644 --- a/src/plugins/data_source_management/public/management_app/mount_management_section.tsx +++ b/src/plugins/data_source_management/public/management_app/mount_management_section.tsx @@ -36,7 +36,17 @@ export async function mountManagementSection( featureFlagStatus: boolean ) { const [ - { chrome, application, savedObjects, uiSettings, notifications, overlays, http, docLinks }, + { + chrome, + application, + savedObjects, + uiSettings, + notifications, + overlays, + http, + docLinks, + workspaces, + }, { navigation }, ] = await getStartServices(); @@ -52,6 +62,7 @@ export async function mountManagementSection( navigation, setBreadcrumbs: params.setBreadcrumbs, authenticationMethodRegistry: authMethodsRegistry, + workspaces, }; const canManageDataSource = !!application.capabilities?.dataSource?.canManage; diff --git a/src/plugins/data_source_management/public/types.ts b/src/plugins/data_source_management/public/types.ts index dc3c54505acc..2a54f67aea5d 100644 --- a/src/plugins/data_source_management/public/types.ts +++ b/src/plugins/data_source_management/public/types.ts @@ -12,6 +12,7 @@ import { NotificationsStart, DocLinksStart, HttpSetup, + WorkspacesStart, } from 'src/core/public'; import { ManagementAppMountParams } from 'src/plugins/management/public'; import { i18n } from '@osd/i18n'; @@ -37,6 +38,7 @@ export interface DataSourceManagementContext { navigation: NavigationPublicPluginStart; setBreadcrumbs: ManagementAppMountParams['setBreadcrumbs']; authenticationMethodRegistry: AuthenticationMethodRegistry; + workspaces: WorkspacesStart; } export interface DataSourceTableItem {