From 06042ef0078106b6245edaa8c4da5d889a126d99 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Mon, 18 Nov 2024 01:00:08 +1300 Subject: [PATCH] add device metrics --- src/components/pages/NodePage.vue | 66 +++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/components/pages/NodePage.vue b/src/components/pages/NodePage.vue index 9577967..5e67dd1 100644 --- a/src/components/pages/NodePage.vue +++ b/src/components/pages/NodePage.vue @@ -53,6 +53,7 @@ +
Position
+ +
+
Device Metrics
+ +
+ @@ -121,6 +178,15 @@ export default { getRoleName: (roleId) => NodeUtils.getRoleName(roleId), getHardwareName: (roleId) => NodeUtils.getHardwareName(roleId), latLongIntegerToLatLong: (latLongInteger) => NodeUtils.latLongIntegerToLatLong(latLongInteger), + formatUptimeSeconds: function(secondsToFormat) { + secondsToFormat = Number(secondsToFormat); + const days = Math.floor(secondsToFormat / (3600 * 24)); + const hours = Math.floor((secondsToFormat % (3600 * 24)) / 3600); + const minutes = Math.floor((secondsToFormat % 3600) / 60); + const seconds = Math.floor(secondsToFormat % 60); + const daysPlural = days === 1 ? 'day' : 'days'; + return `${days} ${daysPlural} ${hours}h ${minutes}m ${seconds}s`; + }, onNodeDeleted() { // go back to main page