summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2016-11-14 15:51:04 +0100
committerSimon Rettberg2016-11-14 15:51:04 +0100
commit4bbf74461048d50805b2512535781f18b4661b22 (patch)
tree13583abe9febbe5acb8d4a646f0bb9b7c189d145
parent[locationinfo] Skeleton for new module (diff)
downloadslx-admin-4bbf74461048d50805b2512535781f18b4661b22.tar.gz
slx-admin-4bbf74461048d50805b2512535781f18b4661b22.tar.xz
slx-admin-4bbf74461048d50805b2512535781f18b4661b22.zip
[statistics] Show red hdd icon in client list when filtering by ID44 == 0 and machine has no HDD installed at all
-rw-r--r--modules-available/statistics/inc/filterset.inc.php10
-rw-r--r--modules-available/statistics/page.inc.php12
-rw-r--r--modules-available/statistics/templates/clientlist.html3
3 files changed, 24 insertions, 1 deletions
diff --git a/modules-available/statistics/inc/filterset.inc.php b/modules-available/statistics/inc/filterset.inc.php
index 9676732a..c73feeef 100644
--- a/modules-available/statistics/inc/filterset.inc.php
+++ b/modules-available/statistics/inc/filterset.inc.php
@@ -52,6 +52,16 @@ class FilterSet
$sort = " ORDER BY " . $concreteCol . " " . $this->sortDirection
. ", machineuuid ASC";
}
+
+ public function isNoId44Filter()
+ {
+ foreach ($this->filters as $filter) {
+ if (get_class($filter) === 'Id44Filter' && $filter->argument == 0) {
+ return true;
+ }
+ }
+ return false;
+ }
public function getSortDirection()
{
diff --git a/modules-available/statistics/page.inc.php b/modules-available/statistics/page.inc.php
index 512f7ead..cf33c8af 100644
--- a/modules-available/statistics/page.inc.php
+++ b/modules-available/statistics/page.inc.php
@@ -500,8 +500,13 @@ class Page_Statistics extends Page
{
$filterSet->makeFragments($where, $join, $sort, $args);
+ $xtra = '';
+ if ($filterSet->isNoId44Filter()) {
+ $xtra = ', data';
+ }
$res = Database::simpleQuery('SELECT machineuuid, macaddr, clientip, firstseen, lastseen,'
- . ' logintime, lastboot, realcores, mbram, kvmstate, cpumodel, id44mb, hostname, notes IS NOT NULL AS hasnotes, badsectors FROM machine'
+ . ' logintime, lastboot, realcores, mbram, kvmstate, cpumodel, id44mb, hostname, notes IS NOT NULL AS hasnotes,'
+ . ' badsectors ' . $xtra . ' FROM machine'
. " $join WHERE $where $sort", $args);
$rows = array();
$NOW = time();
@@ -529,6 +534,11 @@ class Page_Statistics extends Page
if (empty($row['hostname'])) {
$row['hostname'] = $row['clientip'];
}
+ if (isset($row['data'])) {
+ if (!preg_match('/^Disk.*bytes$/m', $row['data'])) {
+ $row['nohdd'] = true;
+ }
+ }
$rows[] = $row;
}
Render::addTemplate('clientlist', array(
diff --git a/modules-available/statistics/templates/clientlist.html b/modules-available/statistics/templates/clientlist.html
index 2bac29fa..73148eb8 100644
--- a/modules-available/statistics/templates/clientlist.html
+++ b/modules-available/statistics/templates/clientlist.html
@@ -82,6 +82,9 @@
<span class="glyphicon glyphicon-exclamation-sign"></span>
{{badsectors}}
</div>{{/badsectors}}
+ {{#nohdd}}<div>
+ <span class="glyphicon glyphicon-hdd red"></span>
+ </div>{{/nohdd}}
</td>
<td>{{lang_realCores}}: {{realcores}}<div class="small">{{cpumodel}}</div></td>
</tr>