From ef4410bac67c8df78c4bb34b3cbc8afe62e77c23 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 24 Oct 2021 20:12:17 +0300 Subject: [PATCH] expose uptime to client resources API endpoint (#3705) resolves #3704 --- app/Transformers/Api/Client/StatsTransformer.php | 1 + resources/scripts/api/server/getServerResourceUsage.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/app/Transformers/Api/Client/StatsTransformer.php b/app/Transformers/Api/Client/StatsTransformer.php index bbe5afe86..66827bf36 100644 --- a/app/Transformers/Api/Client/StatsTransformer.php +++ b/app/Transformers/Api/Client/StatsTransformer.php @@ -28,6 +28,7 @@ class StatsTransformer extends BaseClientTransformer 'disk_bytes' => Arr::get($data, 'utilization.disk_bytes', 0), 'network_rx_bytes' => Arr::get($data, 'utilization.network.rx_bytes', 0), 'network_tx_bytes' => Arr::get($data, 'utilization.network.tx_bytes', 0), + 'uptime' => Arr::get($data, 'utilization.uptime', 0), ], ]; } diff --git a/resources/scripts/api/server/getServerResourceUsage.ts b/resources/scripts/api/server/getServerResourceUsage.ts index 6b71dcf54..2a4c01cf6 100644 --- a/resources/scripts/api/server/getServerResourceUsage.ts +++ b/resources/scripts/api/server/getServerResourceUsage.ts @@ -10,6 +10,7 @@ export interface ServerStats { diskUsageInBytes: number; networkRxInBytes: number; networkTxInBytes: number; + uptime: number; } export default (server: string): Promise => { @@ -23,6 +24,7 @@ export default (server: string): Promise => { diskUsageInBytes: attributes.resources.disk_bytes, networkRxInBytes: attributes.resources.network_rx_bytes, networkTxInBytes: attributes.resources.network_tx_bytes, + uptime: attributes.resources.uptime, })) .catch(reject); });