1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-21 21:33:18 +01:00

Removes dead containers correctly

This commit is contained in:
Amir Raminfar
2022-04-21 16:20:58 -07:00
parent 32db78d64d
commit 2d2ff05987
2 changed files with 13 additions and 3 deletions

View File

@@ -40,7 +40,17 @@ export const useContainerStore = defineStore("container", () => {
},
false
);
// es.addEventListener("container-die", (e) => store.dispatch("UPDATE_CONTAINER", JSON.parse(e.data)), false);
es.addEventListener(
"container-die",
(e) => {
const event = JSON.parse((e as MessageEvent).data) as { actorId: string };
const container = allContainersById.value[event.actorId];
if (container) {
container.state = "dead";
}
},
false
);
const currentContainer = (id: Ref<string>) => computed(() => allContainersById.value[id.value]);
const appendActiveContainer = ({ id }: Container) => activeContainerIds.value.push(id);

View File

@@ -3,8 +3,8 @@ export interface Container {
readonly created: number;
readonly image: string;
readonly name: string;
readonly state: "created" | "running" | "exited" | "dead" | "paused" | "restarting";
readonly status: string;
state: "created" | "running" | "exited" | "dead" | "paused" | "restarting";
stat?: ContainerStat;
}