summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics/pages
diff options
context:
space:
mode:
authorSimon Rettberg2022-07-06 15:56:29 +0200
committerSimon Rettberg2022-07-06 15:56:29 +0200
commitae128c579ba1b06ee740ea5f07919cf4f33f340f (patch)
treeebdad61ec014babaffedf9bcc541b7fc179c33c6 /modules-available/statistics/pages
parent[dnbd3/vmstore] Add selection for DNBD3 server, or NFS mode, show any errors (diff)
downloadslx-admin-ae128c579ba1b06ee740ea5f07919cf4f33f340f.tar.gz
slx-admin-ae128c579ba1b06ee740ea5f07919cf4f33f340f.tar.xz
slx-admin-ae128c579ba1b06ee740ea5f07919cf4f33f340f.zip
[statistics] Fix Chart.js for HDD view
Diffstat (limited to 'modules-available/statistics/pages')
-rw-r--r--modules-available/statistics/pages/machine.inc.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules-available/statistics/pages/machine.inc.php b/modules-available/statistics/pages/machine.inc.php
index 5bf5ec97..df6a561e 100644
--- a/modules-available/statistics/pages/machine.inc.php
+++ b/modules-available/statistics/pages/machine.inc.php
@@ -548,6 +548,8 @@ class SubPage
private static function mangleHdd(array &$hdd)
{
+ static $hddidx = 0;
+ $hdd['hddidx'] = $hddidx++;
$hours = $hdd['power_on_time//hours'] ?? $hdd['attr_9']['raw'] ?? $hdd['power_on_hours']
?? $hdd['power_on_time']['hours'] ?? null;
if ($hours !== null) {
@@ -575,14 +577,16 @@ class SubPage
$json = [];
$lastEnd = 0;
$minDisplaySize = $hdd['size'] / 150;
+ $i = 0;
foreach ($hdd['partitions'] as &$part) {
$dist = $part['start'] - $lastEnd;
if ($dist > $minDisplaySize) {
- error_log('Dist: ' . Util::readableFileSize($dist));
$json[] = ['value' => $dist, 'color' => '#aaa'];
+ $i++;
}
if ($part['size'] > $minDisplaySize) {
- $json[] = ['value' => $part['size'], 'color' => self::typeToColor($part), 'label' => $part['id']];
+ $json[] = ['value' => $part['size'], 'color' => self::typeToColor($part)];
+ $part['idx'] = $i++;
}
$part['size_s'] = Util::readableFileSize($part['size']);
$used += $part['size'];