mirror of https://github.com/portainer/portainer
feat(containers): add the ability to filter by state (#410)
parent
ce32ed5b98
commit
03456ddcf8
|
@ -85,7 +85,7 @@
|
|||
<tbody>
|
||||
<tr dir-paginate="container in (state.filteredContainers = ( containers | filter:state.filter | orderBy:sortType:sortReverse | itemsPerPage: pagination_count))">
|
||||
<td><input type="checkbox" ng-model="container.Checked" ng-change="selectItem(container)"/></td>
|
||||
<td><span class="label label-{{ container.Status|containerstatusbadge }}">{{ container.Status|containerstatus }}</span></td>
|
||||
<td><span class="label label-{{ container.Status|containerstatusbadge }}">{{ container.Status }}</span></td>
|
||||
<td ng-if="endpointMode.provider === 'DOCKER_SWARM'"><a ui-sref="container({id: container.Id})">{{ container|swarmcontainername}}</a></td>
|
||||
<td ng-if="endpointMode.provider !== 'DOCKER_SWARM'"><a ui-sref="container({id: container.Id})">{{ container|containername}}</a></td>
|
||||
<td><a ui-sref="image({id: container.Image})">{{ container.Image }}</a></td>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
angular.module('containers', [])
|
||||
.controller('ContainersController', ['$scope', 'Container', 'ContainerHelper', 'Info', 'Settings', 'Messages', 'Config',
|
||||
function ($scope, Container, ContainerHelper, Info, Settings, Messages, Config) {
|
||||
.controller('ContainersController', ['$scope', '$filter', 'Container', 'ContainerHelper', 'Info', 'Settings', 'Messages', 'Config',
|
||||
function ($scope, $filter, Container, ContainerHelper, Info, Settings, Messages, Config) {
|
||||
$scope.state = {};
|
||||
$scope.state.displayAll = Settings.displayAll;
|
||||
$scope.state.displayIP = false;
|
||||
|
@ -23,6 +23,8 @@ function ($scope, Container, ContainerHelper, Info, Settings, Messages, Config)
|
|||
}
|
||||
$scope.containers = containers.map(function (container) {
|
||||
var model = new ContainerViewModel(container);
|
||||
model.Status = $filter('containerstatus')(model.Status);
|
||||
|
||||
if (model.IP) {
|
||||
$scope.state.displayIP = true;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ angular.module('portainer.filters', [])
|
|||
return 'warning';
|
||||
} else if (status.indexOf('created') !== -1) {
|
||||
return 'info';
|
||||
} else if (status.indexOf('exited') !== -1) {
|
||||
} else if (status.indexOf('stopped') !== -1) {
|
||||
return 'danger';
|
||||
}
|
||||
return 'success';
|
||||
|
|
|
@ -53,6 +53,7 @@ function ServiceViewModel(data) {
|
|||
function ContainerViewModel(data) {
|
||||
this.Id = data.Id;
|
||||
this.Status = data.Status;
|
||||
this.State = data.State;
|
||||
this.Names = data.Names;
|
||||
// Unavailable in Docker < 1.10
|
||||
if (data.NetworkSettings && !_.isEmpty(data.NetworkSettings.Networks)) {
|
||||
|
|
Loading…
Reference in New Issue