This commit is contained in:
2025-12-31 17:12:40 +01:00
parent 825084a6dd
commit 8e8b8a6a87
4 changed files with 118 additions and 129 deletions
+23 -1
View File
@@ -1,7 +1,7 @@
"use server";
import axios from "axios";
import { Docker, Node, SimpleStats } from "@/lib/types";
import { Docker, Log, Node, SimpleStats } from "@/lib/types";
import { verifySession } from "./auth/session";
import { getNodes } from "./node";
@@ -86,3 +86,25 @@ export async function removeContainer(containerId: string) {
).data
);
}
export async function getAllContainerLogs(): Promise<Log[]> {
const nodes = await getNodes();
return (
await Promise.all(
nodes.map(
async (n) =>
await (
await axios.get(`http://${n.ip}:3000/api/logs`, {
headers: { Authorization: `ApiKey ${n.key}` },
})
).data
)
)
)
.flat()
.sort(
(a, b) =>
new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime()
);
}