mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 09:54:44 +02:00
NodeStorageChart: Format data after math (#931)
This commit is contained in:
parent
7e6769c96e
commit
3411e5e65c
@ -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' => [
|
||||
[
|
||||
|
Loading…
x
Reference in New Issue
Block a user