From 8c779c15ef397feda3402aeaf7d200c0da8f64eb Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Wed, 28 Aug 2024 22:01:16 +0800 Subject: [PATCH] tweaks the new homepage styles (#7875) (#7883) * tweaks homepage styles * Add key to React.Fragment --------- (cherry picked from commit 5e0ce2b07ed9338d83177d9c2b607b5cf7872c35) Signed-off-by: Yulong Ruan Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] --- .../public/components/page_render.tsx | 33 +++++++++---------- .../public/components/section_input.test.ts | 4 +++ .../public/components/section_input.ts | 3 ++ .../public/components/section_render.tsx | 4 +-- .../home_list_card.test.tsx.snap | 8 ++--- .../application/components/home_list_card.tsx | 6 ++-- .../home/public/application/home_render.tsx | 2 +- .../public/management_section/recent_work.tsx | 8 ++--- .../workspace_list_card.test.tsx.snap | 8 ++--- .../service_card/workspace_list_card.tsx | 6 ++-- 10 files changed, 44 insertions(+), 38 deletions(-) diff --git a/src/plugins/content_management/public/components/page_render.tsx b/src/plugins/content_management/public/components/page_render.tsx index 1a28d1efec2f..f0cdca8bd900 100644 --- a/src/plugins/content_management/public/components/page_render.tsx +++ b/src/plugins/content_management/public/components/page_render.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { useObservable } from 'react-use'; import { SavedObjectsClientContract } from 'opensearch-dashboards/public'; -import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { EuiFlexItem, EuiPage, EuiSpacer } from '@elastic/eui'; import { Page } from '../services'; import { SectionRender } from './section_render'; import { EmbeddableStart } from '../../../embeddable/public'; @@ -22,22 +22,21 @@ export const PageRender = ({ page, embeddable, savedObjectsClient }: Props) => { const sections = useObservable(page.getSections$()) || []; return ( - - {sections.map((section) => ( - - - + + {sections.map((section, i) => ( + + + + + {i < sections.length - 1 && } + ))} - + ); }; diff --git a/src/plugins/content_management/public/components/section_input.test.ts b/src/plugins/content_management/public/components/section_input.test.ts index 80fe5ce0863c..bcf7db4a7ab8 100644 --- a/src/plugins/content_management/public/components/section_input.test.ts +++ b/src/plugins/content_management/public/components/section_input.test.ts @@ -21,6 +21,7 @@ test('it should create card section input', () => { id: 'section1', title: '', hidePanelTitles: true, + hidePanelActions: true, viewMode: 'view', panels: { content1: { @@ -55,6 +56,7 @@ test('it should create card section input with explicit input specified', () => id: 'section1', title: 'new title', hidePanelTitles: true, + hidePanelActions: true, viewMode: 'view', columns: 4, panels: { @@ -189,6 +191,7 @@ test('it should create dashboard input', async () => { content3: { explicitInput: { disabledActions: ['togglePanel'], + hidePanelActions: true, id: 'content3', render: renderFn, }, @@ -257,6 +260,7 @@ test('it should create dashboard input without the content which throws error', content3: { explicitInput: { disabledActions: ['togglePanel'], + hidePanelActions: true, id: 'content3', render: renderFn, }, diff --git a/src/plugins/content_management/public/components/section_input.ts b/src/plugins/content_management/public/components/section_input.ts index 3ae47b84881d..1404e7cd912b 100644 --- a/src/plugins/content_management/public/components/section_input.ts +++ b/src/plugins/content_management/public/components/section_input.ts @@ -31,6 +31,7 @@ export const createCardInput = ( id: section.id, title: section.title ?? '', hidePanelTitles: true, + hidePanelActions: true, viewMode: ViewMode.VIEW, columns: section.columns, wrap: section.wrap, @@ -175,6 +176,8 @@ export const createDashboardInput = async ( if (content.kind === 'custom') { panelConfig.type = CUSTOM_CONTENT_EMBEDDABLE; panelConfig.explicitInput.render = content.render; + // Currently, for custom content, there is no case that requires panel actions, so hide it + panelConfig.explicitInput.hidePanelActions = true; } panels[content.id] = panelConfig; diff --git a/src/plugins/content_management/public/components/section_render.tsx b/src/plugins/content_management/public/components/section_render.tsx index 457b07cb7822..9f7ddaf6e2f6 100644 --- a/src/plugins/content_management/public/components/section_render.tsx +++ b/src/plugins/content_management/public/components/section_render.tsx @@ -43,7 +43,7 @@ const DashboardSection = ({ section, embeddable, contents$, savedObjectsClient } // const input = createDashboardSection(section, contents ?? []); return ( // to make dashboard section align with others add margin left and right -8px -
+
); @@ -82,7 +82,7 @@ const CardSection = ({ section, embeddable, contents$ }: Props) => { ) : null} {isCardVisible && ( <> - + )} diff --git a/src/plugins/home/public/application/components/__snapshots__/home_list_card.test.tsx.snap b/src/plugins/home/public/application/components/__snapshots__/home_list_card.test.tsx.snap index 8ff4e1d85325..fdc4a20def11 100644 --- a/src/plugins/home/public/application/components/__snapshots__/home_list_card.test.tsx.snap +++ b/src/plugins/home/public/application/components/__snapshots__/home_list_card.test.tsx.snap @@ -4,7 +4,7 @@ exports[` should render static content normally 1`] = `
should render static content normally 1`] = `
-

What's New -

+
{ return ( <> - + { gutterSize="none" > - -

{config.title}

+ +

{config.title}

diff --git a/src/plugins/home/public/application/home_render.tsx b/src/plugins/home/public/application/home_render.tsx index 03babca342eb..ef73d7c44d99 100644 --- a/src/plugins/home/public/application/home_render.tsx +++ b/src/plugins/home/public/application/home_render.tsx @@ -50,7 +50,7 @@ export const setupHome = (contentManagement: ContentManagementPluginSetup) => { { id: SECTIONS.GET_STARTED, order: 1000, - title: 'Define your path forward with OpenSearch', + title: 'Get started with OpenSearch’s powerful features', kind: 'card', }, ], diff --git a/src/plugins/saved_objects_management/public/management_section/recent_work.tsx b/src/plugins/saved_objects_management/public/management_section/recent_work.tsx index 04cae46c1cea..eb04652d6343 100644 --- a/src/plugins/saved_objects_management/public/management_section/recent_work.tsx +++ b/src/plugins/saved_objects_management/public/management_section/recent_work.tsx @@ -11,7 +11,6 @@ import { EuiPanel, EuiFlexGrid, EuiFlexGroup, - EuiTitle, EuiFilterGroup, EuiFilterButton, EuiComboBox, @@ -21,6 +20,7 @@ import { EuiToolTip, EuiSpacer, EuiText, + EuiTitle, } from '@elastic/eui'; import { i18n } from '@osd/i18n'; import { @@ -167,12 +167,12 @@ export const RecentWork = (props: { core: CoreStart; workspaceEnabled?: boolean - -

+ +

{i18n.translate('savedObjectsManagement.recentWorkSection.title', { defaultMessage: 'Assets', })} -

+

diff --git a/src/plugins/workspace/public/components/service_card/__snapshots__/workspace_list_card.test.tsx.snap b/src/plugins/workspace/public/components/service_card/__snapshots__/workspace_list_card.test.tsx.snap index 36a442328839..843c15a04714 100644 --- a/src/plugins/workspace/public/components/service_card/__snapshots__/workspace_list_card.test.tsx.snap +++ b/src/plugins/workspace/public/components/service_card/__snapshots__/workspace_list_card.test.tsx.snap @@ -3,7 +3,7 @@ exports[`workspace list card render normally should show workspace list card correctly 1`] = `
-

Workspaces -

+
{ } return ( - + { - -

Workspaces

+ +

Workspaces