summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics
diff options
context:
space:
mode:
authorSimon Rettberg2018-03-21 15:16:37 +0100
committerSimon Rettberg2018-03-21 15:16:37 +0100
commitae291442311e38aaa7c373d1660404d1ebeb17f0 (patch)
tree7f2056ba69f6c323d5b46eaf6188889bda3d14a4 /modules-available/statistics
parent[inc/Util] readableFileSize: Remove superfluous round() (diff)
downloadslx-admin-ae291442311e38aaa7c373d1660404d1ebeb17f0.tar.gz
slx-admin-ae291442311e38aaa7c373d1660404d1ebeb17f0.tar.xz
slx-admin-ae291442311e38aaa7c373d1660404d1ebeb17f0.zip
[statistics] Show ID45 partition in green, like ID44
Closes #3325
Diffstat (limited to 'modules-available/statistics')
-rw-r--r--modules-available/statistics/inc/parser.inc.php26
-rw-r--r--modules-available/statistics/templates/machine-hdds.html6
2 files changed, 26 insertions, 6 deletions
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 @@
<div>{{lang_powerOnTime}}: {{s_PowerOnHours}}&thinsp;{{lang_hours}} ({{PowerOnTime}})</div>
{{/s_PowerOnHours}}
<div class="row">
- <div class="col-sm-6">
+ <div class="col-sm-7">
<table class="table table-condensed table-striped table-responsive">
<tr>
<th>{{lang_partName}}</th>
@@ -30,14 +30,14 @@
{{#partitions}}
<tr id="{{id}}">
<td>{{name}}</td>
- <td class="text-right">{{size}}&thinsp;GiB</td>
+ <td class="text-right text-nowrap">{{size}}&thinsp;GiB</td>
<td>{{type}}</td>
</tr>
{{/partitions}}
</table>
<div class="slx-bold">{{lang_total}}: {{size}}&thinsp;GiB</div>
</div>
- <div class="col-sm-6">
+ <div class="col-sm-5">
<canvas id="{{devid}}-chart" style="width:100%;height:250px"></canvas>
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function() {