mirror of
https://github.com/moghtech/komodo.git
synced 2026-07-19 12:21:28 -05:00
30 lines
757 B
TypeScript
30 lines
757 B
TypeScript
import { objFrom2Arrays } from "@monitor/util";
|
|
import { FastifyInstance } from "fastify";
|
|
|
|
export async function deploymentStatusLocal(
|
|
app: FastifyInstance,
|
|
) {
|
|
const statusAr = await app.dockerode.listContainers({ all: true });
|
|
const statusNames = statusAr.map((stat) =>
|
|
stat.Names[0].slice(1, stat.Names[0].length)
|
|
); // they all start with '/'
|
|
const status = objFrom2Arrays(
|
|
statusNames,
|
|
statusAr.map((stat, i) => ({
|
|
name: statusNames[i],
|
|
Status: stat.Status,
|
|
State: stat.State as "running" | "exited",
|
|
}))
|
|
);
|
|
return objFrom2Arrays(
|
|
statusNames,
|
|
statusAr.map((stat, i) => ({
|
|
name: statusNames[i],
|
|
Status: stat.Status,
|
|
State: stat.State as "running" | "exited",
|
|
}))
|
|
);
|
|
}
|
|
|
|
|