diff --git a/src-ui/src/app/components/admin/settings/settings.component.spec.ts b/src-ui/src/app/components/admin/settings/settings.component.spec.ts
index 4c336a754..56c065bd8 100644
--- a/src-ui/src/app/components/admin/settings/settings.component.spec.ts
+++ b/src-ui/src/app/components/admin/settings/settings.component.spec.ts
@@ -410,10 +410,10 @@ describe('SettingsComponent', () => {
'Error 61 connecting to localhost:6379. Connection refused.',
celery_status: SystemStatusItemStatus.ERROR,
index_status: SystemStatusItemStatus.OK,
- index_last_modified: new Date(),
+ index_last_modified: new Date().toISOString(),
index_error: null,
classifier_status: SystemStatusItemStatus.OK,
- classifier_last_modified: new Date(),
+ classifier_last_modified: new Date().toISOString(),
classifier_error: null,
},
}
diff --git a/src-ui/src/app/components/common/system-status-dialog/system-status-dialog.component.html b/src-ui/src/app/components/common/system-status-dialog/system-status-dialog.component.html
index 8edfbc9c1..d63a1f039 100644
--- a/src-ui/src/app/components/common/system-status-dialog/system-status-dialog.component.html
+++ b/src-ui/src/app/components/common/system-status-dialog/system-status-dialog.component.html
@@ -106,25 +106,33 @@
{{status.tasks.index_status}}
@if (status.tasks.index_status === 'OK') {
-
+ @if (isStale(status.tasks.index_last_modified)) {
+
+ } @else {
+
+ }
} @else {
}
- Last Updated:
{{status.tasks.index_last_modified}}
+ Last Updated:
{{status.tasks.index_last_modified | customDate:'medium'}}
Classifier Status
{{status.tasks.classifier_status}}
@if (status.tasks.classifier_status === 'OK') {
-
+ @if (isStale(status.tasks.classifier_last_modified)) {
+
+ } @else {
+
+ }
} @else {
}
- Last Updated:
{{status.tasks.classifier_last_modified}}
+ Last Updated:
{{status.tasks.classifier_last_modified | customDate:'medium'}}
diff --git a/src-ui/src/app/components/common/system-status-dialog/system-status-dialog.component.spec.ts b/src-ui/src/app/components/common/system-status-dialog/system-status-dialog.component.spec.ts
index 72dc5e7e4..8aa159edf 100644
--- a/src-ui/src/app/components/common/system-status-dialog/system-status-dialog.component.spec.ts
+++ b/src-ui/src/app/components/common/system-status-dialog/system-status-dialog.component.spec.ts
@@ -42,10 +42,10 @@ const status: SystemStatus = {
redis_error: 'Error 61 connecting to localhost:6379. Connection refused.',
celery_status: SystemStatusItemStatus.ERROR,
index_status: SystemStatusItemStatus.OK,
- index_last_modified: new Date(),
+ index_last_modified: new Date().toISOString(),
index_error: null,
classifier_status: SystemStatusItemStatus.OK,
- classifier_last_modified: new Date(),
+ classifier_last_modified: new Date().toISOString(),
classifier_error: null,
},
}
@@ -93,4 +93,11 @@ describe('SystemStatusDialogComponent', () => {
tick(3000)
expect(component.copied).toBeFalsy()
}))
+
+ it('should calculate if date is stale', () => {
+ const date = new Date()
+ date.setHours(date.getHours() - 25)
+ expect(component.isStale(date.toISOString())).toBeTruthy()
+ expect(component.isStale(date.toISOString(), 26)).toBeFalsy()
+ })
})
diff --git a/src-ui/src/app/components/common/system-status-dialog/system-status-dialog.component.ts b/src-ui/src/app/components/common/system-status-dialog/system-status-dialog.component.ts
index f0d3372c6..ae391c529 100644
--- a/src-ui/src/app/components/common/system-status-dialog/system-status-dialog.component.ts
+++ b/src-ui/src/app/components/common/system-status-dialog/system-status-dialog.component.ts
@@ -30,4 +30,10 @@ export class SystemStatusDialogComponent {
this.copied = false
}, 3000)
}
+
+ public isStale(dateStr: string, hours: number = 24): boolean {
+ const date = new Date(dateStr)
+ const now = new Date()
+ return now.getTime() - date.getTime() > hours * 60 * 60 * 1000
+ }
}
diff --git a/src-ui/src/app/data/system-status.ts b/src-ui/src/app/data/system-status.ts
index 6b131ce1c..fac697961 100644
--- a/src-ui/src/app/data/system-status.ts
+++ b/src-ui/src/app/data/system-status.ts
@@ -32,10 +32,10 @@ export interface SystemStatus {
redis_error: string
celery_status: SystemStatusItemStatus
index_status: SystemStatusItemStatus
- index_last_modified: Date
+ index_last_modified: string // ISO date string
index_error: string
classifier_status: SystemStatusItemStatus
- classifier_last_modified: Date
+ classifier_last_modified: string // ISO date string
classifier_error: string
}
}