fix(dashboard): update stopped/running container filters

pull/2119/head
Chaim Lev-Ari 6 years ago committed by Anthony Lapenna
parent 0ae10c6f82
commit 8dfa129129

@ -218,17 +218,20 @@ angular.module('portainer.docker')
return runningTasks;
};
})
.filter('containerswithstatus', function () {
.filter('runningcontainers', function () {
'use strict';
return function (containers, status) {
var containersWithStatus = 0;
for (var i = 0; i < containers.length; i++) {
var container = containers[i];
if (container.Status === status) {
containersWithStatus++;
}
}
return containersWithStatus;
return function runningContainersFilter(containers) {
return containers.filter(function (container) {
return container.State === 'running';
}).length;
};
})
.filter('stoppedcontainers', function () {
'use strict';
return function stoppedContainersFilter(containers) {
return containers.filter(function (container) {
return container.State === 'exited';
}).length;
};
})
.filter('imagestotalsize', function () {

@ -115,8 +115,8 @@
<i class="fa fa-server"></i>
</div>
<div class="pull-right">
<div><i class="fa fa-heartbeat space-right green-icon"></i>{{ containers | containerswithstatus:'running' }} running</div>
<div><i class="fa fa-heartbeat space-right red-icon"></i>{{ containers | containerswithstatus:'stopped' }} stopped</div>
<div><i class="fa fa-heartbeat space-right green-icon"></i>{{ containers | runningcontainers }} running</div>
<div><i class="fa fa-heartbeat space-right red-icon"></i>{{ containers | stoppedcontainers }} stopped</div>
</div>
<div class="title">{{ containers.length }}</div>
<div class="comment">Containers</div>

Loading…
Cancel
Save