diff --git a/webapp/frontend/src/app/modules/dashboard/dashboard.component.html b/webapp/frontend/src/app/modules/dashboard/dashboard.component.html index 68d42d7..dbb43d4 100644 --- a/webapp/frontend/src/app/modules/dashboard/dashboard.component.html +++ b/webapp/frontend/src/app/modules/dashboard/dashboard.component.html @@ -105,7 +105,8 @@
Powered On
-
{{ humanizeHours(disk.smart_results[0]?.power_on_hours) }}
+
{{ humanizeDuration(disk.smart_results[0]?.power_on_hours * 60 * 60 * 1000, { round: true, largest: 1, units: ['y', 'd', 'h'] }) }}
+
--
diff --git a/webapp/frontend/src/app/modules/dashboard/dashboard.component.ts b/webapp/frontend/src/app/modules/dashboard/dashboard.component.ts index 0d44110..f6d867c 100644 --- a/webapp/frontend/src/app/modules/dashboard/dashboard.component.ts +++ b/webapp/frontend/src/app/modules/dashboard/dashboard.component.ts @@ -185,16 +185,6 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy return item.id || index; } - humanizeHours(hours: number, full: boolean = false): string { - let duration: string = '' - if(!hours){ - return '--' - } - if(!full){ - duration = humanizeDuration(hours * 60 * 60 * 1000, { round: true, largest: 1, units: ['y', 'd', 'h', 'm', 's'] }); - } else { - duration = humanizeDuration(hours * 60 * 60 * 1000, { conjunction: " and ", serialComma: false }); - } - return duration - } + readonly humanizeDuration = humanizeDuration; + } diff --git a/webapp/frontend/src/app/modules/detail/detail.component.html b/webapp/frontend/src/app/modules/detail/detail.component.html index 3b3e322..073ba30 100644 --- a/webapp/frontend/src/app/modules/detail/detail.component.html +++ b/webapp/frontend/src/app/modules/detail/detail.component.html @@ -96,8 +96,8 @@
{{data.data.smart_results[0]?.power_cycle_count}}
Power Cycle Count
-
-
{{humanizeHours(data.data.smart_results[0]?.power_on_hours)}}
+
+
{{humanizeDuration(data.data.smart_results[0]?.power_on_hours *60 * 60 * 1000, { round: true, largest: 1, units: ['y', 'd', 'h'] })}}
Powered On
diff --git a/webapp/frontend/src/app/modules/detail/detail.component.ts b/webapp/frontend/src/app/modules/detail/detail.component.ts index cd84d38..a4321ec 100644 --- a/webapp/frontend/src/app/modules/detail/detail.component.ts +++ b/webapp/frontend/src/app/modules/detail/detail.component.ts @@ -321,17 +321,6 @@ export class DetailComponent implements OnInit, AfterViewInit, OnDestroy { // return item.id || index; } + readonly humanizeDuration = humanizeDuration; - humanizeHours(hours: number, full: boolean = false): string { - let duration: string = '' - if(!hours){ - return '--' - } - if(!full){ - duration = humanizeDuration(hours * 60 * 60 * 1000, { round: true, largest: 1, units: ['y', 'd', 'h', 'm', 's'] }); - } else { - duration = humanizeDuration(hours * 60 * 60 * 1000, { conjunction: " and ", serialComma: false }); - } - return duration - } }