Skip to content

Commit

Permalink
Wings gives us bytes, use helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
notAreYouScared committed Jan 12, 2025
1 parent 6e92d8d commit 1d36023
Showing 1 changed file with 3 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ protected function getData(): array
/** @var Node $node */
$node = $this->record;

$total = Number::format(config('panel.use_binary_prefix') ? ($node->statistics()['disk_total'] ?? 0) / 1024 / 1024 / 1024 : ($node->statistics()['disk_total'] ?? 0) / 1000 / 1000 / 1000, maxPrecision: 2, locale: auth()->user()->language);
$used = Number::format(config('panel.use_binary_prefix') ? ($node->statistics()['disk_used'] ?? 0) / 1024 / 1024 / 1024 : ($node->statistics()['disk_used'] ?? 0) / 1000 / 1000 / 1000, maxPrecision: 2, locale: auth()->user()->language);
$total = Number::format(($node->statistics()['disk_total'] ?? 0) / 1024 / 1024 / 1024, maxPrecision: 2, locale: auth()->user()->language);
$used = Number::format(($node->statistics()['disk_used'] ?? 0) / 1024 / 1024 / 1024, maxPrecision: 2, locale: auth()->user()->language);

$unused = $total - $used;

Expand Down Expand Up @@ -73,17 +73,6 @@ public function getHeading(): string
/** @var Node $node */
$node = $this->record;

$diskTotal = $node->statistics()['disk_total'];
$diskUsed = $node->statistics()['disk_used'];

$used = config('panel.use_binary_prefix')
? Number::format($diskUsed / 1024 / 1024 / 1024, maxPrecision: 2, locale: auth()->user()->language) .' GiB'
: Number::format($diskUsed / 1000 / 1000 / 1000, maxPrecision: 2, locale: auth()->user()->language) . ' GB';

$total = config('panel.use_binary_prefix')
? Number::format($diskTotal / 1024 / 1024 / 1024, maxPrecision: 2, locale: auth()->user()->language) .' GiB'
: Number::format($diskTotal / 1000 / 1000 / 1000, maxPrecision: 2, locale: auth()->user()->language) . ' GB';

return 'Storage - ' . $used . ' Of ' . $total;
return 'Storage - ' . convert_bytes_to_readable($node->statistics()['disk_used'] ?? 0) . ' Of ' . convert_bytes_to_readable($node->statistics()['disk_total'] ?? 0);
}
}

0 comments on commit 1d36023

Please sign in to comment.