Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ const App: Component = () => {

if (!confirmed) return

await stopInstance(instanceId)
stopInstance(instanceId)
}

async function handleNewSession(instanceId: string) {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/session-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const SessionPicker: Component<SessionPickerProps> = (props) => {
}

async function handleCancel() {
await stopInstance(props.instanceId)
stopInstance(props.instanceId)
props.onClose()
}

Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/lib/i18n/messages/de/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const appMessages = {
"app.stopInstance.title": "Instanz stoppen",
"app.stopInstance.confirmLabel": "Stoppen",
"app.stopInstance.cancelLabel": "Weiterlaufen lassen",
"app.stopInstance.toast.error": "Arbeitsbereich konnte nicht gestoppt werden.",

"emptyState.logoAlt": "CodeNomad Logo",
"emptyState.brandTitle": "CodeNomad",
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/lib/i18n/messages/en/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const appMessages = {
"app.stopInstance.title": "Stop instance",
"app.stopInstance.confirmLabel": "Stop",
"app.stopInstance.cancelLabel": "Keep running",
"app.stopInstance.toast.error": "Failed to stop workspace.",

"emptyState.logoAlt": "CodeNomad logo",
"emptyState.brandTitle": "CodeNomad",
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/lib/i18n/messages/es/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const appMessages = {
"app.stopInstance.title": "Detener instancia",
"app.stopInstance.confirmLabel": "Detener",
"app.stopInstance.cancelLabel": "Seguir ejecutándose",
"app.stopInstance.toast.error": "No se pudo detener el workspace.",

"emptyState.logoAlt": "Logo de CodeNomad",
"emptyState.brandTitle": "CodeNomad",
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/lib/i18n/messages/fr/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const appMessages = {
"app.stopInstance.title": "Arrêter l'instance",
"app.stopInstance.confirmLabel": "Arrêter",
"app.stopInstance.cancelLabel": "Laisser tourner",
"app.stopInstance.toast.error": "Impossible d'arrêter l'espace de travail.",

"emptyState.logoAlt": "Logo CodeNomad",
"emptyState.brandTitle": "CodeNomad",
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/lib/i18n/messages/he/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const appMessages = {
"app.stopInstance.title": "עצור מופע",
"app.stopInstance.confirmLabel": "עצור",
"app.stopInstance.cancelLabel": "המשך להריץ",
"app.stopInstance.toast.error": "עצירת סביבת העבודה נכשלה.",

"emptyState.logoAlt": "לוגו CodeNomad",
"emptyState.brandTitle": "CodeNomad",
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/lib/i18n/messages/ja/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const appMessages = {
"app.stopInstance.title": "インスタンスを停止",
"app.stopInstance.confirmLabel": "停止",
"app.stopInstance.cancelLabel": "実行を続ける",
"app.stopInstance.toast.error": "ワークスペースの停止に失敗しました。",

"emptyState.logoAlt": "CodeNomad ロゴ",
"emptyState.brandTitle": "CodeNomad",
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/lib/i18n/messages/ne/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const appMessages = {
"app.stopInstance.title": "उदाहरण रोक्नुहोस्",
"app.stopInstance.confirmLabel": "रोक्नुहोस्",
"app.stopInstance.cancelLabel": "चालु राख्नुहोस्",
"app.stopInstance.toast.error": "कार्यस्थान रोक्न असफल भयो।",

"emptyState.logoAlt": "CodeNomad लोगो",
"emptyState.brandTitle": "CodeNomad",
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/lib/i18n/messages/ru/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const appMessages = {
"app.stopInstance.title": "Остановить экземпляр",
"app.stopInstance.confirmLabel": "Остановить",
"app.stopInstance.cancelLabel": "Оставить запущенным",
"app.stopInstance.toast.error": "Не удалось остановить рабочее пространство.",

"emptyState.logoAlt": "Логотип CodeNomad",
"emptyState.brandTitle": "CodeNomad",
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/lib/i18n/messages/zh-Hans/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const appMessages = {
"app.stopInstance.title": "停止实例",
"app.stopInstance.confirmLabel": "停止",
"app.stopInstance.cancelLabel": "继续运行",
"app.stopInstance.toast.error": "无法停止工作区。",

"emptyState.logoAlt": "CodeNomad 徽标",
"emptyState.brandTitle": "CodeNomad",
Expand Down
19 changes: 11 additions & 8 deletions packages/ui/src/stores/instances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ import { mergeInstanceMetadata, clearInstanceMetadata } from "./instance-metadat
import { showWorkspaceLaunchError } from "./launch-errors"
import { activeSidecarToken } from "./sidecars"
import { buildV2RequestLocations, type V2Location } from "./request-locations"
import { showToastNotification } from "../lib/notifications"
import { tGlobal } from "../lib/i18n"

const log = getLogger("api")

Expand Down Expand Up @@ -715,19 +717,20 @@ function updateProjectNameForFolder(folder: string, projectName: string): void {
}
}

async function stopInstance(id: string) {
function stopInstance(id: string) {
const instance = instances().get(id)
if (!instance) return

releaseInstanceResources(id)
removeInstance(id)

try {
await serverApi.deleteWorkspace(id)
} catch (error) {
void serverApi.deleteWorkspace(id).catch((error) => {
log.error("Failed to stop workspace", error)
}

removeInstance(id)
showToastNotification({
message: tGlobal("app.stopInstance.toast.error"),
variant: "error",
})
})
}

async function fetchLspStatus(instanceId: string): Promise<LspStatus[] | undefined> {
Expand Down Expand Up @@ -1351,7 +1354,7 @@ async function acknowledgeDisconnectedInstance(): Promise<void> {
}

try {
await stopInstance(pending.id)
stopInstance(pending.id)
} catch (error) {
log.error("Failed to stop disconnected instance", error)
} finally {
Expand Down
Loading