fix(containers): add support for the 'dead' status (#1048)

pull/1052/head
Anthony Lapenna 7 years ago committed by GitHub
parent 57fde5ae7c
commit 29d66bfd97

@ -1,3 +1,9 @@
function includeString(text, values) {
return values.some(function(val){
return text.indexOf(val) !== -1;
});
}
angular.module('portainer.filters', [])
.filter('truncate', function () {
'use strict';
@ -35,15 +41,13 @@ angular.module('portainer.filters', [])
'use strict';
return function (text) {
var status = _.toLower(text);
if (status.indexOf('new') !== -1 || status.indexOf('allocated') !== -1 ||
status.indexOf('assigned') !== -1 || status.indexOf('accepted') !== -1) {
if (includeString(status, ['new', 'allocated', 'assigned', 'accepted'])) {
return 'info';
} else if (status.indexOf('pending') !== -1) {
} else if (includeString(status, ['pending'])) {
return 'warning';
} else if (status.indexOf('shutdown') !== -1 || status.indexOf('failed') !== -1 ||
status.indexOf('rejected') !== -1) {
} else if (includeString(status, ['shutdown', 'failed', 'rejected'])) {
return 'danger';
} else if (status.indexOf('complete') !== -1) {
} else if (includeString(status, ['complete'])) {
return 'primary';
}
return 'success';
@ -53,11 +57,11 @@ angular.module('portainer.filters', [])
'use strict';
return function (text) {
var status = _.toLower(text);
if (status.indexOf('paused') !== -1 || status.indexOf('starting') !== -1) {
if (includeString(status, ['paused', 'starting'])) {
return 'warning';
} else if (status.indexOf('created') !== -1) {
} else if (includeString(status, ['created'])) {
return 'info';
} else if (status.indexOf('stopped') !== -1 || status.indexOf('unhealthy') !== -1) {
} else if (includeString(status, ['stopped', 'unhealthy', 'dead'])) {
return 'danger';
}
return 'success';
@ -67,17 +71,19 @@ angular.module('portainer.filters', [])
'use strict';
return function (text) {
var status = _.toLower(text);
if (status.indexOf('paused') !== -1) {
if (includeString(status, ['paused'])) {
return 'paused';
} else if (status.indexOf('created') !== -1) {
} else if (includeString(status, ['dead'])) {
return 'dead';
} else if (includeString(status, ['created'])) {
return 'created';
} else if (status.indexOf('exited') !== -1) {
} else if (includeString(status, ['exited'])) {
return 'stopped';
} else if (status.indexOf('(healthy)') !== -1) {
} else if (includeString(status, ['(healthy)'])) {
return 'healthy';
} else if (status.indexOf('(unhealthy)') !== -1) {
} else if (includeString(status, ['(unhealthy)'])) {
return 'unhealthy';
} else if (status.indexOf('(health: starting)') !== -1) {
} else if (includeString(status, ['(health: starting)'])) {
return 'starting';
}
return 'running';
@ -113,6 +119,9 @@ angular.module('portainer.filters', [])
if (state === undefined) {
return '';
}
if (state.Dead) {
return 'Dead';
}
if (state.Ghost && state.Running) {
return 'Ghost';
}

Loading…
Cancel
Save