Add severity to UI logs
This commit is contained in:
@@ -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
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user