diff --git a/webapp/frontend/src/app/layout/common/dashboard-settings/dashboard-settings.component.html b/webapp/frontend/src/app/layout/common/dashboard-settings/dashboard-settings.component.html
index b920e63..9d4e905 100644
--- a/webapp/frontend/src/app/layout/common/dashboard-settings/dashboard-settings.component.html
+++ b/webapp/frontend/src/app/layout/common/dashboard-settings/dashboard-settings.component.html
@@ -18,6 +18,7 @@
Status
Title
+ Age
diff --git a/webapp/frontend/src/app/shared/device-sort.pipe.ts b/webapp/frontend/src/app/shared/device-sort.pipe.ts
index bc07c70..b04a0bf 100644
--- a/webapp/frontend/src/app/shared/device-sort.pipe.ts
+++ b/webapp/frontend/src/app/shared/device-sort.pipe.ts
@@ -39,6 +39,13 @@ export class DeviceSortPipe implements PipeTransform {
}
}
+ ageCompareFn(a: any, b: any) {
+ const left = a.smart?.power_on_hours
+ const right = b.smart?.power_on_hours
+
+ return left - right;
+ }
+
transform(deviceSummaries: Array, sortBy = 'status', dashboardDisplay = "name"): Array {
let compareFn = undefined
@@ -49,9 +56,12 @@ export class DeviceSortPipe implements PipeTransform {
case 'title':
compareFn = this.titleCompareFn(dashboardDisplay)
break;
+ case 'age':
+ compareFn = this.ageCompareFn
+ break;
}
- //failed, unknown/empty, passed
+ // failed, unknown/empty, passed
deviceSummaries.sort(compareFn);
return deviceSummaries;