mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-09 20:12:10 +10:00
Admin task UI update & QoL (#194)
* feat: revise library source names & update droplet * feat: add internal name hint to library sources * feat: update library source table with new name + icons * fix: admin invitation localisation issue * feat: #164 * feat: overhaul task UIs, #163 * fix: remove debug task * fix: lint
This commit is contained in:
@ -1,13 +1,31 @@
|
||||
import type { TaskLog } from "~/server/internal/tasks";
|
||||
|
||||
const labelNumberMap = {
|
||||
100: "silent",
|
||||
60: "fatal",
|
||||
50: "error",
|
||||
40: "warn",
|
||||
30: "info",
|
||||
20: "debug",
|
||||
10: "trace",
|
||||
0: "off",
|
||||
};
|
||||
|
||||
export function parseTaskLog(
|
||||
logStr?: string | undefined,
|
||||
): typeof TaskLog.infer {
|
||||
if (!logStr) return { message: "", timestamp: "" };
|
||||
if (!logStr) return { message: "", timestamp: "", level: "" };
|
||||
const log = JSON.parse(logStr);
|
||||
|
||||
if (typeof log.level === "number") {
|
||||
log.level = labelNumberMap[
|
||||
log.level as keyof typeof labelNumberMap
|
||||
] as string;
|
||||
}
|
||||
|
||||
return {
|
||||
message: log.msg,
|
||||
timestamp: log.time,
|
||||
level: log.level,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user