From 2fab92b81927328f9175d2acbb653254cd2e6d2d Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 2 Dec 2016 16:12:36 +0100 Subject: [statistics] Use new decollapser on front page --- modules-available/statistics/page.inc.php | 17 ++++++++++------- modules-available/statistics/templates/cpumodels.html | 11 ++++++++++- modules-available/statistics/templates/id44.html | 11 ++++++++++- modules-available/statistics/templates/memory.html | 11 ++++++++++- modules-available/statistics/templates/newclients.html | 18 +++++------------- 5 files changed, 45 insertions(+), 23 deletions(-) diff --git a/modules-available/statistics/page.inc.php b/modules-available/statistics/page.inc.php index ab7d589c..02fed85b 100644 --- a/modules-available/statistics/page.inc.php +++ b/modules-available/statistics/page.inc.php @@ -224,7 +224,7 @@ class Page_Statistics extends Page } - private function capChart(&$json, $cutoff, $minSlice = 0.015) + private function capChart(&$json, &$rows, $cutoff, $minSlice = 0.015) { $total = 0; foreach ($json as $entry) { @@ -243,6 +243,9 @@ class Page_Statistics extends Page ++$id; $accounted += $entry['value']; } + for ($i = $id; $i < count($rows); ++$i) { + $rows[$i]['collapse'] = 'collapse'; + } $json = array_slice($json, 0, $id); if ($accounted / $total < 0.99) { $json[] = array( @@ -333,7 +336,7 @@ class Page_Statistics extends Page ); ++$id; } - $this->capChart($json, 0.92); + $this->capChart($json, $lines, 0.92); Render::addTemplate('cpumodels', array('rows' => $lines, 'query' => $this->query, 'json' => json_encode($json))); } @@ -379,7 +382,7 @@ class Page_Statistics extends Page ); ++$id; } - $this->capChart($json, 0.92); + $this->capChart($json, $data['rows'], 0.92); $data['json'] = json_encode($json); $data['query'] = $this->query; Render::addTemplate('memory', $data); @@ -455,7 +458,7 @@ class Page_Statistics extends Page 'value' => $v, ); } - $this->capChart($json, 0.95); + $this->capChart($json, $data['rows'], 0.95); $data['json'] = json_encode($json); $data['query'] = $this->query; Render::addTemplate('id44', $data); @@ -468,7 +471,7 @@ class Page_Statistics extends Page { $filterSet->makeFragments($where, $join, $sort, $args); - $args['cutoff'] = ceil(time() / 3600) * 3600 - 86400 * 7; + $args['cutoff'] = ceil(time() / 3600) * 3600 - 86400 * 10; $res = Database::simpleQuery("SELECT machineuuid, clientip, hostname, firstseen, mbram, kvmstate, id44mb FROM machine $join" . " WHERE firstseen > :cutoff AND $where ORDER BY firstseen DESC LIMIT 32", $args); @@ -486,7 +489,7 @@ class Page_Statistics extends Page $row['hddclass'] = $this->hddColorClass($row['gbtmp']); $row['kvmicon'] = $row['kvmstate'] === 'ENABLED' ? '✓' : '✗'; if (++$count > 5) { - $row['style'] = 'display:none'; + $row['collapse'] = 'collapse'; } $rows[] = $row; } @@ -535,7 +538,7 @@ class Page_Statistics extends Page $row['hostname'] = $row['clientip']; } if (isset($row['data'])) { - if (!preg_match('/^Disk.*bytes$/m', $row['data'])) { + if (!preg_match('/^(Disk.* bytes|Disk.*\d{5,} sectors)/m', $row['data'])) { $row['nohdd'] = true; } } diff --git a/modules-available/statistics/templates/cpumodels.html b/modules-available/statistics/templates/cpumodels.html index 20da4697..d9b0298b 100644 --- a/modules-available/statistics/templates/cpumodels.html +++ b/modules-available/statistics/templates/cpumodels.html @@ -13,7 +13,7 @@ {{lang_modelCount}} {{#rows}} - + {{/rows}} + + +
{{systemmodel}} @@ -25,6 +25,15 @@ {{count}}
+ + + + + +
diff --git a/modules-available/statistics/templates/id44.html b/modules-available/statistics/templates/id44.html index 84b515d1..38cf028f 100644 --- a/modules-available/statistics/templates/id44.html +++ b/modules-available/statistics/templates/id44.html @@ -12,13 +12,22 @@ {{lang_machineCount}} {{#rows}} - + {{gb}} GiB {{count}} {{/rows}} + + + + + + + + +
diff --git a/modules-available/statistics/templates/memory.html b/modules-available/statistics/templates/memory.html index ae040674..f17f55ca 100644 --- a/modules-available/statistics/templates/memory.html +++ b/modules-available/statistics/templates/memory.html @@ -12,13 +12,22 @@ {{lang_machineCount}} {{#rows}} - + {{gb}} GiB {{count}} {{/rows}} + + + + + + + + +
diff --git a/modules-available/statistics/templates/newclients.html b/modules-available/statistics/templates/newclients.html index e7d79818..c5c704d1 100644 --- a/modules-available/statistics/templates/newclients.html +++ b/modules-available/statistics/templates/newclients.html @@ -4,7 +4,7 @@ {{lang_newMachines}}
- +
@@ -13,7 +13,7 @@ {{#rows}} - + @@ -21,23 +21,15 @@ {{/rows}} - {{#openbutton}} - - + - {{/openbutton}}
{{lang_machine}} HDD
{{hostname}} {{firstseen}} {{kvmicon}}{{gbtmp}} GiB
+
- + -
-- cgit v1.2.3-55-g7522