From 3411e5e65cf0ce194f0b2c13477b1801a41317eb Mon Sep 17 00:00:00 2001 From: Boy132 Date: Sun, 19 Jan 2025 01:09:54 +0100 Subject: [PATCH] NodeStorageChart: Format data after math (#931) --- .../NodeResource/Widgets/NodeStorageChart.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/Filament/Admin/Resources/NodeResource/Widgets/NodeStorageChart.php b/app/Filament/Admin/Resources/NodeResource/Widgets/NodeStorageChart.php index c40c3a05f..af5f881b4 100644 --- a/app/Filament/Admin/Resources/NodeResource/Widgets/NodeStorageChart.php +++ b/app/Filament/Admin/Resources/NodeResource/Widgets/NodeStorageChart.php @@ -39,15 +39,18 @@ class NodeStorageChart extends ChartWidget protected function getData(): array { - $total = Number::format(config('panel.use_binary_prefix') + $total = config('panel.use_binary_prefix') ? ($this->node->statistics()['disk_total'] ?? 0) / 1024 / 1024 / 1024 - : ($this->node->statistics()['disk_total'] ?? 0) / 1000 / 1000 / 1000, maxPrecision: 2); - $used = Number::format(config('panel.use_binary_prefix') + : ($this->node->statistics()['disk_total'] ?? 0) / 1000 / 1000 / 1000; + $used = config('panel.use_binary_prefix') ? ($this->node->statistics()['disk_used'] ?? 0) / 1024 / 1024 / 1024 - : ($this->node->statistics()['disk_used'] ?? 0) / 1000 / 1000 / 1000, maxPrecision: 2); + : ($this->node->statistics()['disk_used'] ?? 0) / 1000 / 1000 / 1000; $unused = $total - $used; + $used = Number::format($used, maxPrecision: 2); + $unused = Number::format($unused, maxPrecision: 2); + return [ 'datasets' => [ [