Add log filters to web ui (#746)

* Add max level select to logs

Closes: #745

* Add log filter for server actions

Closes: #744

* Respond to comments

Change name of component, clean up onChange anon function
This commit is contained in:
Cooldude2606 authored and GitHub committed 2025-04-10 16:04:05 +01:00
1 parent 81fb223d5e
commit f3a62e585f
8 files changed
+113 -27

No files matched your search

+4
View File
@@ -4,6 +4,10 @@ export function StringEnum<T extends string[]>(values: [...T]) {
return Type.Unsafe<T[number]>({ type: "string", enum: values });
}
export function StringKey<T extends string>(object: Record<T, any>) {
return Type.Unsafe<keyof typeof object>({ type: "string", enum: Object.keys(object) });
}
export interface JSONDeserialisable<T> {
fromJSON(json: unknown): T;
jsonSchema: object;
+3 -3
View File
@@ -1,5 +1,5 @@
import { Type, Static } from "@sinclair/typebox";
import { JsonString, StringEnum, plainJson } from "./composites";
import { JsonString, StringEnum, StringKey, plainJson } from "./composites";
import { levels } from "../logging";
import { ControllerConfig, HostConfig } from "../config";
@@ -217,12 +217,12 @@ export class LogMessageEvent {
static dst = ["controller", "control"] as const;
constructor(
public info: { level: string, message: string },
public info: { level: keyof typeof levels, message: string },
) { }
static jsonSchema = Type.Object({
"info": Type.Object({
"level": Type.String(),
"level": StringKey(levels),
"message": Type.String(),
}),
});