Skip to content

Commit

Permalink
fix(dashboard): update stopped/running container filters
Browse files Browse the repository at this point in the history
  • Loading branch information
chiptus authored and deviantony committed Aug 6, 2018
1 parent 0ae10c6 commit 8dfa129
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
23 changes: 13 additions & 10 deletions app/docker/filters/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
4 changes: 2 additions & 2 deletions app/docker/views/dashboard/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 8dfa129

Please sign in to comment.