feat: volume stats & charts

This commit is contained in:
Nicolas Meienberger
2025-09-25 21:16:55 +02:00
parent c261590ea3
commit 6b386d28d6
12 changed files with 626 additions and 30 deletions

View File

@@ -103,9 +103,9 @@ export const deleteVolumeDto = describeRoute({
const getVolumeResponse = type({
volume: volumeSchema,
statfs: type({
total: "number",
used: "number",
free: "number",
total: "number = 0",
used: "number = 0",
free: "number = 0",
}),
});

View File

@@ -101,7 +101,7 @@ const getVolume = async (name: string) => {
where: eq(volumesTable.name, name),
});
const statfs = await getStatFs(`${VOLUME_MOUNT_BASE}/${name}/_data`);
const statfs = await getStatFs(`${VOLUME_MOUNT_BASE}/${name}/_data`).catch(() => {});
if (!volume) {
throw new NotFoundError("Volume not found");
@@ -182,7 +182,7 @@ const checkHealth = async (name: string) => {
await db
.update(volumesTable)
.set({ lastHealthCheck: new Date(), status, lastError: error })
.set({ lastHealthCheck: new Date(), status, lastError: error ?? null })
.where(eq(volumesTable.name, volume.name));
return { status, error };