-
Notifications
You must be signed in to change notification settings - Fork 1k
feat!: add ability to cancel pending workspace build #18713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
ba41ae8
c4ee5b6
c49c33e
ba1dbf3
acffda6
b672d76
86a34df
42170ab
5db9d71
1ede20c
2597615
6c2d0cf
c800494
c5cb203
1de84cc
17fb6a3
1b7b614
634f556
4deace0
43430fa
6272d93
4d4a01d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { API, type DeleteWorkspaceOptions } from "api/api"; | ||
import { DetailedError, isApiValidationError } from "api/errors"; | ||
import type { | ||
CancelWorkspaceBuildParams, | ||
CreateWorkspaceRequest, | ||
ProvisionerLogLevel, | ||
UsageAppName, | ||
|
@@ -266,12 +267,12 @@ export const startWorkspace = ( | |
export const cancelBuild = (workspace: Workspace, queryClient: QueryClient) => { | ||
return { | ||
mutationFn: () => { | ||
if (workspace.latest_build.status === "pending") { | ||
return API.cancelWorkspaceBuild(workspace.latest_build.id, { | ||
expect_status: "pending", | ||
}); | ||
} | ||
return API.cancelWorkspaceBuild(workspace.latest_build.id); | ||
const { status } = workspace.latest_build; | ||
const params: CancelWorkspaceBuildParams = { | ||
expect_status: | ||
status === "pending" || status === "running" ? status : undefined, | ||
}; | ||
return API.cancelWorkspaceBuild(workspace.latest_build.id, params); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Double checking... can There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
}, | ||
onSuccess: async () => { | ||
await queryClient.invalidateQueries({ | ||
|
Uh oh!
There was an error while loading. Please reload this page.