[WebUI] Hide additional cpu data if not available

This commit is contained in:
Floran Brutel 2016-04-17 19:12:19 +02:00
parent b5e59d3e3a
commit 48261e9673
2 changed files with 20 additions and 8 deletions

View File

@ -53,25 +53,25 @@
</div> </div>
<div class="hidden-xs hidden-sm hidden-md col-lg-8"> <div class="hidden-xs hidden-sm hidden-md col-lg-8">
<div class="table"> <div class="table">
<div class="table-row"> <div class="table-row" ng-if="statsCpu.ctx_switches">
<div class="table-cell text-left">ctx_sw:</div> <div class="table-cell text-left">ctx_sw:</div>
<div class="table-cell" ng-class="statsCpu.getDecoration('ctx_switches')"> <div class="table-cell" ng-class="statsCpu.getDecoration('ctx_switches')">
{{ statsCpu.ctx_switches }} {{ statsCpu.ctx_switches }}
</div> </div>
</div> </div>
<div class="table-row"> <div class="table-row" ng-if="statsCpu.interrupts">
<div class="table-cell text-left">inter:</div> <div class="table-cell text-left">inter:</div>
<div class="table-cell"> <div class="table-cell">
{{ statsCpu.interrupts }} {{ statsCpu.interrupts }}
</div> </div>
</div> </div>
<div class="table-row"> <div class="table-row" ng-if="statsCpu.soft_interrupts">
<div class="table-cell text-left">sw_int:</div> <div class="table-cell text-left">sw_int:</div>
<div class="table-cell"> <div class="table-cell">
{{ statsCpu.soft_interrupts }} {{ statsCpu.soft_interrupts }}
</div> </div>
</div> </div>
<div class="table-row" ng-show="!statsSystem.isLinux()"> <div class="table-row" ng-if="!statsSystem.isLinux() && statsCpu.syscalls">
<div class="table-cell text-left">syscal:</div> <div class="table-cell text-left">syscal:</div>
<div class="table-cell"> <div class="table-cell">
{{ statsCpu.syscalls }} {{ statsCpu.syscalls }}

View File

@ -27,10 +27,22 @@ glancesApp.service('GlancesPluginCpu', function() {
this.irq = data.irq; this.irq = data.irq;
this.iowait = data.iowait; this.iowait = data.iowait;
this.steal = data.steal; this.steal = data.steal;
this.ctx_switches = Math.floor(data.ctx_switches / data.time_since_update);
this.interrupts = Math.floor(data.interrupts / data.time_since_update); if (data.ctx_switches) {
this.soft_interrupts = Math.floor(data.soft_interrupts / data.time_since_update); this.ctx_switches = Math.floor(data.ctx_switches / data.time_since_update);
this.syscalls = Math.floor(data.syscalls / data.time_since_update); }
if (data.interrupts) {
this.interrupts = Math.floor(data.interrupts / data.time_since_update);
}
if (data.soft_interrupts) {
this.soft_interrupts = Math.floor(data.soft_interrupts / data.time_since_update);
}
if (data.syscalls) {
this.syscalls = Math.floor(data.syscalls / data.time_since_update);
}
} }
this.getDecoration = function(value) { this.getDecoration = function(value) {