Skip to content

Commit ddcb1e9

Browse files
committed
Fixes
1 parent 61dc162 commit ddcb1e9

File tree

2 files changed

+56
-52
lines changed

2 files changed

+56
-52
lines changed

site/src/pages/WorkspacePage/Workspace.stories.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Meta, StoryObj } from "@storybook/react";
33
import type { ProvisionerJobLog } from "api/typesGenerated";
44
import { ProxyContext, getPreferredProxy } from "contexts/ProxyContext";
55
import * as Mocks from "testHelpers/entities";
6-
import { withDashboardProvider } from "testHelpers/storybook";
6+
import { withAuthProvider, withDashboardProvider } from "testHelpers/storybook";
77
import { Workspace } from "./Workspace";
88
import type { WorkspacePermissions } from "./permissions";
99

@@ -40,8 +40,10 @@ const meta: Meta<typeof Workspace> = {
4040
data: Mocks.MockListeningPortsResponse,
4141
},
4242
],
43+
user: Mocks.MockUser,
4344
},
4445
decorators: [
46+
withAuthProvider,
4547
withDashboardProvider,
4648
(Story) => (
4749
<ProxyContext.Provider

site/src/pages/WorkspacesPage/WorkspacesTable.tsx

Lines changed: 53 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -530,62 +530,64 @@ const WorkspaceActionsCell: FC<WorkspaceActionsCellProps> = ({
530530

531531
return (
532532
<TableCell>
533-
{abilities.actions.includes("start") && (
534-
<PrimaryAction
535-
onClick={() => startWorkspaceMutation.mutate({})}
536-
isLoading={startWorkspaceMutation.isLoading}
537-
label="Start workspace"
538-
>
539-
<PlayIcon />
540-
</PrimaryAction>
541-
)}
542-
543-
{abilities.actions.includes("updateAndStart") && (
544-
<>
533+
<div className="flex gap-1">
534+
{abilities.actions.includes("start") && (
535+
<PrimaryAction
536+
onClick={() => startWorkspaceMutation.mutate({})}
537+
isLoading={startWorkspaceMutation.isLoading}
538+
label="Start workspace"
539+
>
540+
<PlayIcon />
541+
</PrimaryAction>
542+
)}
543+
544+
{abilities.actions.includes("updateAndStart") && (
545+
<>
546+
<PrimaryAction
547+
onClick={() => {
548+
workspaceUpdate.update(false);
549+
}}
550+
isLoading={workspaceUpdate.isUpdating}
551+
label="Update and start workspace"
552+
>
553+
<PlayIcon />
554+
</PrimaryAction>
555+
<WorkspaceUpdateDialogs {...workspaceUpdate.dialogs} />
556+
</>
557+
)}
558+
559+
{abilities.actions.includes("stop") && (
545560
<PrimaryAction
546561
onClick={() => {
547-
workspaceUpdate.update(false);
562+
stopWorkspaceMutation.mutate({});
548563
}}
549-
isLoading={workspaceUpdate.isUpdating}
550-
label="Update and start workspace"
564+
isLoading={stopWorkspaceMutation.isLoading}
565+
label="Stop workspace"
551566
>
552-
<PlayIcon />
567+
<SquareIcon />
568+
</PrimaryAction>
569+
)}
570+
571+
{abilities.canCancel && (
572+
<PrimaryAction
573+
onClick={cancelBuildMutation.mutate}
574+
isLoading={cancelBuildMutation.isLoading}
575+
label="Cancel build"
576+
>
577+
<BanIcon />
553578
</PrimaryAction>
554-
<WorkspaceUpdateDialogs {...workspaceUpdate.dialogs} />
555-
</>
556-
)}
557-
558-
{abilities.actions.includes("stop") && (
559-
<PrimaryAction
560-
onClick={() => {
561-
stopWorkspaceMutation.mutate({});
562-
}}
563-
isLoading={stopWorkspaceMutation.isLoading}
564-
label="Stop workspace"
565-
>
566-
<SquareIcon />
567-
</PrimaryAction>
568-
)}
569-
570-
{abilities.canCancel && (
571-
<PrimaryAction
572-
onClick={cancelBuildMutation.mutate}
573-
isLoading={cancelBuildMutation.isLoading}
574-
label="Cancel build"
575-
>
576-
<BanIcon />
577-
</PrimaryAction>
578-
)}
579-
580-
{abilities.actions.includes("retry") && (
581-
<PrimaryAction
582-
onClick={retry}
583-
isLoading={isRetrying}
584-
label="Retry build"
585-
>
586-
<RefreshCcwIcon />
587-
</PrimaryAction>
588-
)}
579+
)}
580+
581+
{abilities.actions.includes("retry") && (
582+
<PrimaryAction
583+
onClick={retry}
584+
isLoading={isRetrying}
585+
label="Retry build"
586+
>
587+
<RefreshCcwIcon />
588+
</PrimaryAction>
589+
)}
590+
</div>
589591
</TableCell>
590592
);
591593
};

0 commit comments

Comments
 (0)