Skip to content

Commit

Permalink
Limit to 5 FS gauges in a stable way.
Browse files Browse the repository at this point in the history
The first 5 gauges on the list may not be the same as the first 5 gauges
being displayed.
  • Loading branch information
vmarmol committed Jan 5, 2015
1 parent 3df5d4f commit dbfcce4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pages/static/containers_js.go
Original file line number Diff line number Diff line change
Expand Up @@ -1635,16 +1635,21 @@ function drawOverallUsage(elementId, machineInfo, containerInfo) {

var numGauges = gauges.length;
if (cur.filesystem) {
// Limit the number of filesystem gauges displayed to 5.
// 'Filesystem details' section still shows information for all filesystems.
for (var i = 0; i < cur.filesystem.length && i < 5; i++) {
for (var i = 0; i < cur.filesystem.length; i++) {
var data = cur.filesystem[i];
var totalUsage = Math.floor((data.usage * 100.0) / data.capacity);
var els = window.cadvisor.fsUsage.elements[data.device];

// Update the gauges.
// Update the gauges in the right order.
gauges[numGauges + els.index] = ['FS #' + (els.index + 1), totalUsage];
}

// Limit the number of filesystem gauges displayed to 5.
// 'Filesystem details' section still shows information for all filesystems.
var max_gauges = numGauges + 5;
if (gauges.length > max_gauges) {
gauges = gauges.slice(0, max_gauges);
}
}

drawGauges(elementId, gauges);
Expand Down

0 comments on commit dbfcce4

Please sign in to comment.