Skip to content

Commit 87fee06

Browse files
committed
Handle canceling
1 parent e9758c7 commit 87fee06

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

site/src/components/Workspace/Workspace.stories.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ Stopping.args = { ...Started.args, workspaceStatus: "stopping" }
3535
export const Error = Template.bind({})
3636
Error.args = { ...Started.args, workspaceStatus: "error" }
3737

38+
export const BuildLoading = Template.bind({})
39+
BuildLoading.args = {...Started.args, workspaceStatus: "loading" }
40+
41+
export const Deleting = Template.bind({})
42+
Deleting.args = {...Started.args, workspaceStatus: "deleting"}
43+
44+
export const Deleted = Template.bind({})
45+
Deleted.args = {...Started.args, workspaceStatus: "deleted"}
46+
47+
export const Canceling = Template.bind({})
48+
Canceling.args = {...Started.args, workspaceStatus: "canceling"}
49+
3850
export const NoBreadcrumb = Template.bind({})
3951
NoBreadcrumb.args = { ...Started.args, template: undefined }
4052

site/src/components/WorkspaceStatusBar/WorkspaceStatusBar.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ const Language = {
2424
error: "Build Failed",
2525
loading: "Loading Status",
2626
deleting: "Deleting",
27-
deleted: "Deleted"
27+
deleted: "Deleted",
28+
// "Canceling" would be misleading because it refers to a build, not the workspace.
29+
// So just stall. When it is canceled it will appear as the error workspaceStatus.
30+
canceling: "Loading Status"
2831
}
2932

3033
export interface WorkspaceStatusBarProps {
@@ -102,7 +105,7 @@ export const WorkspaceStatusBar: React.FC<WorkspaceStatusBarProps> = ({
102105
)}
103106

104107
{/* Workspace will not update while another job is in progress so hide the button until it's usable */}
105-
{workspace.outdated && ["started", "stopped", "error"].includes(workspaceStatus) && (
108+
{workspace.outdated && ["started", "stopped", "deleted", "error"].includes(workspaceStatus) && (
106109
<Button onClick={handleUpdate} color="primary">
107110
{Language.update}
108111
</Button>

site/src/pages/WorkspacePage/WorkspacePage.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { firstOrItem } from "../../util/array"
1010
import { XServiceContext } from "../../xServices/StateContext"
1111
import { selectWorkspaceStatus } from "../../xServices/workspace/workspaceSelectors"
1212

13-
export type WorkspaceStatus = "started" | "starting" | "stopped" | "stopping" | "error" | "loading" | "deleting" | "deleted"
13+
export type WorkspaceStatus = "started" | "starting" | "stopped" | "stopping" | "error" | "loading" | "deleting" | "deleted" | "canceling"
1414

1515
export const WorkspacePage: React.FC = () => {
1616
const { workspace: workspaceQueryParam } = useParams()

site/src/xServices/workspace/workspaceSelectors.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export const selectWorkspaceStatus = (state: State<WorkspaceContext, WorkspaceEv
2323
case "succeeded": return succeededToStatus[transition]
2424
case "pending": return inProgressToStatus[transition]
2525
case "running": return inProgressToStatus[transition]
26+
case "canceling": return "canceling"
2627
case "canceled": return "error"
27-
case "canceling": return "error"
2828
case "failed": return "error"
2929
}
3030
}

0 commit comments

Comments
 (0)