diff --git a/src/core/public/chrome/chrome_service.test.ts b/src/core/public/chrome/chrome_service.test.ts index be879bb4b5e9..b39ed6cdce3e 100644 --- a/src/core/public/chrome/chrome_service.test.ts +++ b/src/core/public/chrome/chrome_service.test.ts @@ -41,6 +41,7 @@ import { notificationServiceMock } from '../notifications/notifications_service. import { uiSettingsServiceMock } from '../ui_settings/ui_settings_service.mock'; import { ChromeService } from './chrome_service'; import { getAppInfo } from '../application/utils'; +import { workspacesServiceMock } from '../mocks'; class FakeApp implements App { public title: string; @@ -70,6 +71,7 @@ function defaultStartDeps(availableApps?: App[]) { injectedMetadata: injectedMetadataServiceMock.createStartContract(), notifications: notificationServiceMock.createStartContract(), uiSettings: uiSettingsServiceMock.createStartContract(), + workspaces: workspacesServiceMock.createStartContract(), }; if (availableApps) { diff --git a/src/plugins/workspace/public/components/workspace_overview/index.tsx b/src/plugins/workspace/public/components/workspace_overview/index.tsx index 937ffc8396b1..0e9c07aaadaa 100644 --- a/src/plugins/workspace/public/components/workspace_overview/index.tsx +++ b/src/plugins/workspace/public/components/workspace_overview/index.tsx @@ -42,7 +42,7 @@ export const WorkspaceOverview = () => { } = useOpenSearchDashboards(); const [isModalVisible, setIsModalVisible] = useState(false); - const [isStartWorkingVisible, setIsStartWorkingVisible] = useState(true); + const [isGettingStartVisible, setIsStartWorkingVisible] = useState(true); const isPermissionEnabled = application.capabilities.workspaces.permissionEnabled; const currentWorkspace = useObservable(workspaces.currentWorkspace$); @@ -56,6 +56,10 @@ export const WorkspaceOverview = () => { return getStartCards.filter((card) => !card.appId || featureFilter({ id: card.appId })); }, [currentWorkspace]); + if (!currentWorkspace) { + return null; + } + const pageTitle = ( {currentWorkspace?.name} @@ -77,7 +81,7 @@ export const WorkspaceOverview = () => { const userList = allUserAndGroup.slice(0, 3).map((user) => { return ( - + ); @@ -85,7 +89,7 @@ export const WorkspaceOverview = () => { if (allUserAndGroup.length > 3) { userList.push( - +{allUserAndGroup.length - 3} + +{allUserAndGroup.length - 3} ); } @@ -121,8 +125,24 @@ export const WorkspaceOverview = () => { }, ]; - if (!currentWorkspace) { - return null; + const collapseButton = ( + { + setIsStartWorkingVisible(!isGettingStartVisible); + }} + > + {isGettingStartVisible ? 'collapse' : 'expand'} + + ); + + let rightSideItems: ReactNode[] = userGroupsList ? [userGroupsList] : []; + if (!isGettingStartVisible) { + rightSideItems = [collapseButton, ...rightSideItems]; } return ( @@ -130,9 +150,9 @@ export const WorkspaceOverview = () => { - {isStartWorkingVisible ? ( + {isGettingStartVisible ? ( <>

@@ -169,25 +189,13 @@ export const WorkspaceOverview = () => { ) : null} - - - - { - setIsStartWorkingVisible(!isStartWorkingVisible); - }} - > - {isStartWorkingVisible ? 'collapse' : 'expand'} - - - + {isGettingStartVisible ? ( + + + {collapseButton} + + ) : null} - { await workspacePlugin.setup(setupMock, { savedObjectsManagement: savedObjectManagementSetupMock, }); - expect(setupMock.application.register).toBeCalledTimes(5); + expect(setupMock.application.register).toBeCalledTimes(3); expect(WorkspaceClientMock).toBeCalledTimes(1); expect(workspaceClientMock.enterWorkspace).toBeCalledTimes(0); expect(savedObjectManagementSetupMock.columns.register).toBeCalledTimes(1);