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,4 +1,11 @@
<div class="flex flex-col p-4 space-y-2 live-border">
<p class="text-xs text-zinc-400">{{ latestNotification.timestamp }}</p>
<div class="flex flex-row items-center gap-2">
@if (latestNotification.severity) {
<app-tag [color]="getSeverityColor(latestNotification.severity)" size="3xs" class="self-center">
{{ latestNotification.severity }}
</app-tag>
}
<span class="text-xs text-zinc-400 self-center">{{ latestNotification.timestamp }}</span>
</div>
<p class="font-normal text-zinc-200">{{ latestNotification.message }}</p>
</div>
@@ -1,6 +1,9 @@
import {Component, inject} from '@angular/core';
import {NotificationEventService} from '../../websocket/notification-event.service';
import {LogNotification} from '../../websocket/model/log-notification.model';
import {Tag} from 'primeng/tag';
import {NgIf} from '@angular/common';
import {TagComponent} from '../tag/tag.component';
@Component({
selector: 'app-live-notification-box',
@@ -10,6 +13,9 @@ import {LogNotification} from '../../websocket/model/log-notification.model';
host: {
class: 'config-panel'
},
imports: [
TagComponent
]
})
export class LiveNotificationBoxComponent {
latestNotification: LogNotification = {message: 'No recent notifications...'};
@@ -21,4 +27,17 @@ export class LiveNotificationBoxComponent {
this.latestNotification = notification;
});
}
getSeverityColor(severity?: string): 'red' | 'amber' | 'green' | 'gray' {
switch (severity) {
case 'ERROR':
return 'red';
case 'WARN':
return 'amber';
case 'INFO':
return 'green';
default:
return 'gray';
}
}
}