feat(compose): added stop functionality for stack

This commit is contained in:
xenonwellz
2024-11-01 23:35:42 +01:00
parent cb02deb837
commit dc1e12d6ed
2 changed files with 12 additions and 1 deletions

View File

@@ -71,7 +71,7 @@ export const ComposeActions = ({ composeId }: Props) => {
Autodeploy {data?.autoDeploy && <CheckCircle2 className="size-4" />}
</Toggle>
<RedbuildCompose composeId={composeId} />
{data?.composeType === "docker-compose" && (
{["running", "done"].includes(data?.composeStatus || "") && (
<StopCompose composeId={composeId} />
)}

View File

@@ -476,6 +476,17 @@ export const stopCompose = async (composeId: string) => {
}
}
if (compose.composeType === "stack") {
if (compose.serverId) {
await execAsyncRemote(
compose.serverId,
`docker stack rm ${compose.appName}`,
);
} else {
await execAsync(`docker stack rm ${compose.appName}`);
}
}
await updateCompose(composeId, {
composeStatus: "idle",
});