mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix!: stop workspace before update (#18425)
Fixes https://github.com/coder/coder/issues/17840 NOTE: calling this out as a breaking change so that it is highly visible in the changelog. * CLI: Modifies `coder update` to stop the workspace if already running. * UI: Modifies "update" button to always stop the workspace if already running.
This commit is contained in:
@@ -6,16 +6,19 @@ import type { Workspace } from "api/typesGenerated";
|
||||
const actionTypes = [
|
||||
"start",
|
||||
"starting",
|
||||
// Replaces start when an update is required.
|
||||
// Appears beside start when an update is available.
|
||||
"updateAndStart",
|
||||
// Replaces start when an update is required.
|
||||
"updateAndStartRequireActiveVersion",
|
||||
"stop",
|
||||
"stopping",
|
||||
"restart",
|
||||
"restarting",
|
||||
// Replaces restart when an update is required.
|
||||
// Appears beside restart when an update is available.
|
||||
"updateAndRestart",
|
||||
// Replaces restart when an update is required.
|
||||
"updateAndRestartRequireActiveVersion",
|
||||
"deleting",
|
||||
"update",
|
||||
"updating",
|
||||
"activate",
|
||||
"activating",
|
||||
@@ -74,10 +77,10 @@ export const abilitiesByWorkspaceStatus = (
|
||||
const actions: ActionType[] = ["stop"];
|
||||
|
||||
if (workspace.template_require_active_version && workspace.outdated) {
|
||||
actions.push("updateAndRestart");
|
||||
actions.push("updateAndRestartRequireActiveVersion");
|
||||
} else {
|
||||
if (workspace.outdated) {
|
||||
actions.unshift("update");
|
||||
actions.unshift("updateAndRestart");
|
||||
}
|
||||
actions.push("restart");
|
||||
}
|
||||
@@ -99,10 +102,10 @@ export const abilitiesByWorkspaceStatus = (
|
||||
const actions: ActionType[] = [];
|
||||
|
||||
if (workspace.template_require_active_version && workspace.outdated) {
|
||||
actions.push("updateAndStart");
|
||||
actions.push("updateAndStartRequireActiveVersion");
|
||||
} else {
|
||||
if (workspace.outdated) {
|
||||
actions.unshift("update");
|
||||
actions.unshift("updateAndStart");
|
||||
}
|
||||
actions.push("start");
|
||||
}
|
||||
@@ -128,7 +131,7 @@ export const abilitiesByWorkspaceStatus = (
|
||||
}
|
||||
|
||||
if (workspace.outdated) {
|
||||
actions.unshift("update");
|
||||
actions.unshift("updateAndStart");
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user