|
- {{ container.State }} |
+ {{ container.Status|containerstatus }} |
{{ container|swarmcontainername}} |
{{ container|containername}} |
- {{ container.IP ? container.IP : '-' }} |
+ {{ container.IP ? container.IP : '-' }} |
{{ container|swarmhostname}} |
{{ container.Image }} |
{{ container.Command|truncate:60 }} |
diff --git a/app/components/containers/containersController.js b/app/components/containers/containersController.js
index 76fc50428..b7662e243 100644
--- a/app/components/containers/containersController.js
+++ b/app/components/containers/containersController.js
@@ -4,6 +4,7 @@ function ($scope, Container, Settings, Messages, Config, errorMsgFilter) {
$scope.state = {};
$scope.state.displayAll = Settings.displayAll;
+ $scope.state.displayIP = false;
$scope.sortType = 'State';
$scope.sortReverse = true;
$scope.state.selectedItemCount = 0;
@@ -22,7 +23,11 @@ function ($scope, Container, Settings, Messages, Config, errorMsgFilter) {
containers = hideContainers(d);
}
$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();
});
diff --git a/app/shared/filters.js b/app/shared/filters.js
index 4b5b93700..f1b40abfb 100644
--- a/app/shared/filters.js
+++ b/app/shared/filters.js
@@ -21,16 +21,31 @@ angular.module('dockerui.filters', [])
.filter('containerstatusbadge', function () {
'use strict';
return function (text) {
- if (text === 'paused') {
+ var status = _.toLower(text);
+ if (status.indexOf('paused') !== -1) {
return 'warning';
- } else if (text === 'created') {
+ } else if (status.indexOf('created') !== -1) {
return 'info';
- } else if (text === 'exited') {
+ } else if (status.indexOf('exited') !== -1) {
return 'danger';
}
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 () {
'use strict';
return function (text) {
diff --git a/app/shared/viewmodel.js b/app/shared/viewmodel.js
index 901a2fd86..1b222692e 100644
--- a/app/shared/viewmodel.js
+++ b/app/shared/viewmodel.js
@@ -10,9 +10,12 @@ function ImageViewModel(data) {
function ContainerViewModel(data) {
this.Id = data.Id;
- this.State = data.State;
+ this.Status = data.Status;
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.Command = data.Command;
this.Checked = false;