From 62d6349c790076ec26edd6e10d617b2f4c385e8b Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 11 Jun 2014 14:31:09 +0200 Subject: Minor bug fixes and removal of dead code --- inc/render.inc.php | 2 +- inc/trigger.inc.php | 2 +- modules/systemstatus.inc.php | 2 ++ modules/vmstore.inc.php | 3 --- templates/systemstatus/systeminfo.html | 34 ++++++++++++++++------------------ 5 files changed, 20 insertions(+), 23 deletions(-) diff --git a/inc/render.inc.php b/inc/render.inc.php index 2d69c322..802944f4 100644 --- a/inc/render.inc.php +++ b/inc/render.inc.php @@ -164,7 +164,7 @@ class Render */ public static function parse($template, $params = false) { - if (is_array($params) || $params === false) + if (is_array($params) || $params === false || is_null($params)) $params['token'] = Session::get('token'); return self::$mustache->render(self::getTemplate($template), $params); } diff --git a/inc/trigger.inc.php b/inc/trigger.inc.php index f483bfc0..2fde45ab 100644 --- a/inc/trigger.inc.php +++ b/inc/trigger.inc.php @@ -70,7 +70,7 @@ class Trigger $storetype = $vmstore['storetype']; if ($storetype === 'nfs') $addr = $vmstore['nfsaddr']; if ($storetype === 'cifs') $addr = $vmstore['cifsaddr']; - if ($storetype === 'internal') $addr = 'none'; + if ($storetype === 'internal') $addr = 'null'; return Taskmanager::submit('MountVmStore', array( 'address' => $addr, 'type' => 'images', diff --git a/modules/systemstatus.inc.php b/modules/systemstatus.inc.php index bfef54ef..a83a8919 100644 --- a/modules/systemstatus.inc.php +++ b/modules/systemstatus.inc.php @@ -9,6 +9,7 @@ class Page_SystemStatus extends Page User::load(); if (!User::isLoggedIn()) { + Message::addError('no-permission'); Util::redirect('?do=Main'); } @@ -153,6 +154,7 @@ class Page_SystemStatus extends Page $total = $out['user'] + $out['nice'] + $out['system'] + $out['idle'] + $out['iowait'] + $out['irq'] + $out['softirq']; $data['cpuLoad'] = 100 - round(($out['idle'] / $total) * 100); $data['cpuSystem'] = round((($out['iowait'] + $out['irq'] + $out['softirq']) / $total) * 100); + $data['cpuLoadOk'] = true; } echo Render::parse('systemstatus/systeminfo', $data); } diff --git a/modules/vmstore.inc.php b/modules/vmstore.inc.php index 9c8e5f42..8037d038 100644 --- a/modules/vmstore.inc.php +++ b/modules/vmstore.inc.php @@ -56,9 +56,6 @@ class Page_VmStore extends Page Message::addError('value-invalid', 'nfsaddr', $vmstore['nfsaddr']); Util::redirect('?do=VmStore'); } - if ($storetype === 'nfs') $addr = $vmstore['nfsaddr']; - if ($storetype === 'cifs') $addr = $vmstore['nfsaddr']; - if ($storetype === 'internal') $addr = 'none'; Property::setVmStoreConfig($vmstore); $this->mountTask = Trigger::mount(); } diff --git a/templates/systemstatus/systeminfo.html b/templates/systemstatus/systeminfo.html index 86aefe8f..39b5d7c4 100644 --- a/templates/systemstatus/systeminfo.html +++ b/templates/systemstatus/systeminfo.html @@ -1,38 +1,38 @@
CPU-Last - {{#cpuLoad}} + {{#cpuLoadOk}}
Durchschnitt: {{cpuLoad}}%
Nur OS: {{cpuSystem}}%
Logische CPUs: {{cpuCount}}
- {{/cpuLoad}} - {{^cpuLoad}} + {{/cpuLoadOk}} + {{^cpuLoadOk}} Konnte nicht ermittelt werden - {{/cpuLoad}} + {{/cpuLoadOk}}
RAM-Nutzung - {{#memPercent}} + {{#memTotal}}
Gesamt: {{memTotal}}
Frei: {{memFree}}
- {{/memPercent}} - {{^memPercent}} + {{/memTotal}} + {{^memTotal}} Konnte nicht ermittelt werden - {{/memPercent}} + {{/memTotal}}
swap-Nutzung - {{#swapPercent}} + {{#memTotal}}
Gesamt: {{swapTotal}}
Belegt: {{swapUsed}}
- {{/swapPercent}} - {{^swapPercent}} + {{/memTotal}} + {{^memTotal}} Konnte nicht ermittelt werden - {{/swapPercent}} + {{/memTotal}}
@@ -45,7 +45,7 @@ {{/swapWarning}} \ No newline at end of file -- cgit v1.2.3-55-g7522