From a02ac528360d05cbc29052307014125267d46f7e Mon Sep 17 00:00:00 2001 From: mptyl Date: Fri, 14 Aug 2026 22:18:12 +0200 Subject: [PATCH] fix: return workspace manager to level one --- frontend/src/shell/WorkspaceManager.test.tsx | 16 ++++++++++--- frontend/src/shell/WorkspaceManager.tsx | 24 ++++++++++++-------- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/frontend/src/shell/WorkspaceManager.test.tsx b/frontend/src/shell/WorkspaceManager.test.tsx index f5d0ddd4..40c87bdf 100644 --- a/frontend/src/shell/WorkspaceManager.test.tsx +++ b/frontend/src/shell/WorkspaceManager.test.tsx @@ -83,14 +83,24 @@ test("uses a tall viewport area and keeps the workspace content scrollable", () expect(screen.getByRole("main")).toHaveClass("overflow-y-auto"); }); -test("offers an internal link back to the initial page", async () => { +test("offers a button above the workspace list that returns to Level 1", async () => { const user = userEvent.setup(); const onClose = vi.fn(); renderManager(onClose); - await user.click(screen.getByRole("button", { name: "Back to main page" })); + await user.click(await screen.findByRole("button", { name: "PSD Clinical" })); + expect(await screen.findByRole("heading", { name: "Workspace-specific actions" })).toBeVisible(); - expect(onClose).toHaveBeenCalledTimes(1); + const navigation = screen.getByRole("navigation", { name: "Workspaces" }); + const backButton = within(navigation).getByRole("button", { name: "Back to main page" }); + expect(backButton).toHaveClass("border-border", "bg-card", "w-full"); + expect(backButton.compareDocumentPosition(within(navigation).getByText("Available workspaces")) + & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy(); + await user.click(backButton); + + expect(onClose).not.toHaveBeenCalled(); + expect(screen.getByTestId("workspace-overview")).toBeVisible(); + expect(screen.queryByRole("heading", { name: "Workspace-specific actions" })).not.toBeInTheDocument(); }); test("level one explains the read-only Git sequence and the repository update button", async () => { diff --git a/frontend/src/shell/WorkspaceManager.tsx b/frontend/src/shell/WorkspaceManager.tsx index 62c09a4e..234edecb 100644 --- a/frontend/src/shell/WorkspaceManager.tsx +++ b/frontend/src/shell/WorkspaceManager.tsx @@ -108,6 +108,12 @@ export function WorkspaceManager({ open, onClose }: { open: boolean; onClose: () clearMessages(); }; + const showLevelOne = () => { + setSelectedId(undefined); + setSecretValues({}); + clearMessages(); + }; + async function updateRepository() { setBusyAction("repository"); clearMessages(); @@ -218,15 +224,6 @@ export function WorkspaceManager({ open, onClose }: { open: boolean; onClose: () className="h-[86vh] w-[94vw] max-h-[92vh] max-w-[94vw] grid-rows-[auto_minmax(0,1fr)] gap-0 overflow-hidden p-0 sm:w-[70vw] sm:max-w-[94vw]" > - Workspace management Read, validate, and complete the runtime configuration of workspaces supplied by the installation repository. @@ -238,6 +235,15 @@ export function WorkspaceManager({ open, onClose }: { open: boolean; onClose: ()