feat(ui): docker 1.9 support (#65)

pull/67/head
Anthony Lapenna 9 years ago committed by GitHub
parent 1fb008212a
commit 71c091ae0d

@ -39,7 +39,7 @@
<tr> <tr>
<th></th> <th></th>
<th> <th>
<a ui-sref="containers" ng-click="order('State')"> <a ui-sref="containers" ng-click="order('Status')">
State State
<span ng-show="sortType == 'State' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span> <span ng-show="sortType == 'State' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span>
<span ng-show="sortType == 'State' && sortReverse" class="glyphicon glyphicon-chevron-up"></span> <span ng-show="sortType == 'State' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
@ -52,7 +52,7 @@
<span ng-show="sortType == 'Names' && sortReverse" class="glyphicon glyphicon-chevron-up"></span> <span ng-show="sortType == 'Names' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
</a> </a>
</th> </th>
<th> <th ng-if="state.displayIP">
<a ui-sref="containers" ng-click="order('IP')"> <a ui-sref="containers" ng-click="order('IP')">
IP Address IP Address
<span ng-show="sortType == 'IP' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span> <span ng-show="sortType == 'IP' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span>
@ -85,10 +85,10 @@
<tbody> <tbody>
<tr ng-repeat="container in (state.filteredContainers = ( containers | filter:state.filter | orderBy:sortType:sortReverse))"> <tr ng-repeat="container in (state.filteredContainers = ( containers | filter:state.filter | orderBy:sortType:sortReverse))">
<td><input type="checkbox" ng-model="container.Checked" ng-change="selectItem(container)"/></td> <td><input type="checkbox" ng-model="container.Checked" ng-change="selectItem(container)"/></td>
<td><span class="label label-{{ container.State|containerstatusbadge }}">{{ container.State }}</span></td> <td><span class="label label-{{ container.Status|containerstatusbadge }}">{{ container.Status|containerstatus }}</span></td>
<td ng-if="swarm"><a ui-sref="container({id: container.Id})">{{ container|swarmcontainername}}</a></td> <td ng-if="swarm"><a ui-sref="container({id: container.Id})">{{ container|swarmcontainername}}</a></td>
<td ng-if="!swarm"><a ui-sref="container({id: container.Id})">{{ container|containername}}</a></td> <td ng-if="!swarm"><a ui-sref="container({id: container.Id})">{{ container|containername}}</a></td>
<td>{{ container.IP ? container.IP : '-' }}</td> <td ng-if="state.displayIP">{{ container.IP ? container.IP : '-' }}</td>
<td ng-if="swarm">{{ container|swarmhostname}}</td> <td ng-if="swarm">{{ container|swarmhostname}}</td>
<td><a ui-sref="image({id: container.Image})">{{ container.Image }}</a></td> <td><a ui-sref="image({id: container.Image})">{{ container.Image }}</a></td>
<td>{{ container.Command|truncate:60 }}</td> <td>{{ container.Command|truncate:60 }}</td>

@ -4,6 +4,7 @@ function ($scope, Container, Settings, Messages, Config, errorMsgFilter) {
$scope.state = {}; $scope.state = {};
$scope.state.displayAll = Settings.displayAll; $scope.state.displayAll = Settings.displayAll;
$scope.state.displayIP = false;
$scope.sortType = 'State'; $scope.sortType = 'State';
$scope.sortReverse = true; $scope.sortReverse = true;
$scope.state.selectedItemCount = 0; $scope.state.selectedItemCount = 0;
@ -22,7 +23,11 @@ function ($scope, Container, Settings, Messages, Config, errorMsgFilter) {
containers = hideContainers(d); containers = hideContainers(d);
} }
$scope.containers = containers.map(function (container) { $scope.containers = containers.map(function (container) {
return new ContainerViewModel(container); var model = new ContainerViewModel(container);
if (model.IP) {
$scope.state.displayIP = true;
}
return model;
}); });
$('#loadContainersSpinner').hide(); $('#loadContainersSpinner').hide();
}); });

@ -21,16 +21,31 @@ angular.module('dockerui.filters', [])
.filter('containerstatusbadge', function () { .filter('containerstatusbadge', function () {
'use strict'; 'use strict';
return function (text) { return function (text) {
if (text === 'paused') { var status = _.toLower(text);
if (status.indexOf('paused') !== -1) {
return 'warning'; return 'warning';
} else if (text === 'created') { } else if (status.indexOf('created') !== -1) {
return 'info'; return 'info';
} else if (text === 'exited') { } else if (status.indexOf('exited') !== -1) {
return 'danger'; return 'danger';
} }
return 'success'; return 'success';
}; };
}) })
.filter('containerstatus', function () {
'use strict';
return function (text) {
var status = _.toLower(text);
if (status.indexOf('paused') !== -1) {
return 'paused';
} else if (status.indexOf('created') !== -1) {
return 'created';
} else if (status.indexOf('exited') !== -1) {
return 'stopped';
}
return 'running';
};
})
.filter('nodestatusbadge', function () { .filter('nodestatusbadge', function () {
'use strict'; 'use strict';
return function (text) { return function (text) {

@ -10,9 +10,12 @@ function ImageViewModel(data) {
function ContainerViewModel(data) { function ContainerViewModel(data) {
this.Id = data.Id; this.Id = data.Id;
this.State = data.State; this.Status = data.Status;
this.Names = data.Names; this.Names = data.Names;
this.IP = data.NetworkSettings.Networks[Object.keys(data.NetworkSettings.Networks)[0]].IPAddress; // Unavailable in Docker < 1.10
if (data.NetworkSettings) {
this.IP = data.NetworkSettings.Networks[Object.keys(data.NetworkSettings.Networks)[0]].IPAddress;
}
this.Image = data.Image; this.Image = data.Image;
this.Command = data.Command; this.Command = data.Command;
this.Checked = false; this.Checked = false;

Loading…
Cancel
Save