Merge pull request #850 from notFloran/webui-fix-cpu-hide-data

[WebUI] Hide additional cpu data if not available
This commit is contained in:
Nicolas Hennion 2016-04-19 22:40:52 +02:00
commit 7fd7239a91
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,11 +27,23 @@ 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;
if (data.ctx_switches) {
this.ctx_switches = Math.floor(data.ctx_switches / data.time_since_update); this.ctx_switches = Math.floor(data.ctx_switches / data.time_since_update);
}
if (data.interrupts) {
this.interrupts = Math.floor(data.interrupts / data.time_since_update); 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); 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.syscalls = Math.floor(data.syscalls / data.time_since_update);
} }
}
this.getDecoration = function(value) { this.getDecoration = function(value) {
if(_view[value] == undefined) { if(_view[value] == undefined) {