1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-20 22:09:41 +02:00

feat(containers) - Add the ability to force remove a container with confirmation (#814)

This commit is contained in:
Thomas Krzero 2017-04-25 10:20:57 +02:00 committed by Anthony Lapenna
parent 2761959f93
commit ac872b577a
10 changed files with 48 additions and 13 deletions

View file

@ -128,7 +128,7 @@ angular.module('containers', [])
});
}
else if (action === Container.remove) {
action({id: c.Id}, function (d) {
action({id: c.Id, force: true}, function (d) {
if (d.message) {
Notifications.error("Error", d, "Unable to remove container");
}
@ -231,6 +231,27 @@ angular.module('containers', [])
batch($scope.containers, Container.remove, "Removed");
};
$scope.confirmRemoveAction = function () {
var isOneContainerRunning = false;
angular.forEach($scope.containers, function (c) {
if (c.Checked && c.State === 'running') {
isOneContainerRunning = true;
return;
}
});
if (isOneContainerRunning) {
ModalService.confirmDeletion(
'You are about to remove one or more running containers.',
function (confirmed) {
if(!confirmed) { return; }
$scope.removeAction();
}
);
} else {
$scope.removeAction();
}
};
function retrieveSwarmHostsInfo(data) {
var swarm_hosts = {};
var systemStatus = data.SystemStatus;