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

feat(containers) - clean non-persistent volumes when removing a container (#824)

This commit is contained in:
Thomas Krzero 2017-05-01 12:18:06 +02:00 committed by Anthony Lapenna
parent 5a07638f4d
commit 3d8eec2557
5 changed files with 103 additions and 40 deletions

View file

@ -17,6 +17,8 @@ angular.module('containers', [])
Pagination.setPaginationCount('containers', $scope.state.pagination_count);
};
$scope.cleanAssociatedVolumes = false;
function removeContainerResourceControl(container) {
volumeResourceControlQueries = [];
angular.forEach(container.Mounts, function (volume) {
@ -128,7 +130,7 @@ angular.module('containers', [])
});
}
else if (action === Container.remove) {
action({id: c.Id, force: true}, function (d) {
action({id: c.Id, v: ($scope.cleanAssociatedVolumes) ? 1 : 0, force: true}, function (d) {
if (d.message) {
Notifications.error("Error", d, "Unable to remove container");
}
@ -239,17 +241,21 @@ angular.module('containers', [])
return;
}
});
var title = 'You are about to remove one or more container.';
if (isOneContainerRunning) {
ModalService.confirmDeletion(
'You are about to remove one or more running containers.',
function (confirmed) {
if(!confirmed) { return; }
$scope.removeAction();
}
);
} else {
$scope.removeAction();
title = 'You are about to remove one or more running containers.';
}
ModalService.confirmContainerDeletion(
title,
function (result) {
if(!result) { return; }
$scope.cleanAssociatedVolumes = false;
if (result[0]) {
$scope.cleanAssociatedVolumes = true;
}
$scope.removeAction();
}
);
};
function retrieveSwarmHostsInfo(data) {