Add sanity check to system status

This commit is contained in:
shamoon
2025-02-13 19:38:59 -08:00
parent 673839265d
commit b3d49dbf12
5 changed files with 62 additions and 5 deletions

View File

@@ -138,6 +138,22 @@
<ng-template #classifierStatus>
<h6><ng-container i18n>Last Trained</ng-container>:</h6> <span class="font-monospace small">{{status.tasks.classifier_last_trained | customDate:'medium'}}</span>
</ng-template>
<dt i18n>Sanity Checker</dt>
<dd class="d-flex align-items-center">
{{status.tasks.sanity_check_status}}
@if (status.tasks.sanity_check_status === 'OK') {
@if (isStale(status.tasks.sanity_check_last_run)) {
<i-bs name="exclamation-triangle-fill" class="text-warning ms-2 lh-1" [ngbPopover]="sanityCheckerStatus" triggers="mouseenter:mouseleave"></i-bs>
} @else {
<i-bs name="check-circle-fill" class="text-primary ms-2 lh-1" [ngbPopover]="sanityCheckerStatus" triggers="mouseenter:mouseleave"></i-bs>
}
} @else {
<i-bs name="exclamation-triangle-fill" class="text-danger ms-2 lh-1" ngbPopover="{{status.tasks.sanity_check_error}}" triggers="mouseenter:mouseleave"></i-bs>
}
</dd>
<ng-template #sanityCheckerStatus>
<h6><ng-container i18n>Last Run</ng-container>:</h6> <span class="font-monospace small">{{status.tasks.sanity_check_last_run | customDate:'medium'}}</span>
</ng-template>
</dl>
</div>
</div>

View File

@@ -42,6 +42,9 @@ const status: SystemStatus = {
classifier_status: SystemStatusItemStatus.OK,
classifier_last_trained: new Date().toISOString(),
classifier_error: null,
sanity_check_status: SystemStatusItemStatus.OK,
sanity_check_last_run: new Date().toISOString(),
sanity_check_error: null,
},
}

View File

@@ -38,5 +38,8 @@ export interface SystemStatus {
classifier_status: SystemStatusItemStatus
classifier_last_trained: string // ISO date string
classifier_error: string
sanity_check_status: SystemStatusItemStatus
sanity_check_last_run: string // ISO date string
sanity_check_error: string
}
}