From ae291442311e38aaa7c373d1660404d1ebeb17f0 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 21 Mar 2018 15:16:37 +0100 Subject: [statistics] Show ID45 partition in green, like ID44 Closes #3325 --- modules-available/statistics/inc/parser.inc.php | 26 +++++++++++++++++++--- .../statistics/templates/machine-hdds.html | 6 ++--- 2 files changed, 26 insertions(+), 6 deletions(-) (limited to 'modules-available/statistics') diff --git a/modules-available/statistics/inc/parser.inc.php b/modules-available/statistics/inc/parser.inc.php index 679055a7..b179b4a3 100644 --- a/modules-available/statistics/inc/parser.inc.php +++ b/modules-available/statistics/inc/parser.inc.php @@ -151,24 +151,44 @@ class Parser { $type = strtolower($out[4]); if ($type === '5' || $type === 'f' || $type === '85') { continue; + } elseif ($type === '44') { + $out[5] = 'OpenSLX-ID44'; + $color = '#5c1'; + } elseif ($type === '45') { + $out[5] = 'OpenSLX-ID45'; + $color = '#0d7'; + } elseif ($type === '82') { + $color = '#48f'; + } else { + $color = '#e55'; } + $partsize = round(($out[3] - $out[2]) * $mbrToMbFactor); $hdd['partitions'][] = array( 'id' => $out[1], 'name' => $out[1], 'size' => round($partsize / 1024, $partsize < 1024 ? 1 : 0), - 'type' => ($type === '44' ? 'OpenSLX' : $out[5]), + 'type' => $out[5], ); $hdd['json'][] = array( 'label' => $out[1], 'value' => $partsize, - 'color' => ($type === '44' ? '#4d4' : ($type === '82' ? '#48f' : '#e55')), + 'color' => $color, ); $hdd['used'] += $partsize; } elseif (isset($hdd) && $sectorToMbFactor !== 0 && preg_match(',^\s*(\d+)\s+(\d+)[\+\-]?\s+(\d+)[\+\-]?\s+\S+\s+([0-9a-f]+)\s+(.*)$,i', $line, $out)) { // --- GPT: Partition entry --- // Some partition $type = $out[5]; + if ($type === 'OpenSLX-ID44') { + $color = '#5c1'; + } elseif ($type === 'OpenSLX-ID45') { + $color = '#0d7'; + } elseif ($type === 'Linux swap') { + $color = '#48f'; + } else { + $color = '#e55'; + } $id = $hdd['devid'] . '-' . $out[1]; $partsize = round(($out[3] - $out[2]) * $sectorToMbFactor); $hdd['partitions'][] = array( @@ -180,7 +200,7 @@ class Parser { $hdd['json'][] = array( 'label' => $id, 'value' => $partsize, - 'color' => ($type === 'OpenSLX-ID44' ? '#4d4' : ($type === 'Linux swap' ? '#48f' : '#e55')), + 'color' => $color, ); $hdd['used'] += $partsize; } diff --git a/modules-available/statistics/templates/machine-hdds.html b/modules-available/statistics/templates/machine-hdds.html index fd6cf1be..b839dfca 100644 --- a/modules-available/statistics/templates/machine-hdds.html +++ b/modules-available/statistics/templates/machine-hdds.html @@ -20,7 +20,7 @@
{{lang_powerOnTime}}: {{s_PowerOnHours}} {{lang_hours}} ({{PowerOnTime}})
{{/s_PowerOnHours}}
-
+
@@ -30,14 +30,14 @@ {{#partitions}} - + {{/partitions}}
{{lang_partName}}
{{name}}{{size}} GiB{{size}} GiB {{type}}
{{lang_total}}: {{size}} GiB
-
+