fix: return workspace manager to level one
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
@@ -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]"
|
||||
>
|
||||
<DialogHeader className="border-b border-border/70 px-6 pb-4 pt-5 pr-12">
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
variant="link"
|
||||
className="w-fit px-0"
|
||||
onClick={close}
|
||||
>
|
||||
<ArrowLeft />Back to main page
|
||||
</Button>
|
||||
<DialogTitle>Workspace management</DialogTitle>
|
||||
<DialogDescription>
|
||||
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: ()
|
||||
|
||||
<div className="grid min-h-0 grid-cols-[15rem_minmax(0,1fr)] overflow-hidden">
|
||||
<nav aria-label="Workspaces" className="flex min-h-0 flex-col border-r border-border/70 bg-muted/30 p-3">
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
variant="outline"
|
||||
className="mb-3 w-full justify-start"
|
||||
onClick={showLevelOne}
|
||||
>
|
||||
<ArrowLeft />Back to main page
|
||||
</Button>
|
||||
<p className="mb-2 px-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground">Available workspaces</p>
|
||||
<div className="min-h-0 flex-1 overflow-y-auto">
|
||||
{workspacesQuery.isLoading && <p className="p-2 text-xs text-muted-foreground">Loading workspaces…</p>}
|
||||
|
||||
Reference in New Issue
Block a user