Add severity to UI logs

This commit is contained in:
aditya.chandel
2025-10-15 23:59:20 -06:00
parent c8a9075afb
commit d9528af522
15 changed files with 106 additions and 58 deletions
@@ -1,13 +1,13 @@
export enum TaskStatus {
IN_PROGRESS = 'IN_PROGRESS',
CANCELLED = 'CANCELLED',
COMPLETED = 'COMPLETED',
FAILED = 'FAILED'
export enum Severity {
INFO = 'INFO',
WARN = 'WARN',
ERROR = 'ERROR'
}
export interface LogNotification {
timestamp?: string;
message: string;
severity?: Severity;
}
export function parseLogNotification(messageBody: string): LogNotification {
@@ -15,22 +15,6 @@ export function parseLogNotification(messageBody: string): LogNotification {
return {
timestamp: raw.timestamp ? new Date(raw.timestamp).toLocaleTimeString() : undefined,
message: raw.message,
};
}
export interface TaskMessage {
taskId: string;
timestamp: string;
title?: string;
message: string;
cancellable: boolean;
status: TaskStatus;
}
export function parseTaskMessage(messageBody: string): TaskMessage {
const raw = JSON.parse(messageBody) as TaskMessage;
return {
...raw,
timestamp: new Date(raw.timestamp).toLocaleTimeString()
severity: raw.severity ? Severity[raw.severity as keyof typeof Severity] : undefined
};
}