diff --git a/assets/components/HostMenu.vue b/assets/components/HostMenu.vue index a488ffcf..df5889a6 100644 --- a/assets/components/HostMenu.vue +++ b/assets/components/HostMenu.vue @@ -186,4 +186,8 @@ watchEffect(() => { li.exited { @apply opacity-50; } + +li.deleted { + @apply hidden; +} diff --git a/assets/stores/container.ts b/assets/stores/container.ts index 42fa4b83..c6a6cf2a 100644 --- a/assets/stores/container.ts +++ b/assets/stores/container.ts @@ -61,16 +61,16 @@ export const useContainerStore = defineStore("container", () => { }); es.addEventListener("container-event", (e) => { const event = JSON.parse((e as MessageEvent).data) as { actorId: string; name: string }; - switch (event.name) { - case "die": - const container = allContainersById.value[event.actorId]; - if (container) { + const container = allContainersById.value[event.actorId]; + if (container) { + switch (event.name) { + case "die": container.state = "exited"; - } - break; - case "destroy": - containers.value = containers.value.filter((c) => c.id !== event.actorId); - break; + break; + case "destroy": + container.state = "deleted"; + break; + } } }); diff --git a/assets/types/Container.d.ts b/assets/types/Container.d.ts index b1011cc5..568a782f 100644 --- a/assets/types/Container.d.ts +++ b/assets/types/Container.d.ts @@ -20,5 +20,5 @@ export type ContainerJson = { readonly group?: string; }; -export type ContainerState = "created" | "running" | "exited" | "dead" | "paused" | "restarting"; +export type ContainerState = "created" | "running" | "exited" | "dead" | "paused" | "restarting" | "deleted"; export type ContainerHealth = "healthy" | "unhealthy" | "starting";