Skip to content

Commit efba477

Browse files
authored
fix: hide actions and notifications from deleted workspaces (#12563)
1 parent 489b0ec commit efba477

File tree

1 file changed

+45
-35
lines changed

1 file changed

+45
-35
lines changed

site/src/pages/WorkspacePage/WorkspaceTopbar.tsx

+45-35
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ export const WorkspaceTopbar: FC<WorkspaceProps> = ({
106106
allowAdvancedScheduling,
107107
);
108108

109+
const isImmutable =
110+
workspace.latest_build.status === "deleted" ||
111+
workspace.latest_build.status === "deleting";
112+
109113
return (
110114
<Topbar css={{ gridArea: "topbar" }}>
111115
<Tooltip title="Back to workspaces">
@@ -196,11 +200,13 @@ export const WorkspaceTopbar: FC<WorkspaceProps> = ({
196200
</Popover>
197201
</TopbarData>
198202

199-
<WorkspaceScheduleControls
200-
workspace={workspace}
201-
template={template}
202-
canUpdateSchedule={canUpdateWorkspace}
203-
/>
203+
{!isImmutable && (
204+
<WorkspaceScheduleControls
205+
workspace={workspace}
206+
template={template}
207+
canUpdateSchedule={canUpdateWorkspace}
208+
/>
209+
)}
204210

205211
{shouldDisplayDormantData && (
206212
<TopbarData>
@@ -247,36 +253,40 @@ export const WorkspaceTopbar: FC<WorkspaceProps> = ({
247253
gap: 12,
248254
}}
249255
>
250-
<WorkspaceNotifications
251-
workspace={workspace}
252-
template={template}
253-
latestVersion={latestVersion}
254-
permissions={permissions}
255-
onRestartWorkspace={handleRestart}
256-
onUpdateWorkspace={handleUpdate}
257-
onActivateWorkspace={handleDormantActivate}
258-
/>
259-
<WorkspaceStatusBadge workspace={workspace} />
260-
<WorkspaceActions
261-
workspace={workspace}
262-
handleStart={handleStart}
263-
handleStop={handleStop}
264-
handleRestart={handleRestart}
265-
handleDelete={handleDelete}
266-
handleUpdate={handleUpdate}
267-
handleCancel={handleCancel}
268-
handleSettings={handleSettings}
269-
handleRetry={handleRetry}
270-
handleDebug={handleDebug}
271-
handleChangeVersion={handleChangeVersion}
272-
handleDormantActivate={handleDormantActivate}
273-
handleToggleFavorite={handleToggleFavorite}
274-
canDebug={canDebugMode}
275-
canChangeVersions={canChangeVersions}
276-
isUpdating={isUpdating}
277-
isRestarting={isRestarting}
278-
isOwner={isOwner}
279-
/>
256+
{!isImmutable && (
257+
<>
258+
<WorkspaceNotifications
259+
workspace={workspace}
260+
template={template}
261+
latestVersion={latestVersion}
262+
permissions={permissions}
263+
onRestartWorkspace={handleRestart}
264+
onUpdateWorkspace={handleUpdate}
265+
onActivateWorkspace={handleDormantActivate}
266+
/>
267+
<WorkspaceStatusBadge workspace={workspace} />
268+
<WorkspaceActions
269+
workspace={workspace}
270+
handleStart={handleStart}
271+
handleStop={handleStop}
272+
handleRestart={handleRestart}
273+
handleDelete={handleDelete}
274+
handleUpdate={handleUpdate}
275+
handleCancel={handleCancel}
276+
handleSettings={handleSettings}
277+
handleRetry={handleRetry}
278+
handleDebug={handleDebug}
279+
handleChangeVersion={handleChangeVersion}
280+
handleDormantActivate={handleDormantActivate}
281+
handleToggleFavorite={handleToggleFavorite}
282+
canDebug={canDebugMode}
283+
canChangeVersions={canChangeVersions}
284+
isUpdating={isUpdating}
285+
isRestarting={isRestarting}
286+
isOwner={isOwner}
287+
/>
288+
</>
289+
)}
280290
</div>
281291
</Topbar>
282292
);

0 commit comments

Comments
 (0)