Merge pull request #1502 from notFloran/webui-per-cpu

Better display of per-cpu plugin with a lot of cpus
This commit is contained in:
Nicolas Hennion 2019-07-06 18:43:35 +02:00 committed by GitHub
commit e8a8b4666f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17406 additions and 17398 deletions

View File

@ -1,7 +1,8 @@
import _ from "lodash";
export default function GlancesPluginPercpuController($scope, GlancesStats, GlancesPluginHelper) {
var vm = this;
vm.cpus = [];
vm.cpusChunks = [];
vm.$onInit = function () {
loadData(GlancesStats.getData());
@ -14,12 +15,12 @@ export default function GlancesPluginPercpuController($scope, GlancesStats, Glan
var loadData = function (data) {
var percpuStats = data.stats['percpu'];
vm.cpus = [];
var cpus = [];
for (var i = 0; i < percpuStats.length; i++) {
var cpuData = percpuStats[i];
vm.cpus.push({
cpus.push({
'number': cpuData.cpu_number,
'total': cpuData.total,
'user': cpuData.user,
@ -29,7 +30,9 @@ export default function GlancesPluginPercpuController($scope, GlancesStats, Glan
'steal': cpuData.steal
});
}
}
vm.cpusChunks = _.chunk(cpus, 4);
};
vm.getUserAlert = function (cpu) {
return GlancesPluginHelper.getAlert('percpu', 'percpu_user_', cpu.user)

View File

@ -1,37 +1,37 @@
<section id="percpu" class="plugin">
<div class="table">
<div class="table" ng-repeat="cpus in vm.cpusChunks">
<div class="table-row">
<div class="table-cell text-left title">PER CPU</div>
<div class="table-cell" ng-repeat="percpu in vm.cpus track by percpu.number">{{ percpu.total }}%</div>
<div class="table-cell text-left title"><span ng-if="$first">PER CPU</span></div>
<div class="table-cell" ng-repeat="percpu in cpus track by percpu.number">{{ percpu.total }}%</div>
</div>
<div class="table-row">
<div class="table-cell text-left">user:</div>
<div class="table-cell" ng-repeat="percpu in vm.cpus track by percpu.number"
<div class="table-cell" ng-repeat="percpu in cpus track by percpu.number"
ng-class="vm.getUserAlert(percpu)">
{{ percpu.user }}%
</div>
</div>
<div class="table-row">
<div class="table-cell text-left">system:</div>
<div class="table-cell" ng-repeat="percpu in vm.cpus track by percpu.number"
<div class="table-cell" ng-repeat="percpu in cpus track by percpu.number"
ng-class="vm.getSystemAlert(percpu)">
{{ percpu.system }}%
</div>
</div>
<div class="table-row">
<div class="table-cell text-left">idle:</div>
<div class="table-cell" ng-repeat="percpu in vm.cpus track by percpu.number">{{ percpu.idle }}%</div>
<div class="table-cell" ng-repeat="percpu in cpus track by percpu.number">{{ percpu.idle }}%</div>
</div>
<div class="table-row" ng-if="vm.cpus[0].iowait">
<div class="table-cell text-left">iowait:</div>
<div class="table-cell" ng-repeat="percpu in vm.cpus track by percpu.number"
<div class="table-cell" ng-repeat="percpu in cpus track by percpu.number"
ng-class="vm.getSystemAlert(percpu)">
{{ percpu.iowait }}%
</div>
</div>
<div class="table-row" ng-if="vm.cpus[0].steal">
<div class="table-cell text-left">steal:</div>
<div class="table-cell" ng-repeat="percpu in vm.cpus track by percpu.number"
<div class="table-cell" ng-repeat="percpu in cpus track by percpu.number"
ng-class="vm.getSystemAlert(percpu)">
{{ percpu.steal }}%
</div>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long