diff options
author | Simon Rettberg | 2014-06-11 14:31:09 +0200 |
---|---|---|
committer | Simon Rettberg | 2014-06-11 14:31:09 +0200 |
commit | 62d6349c790076ec26edd6e10d617b2f4c385e8b (patch) | |
tree | b2884200b75b34994ddfcfef06bff3d127427e73 | |
parent | Reboot functionality on system status page (diff) | |
download | slx-admin-62d6349c790076ec26edd6e10d617b2f4c385e8b.tar.gz slx-admin-62d6349c790076ec26edd6e10d617b2f4c385e8b.tar.xz slx-admin-62d6349c790076ec26edd6e10d617b2f4c385e8b.zip |
Minor bug fixes and removal of dead code
-rw-r--r-- | inc/render.inc.php | 2 | ||||
-rw-r--r-- | inc/trigger.inc.php | 2 | ||||
-rw-r--r-- | modules/systemstatus.inc.php | 2 | ||||
-rw-r--r-- | modules/vmstore.inc.php | 3 | ||||
-rw-r--r-- | 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 @@ <div class="slx-storechart"> <b>CPU-Last</b> - {{#cpuLoad}} + {{#cpuLoadOk}} <div id="circles-cpuload"></div> <div>Durchschnitt: {{cpuLoad}}%</div> <div>Nur OS: {{cpuSystem}}%</div> <div>Logische CPUs: {{cpuCount}}</div> - {{/cpuLoad}} - {{^cpuLoad}} + {{/cpuLoadOk}} + {{^cpuLoadOk}} Konnte nicht ermittelt werden - {{/cpuLoad}} + {{/cpuLoadOk}} </div> <div class="slx-storechart"> <b>RAM-Nutzung</b> - {{#memPercent}} + {{#memTotal}} <div id="circles-mem"></div> <div>Gesamt: {{memTotal}}</div> <div>Frei: {{memFree}}</div> - {{/memPercent}} - {{^memPercent}} + {{/memTotal}} + {{^memTotal}} Konnte nicht ermittelt werden - {{/memPercent}} + {{/memTotal}} </div> <div class="slx-storechart"> <b>swap-Nutzung</b> - {{#swapPercent}} + {{#memTotal}} <div id="circles-swap"></div> <div>Gesamt: {{swapTotal}}</div> <div>Belegt: {{swapUsed}}</div> - {{/swapPercent}} - {{^swapPercent}} + {{/memTotal}} + {{^memTotal}} Konnte nicht ermittelt werden - {{/swapPercent}} + {{/memTotal}} </div> <div class="clearfix"></div> @@ -45,7 +45,7 @@ {{/swapWarning}} <script type="text/javascript"> - {{#cpuLoad}} + {{#cpuLoadOk}} Circles.create({ id: 'circles-cpuload', radius: 60, @@ -58,8 +58,8 @@ wrpClass: 'circles-wrp', textClass: 'circles-text' }); - {{/cpuLoad}} - {{#memPercent}} + {{/cpuLoadOk}} + {{#memTotal}} Circles.create({ id: 'circles-mem', radius: 60, @@ -72,8 +72,6 @@ wrpClass: 'circles-wrp', textClass: 'circles-text' }); - {{/memPercent}} - {{#swapPercent}} Circles.create({ id: 'circles-swap', radius: 60, @@ -86,5 +84,5 @@ wrpClass: 'circles-wrp', textClass: 'circles-text' }); - {{/swapPercent}} + {{/memTotal}} </script>
\ No newline at end of file |