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