diff --git a/app/components/container/container.html b/app/components/container/container.html
index af9c4a2e2..1e3406fb2 100644
--- a/app/components/container/container.html
+++ b/app/components/container/container.html
@@ -19,7 +19,7 @@
-
+
diff --git a/app/components/container/containerController.js b/app/components/container/containerController.js
index 2b6195f9f..7931481db 100644
--- a/app/components/container/containerController.js
+++ b/app/components/container/containerController.js
@@ -1,6 +1,6 @@
angular.module('container', [])
-.controller('ContainerController', ['$scope', '$state','$stateParams', '$filter', 'Container', 'ContainerCommit', 'ImageHelper', 'Network', 'Notifications', 'Pagination',
-function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, ImageHelper, Network, Notifications, Pagination) {
+.controller('ContainerController', ['$scope', '$state','$stateParams', '$filter', 'Container', 'ContainerCommit', 'ImageHelper', 'Network', 'Notifications', 'Pagination', 'ModalService',
+function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, ImageHelper, Network, Notifications, Pagination, ModalService) {
$scope.activityTime = 0;
$scope.portBindings = [];
$scope.config = {
@@ -116,9 +116,23 @@ function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, Ima
});
};
- $scope.remove = function () {
+ $scope.confirmRemove = function () {
+ if ($scope.container.State.Running) {
+ ModalService.confirmDeletion(
+ 'You are about to remove a running container.',
+ function (confirmed) {
+ if(!confirmed) { return; }
+ $scope.remove();
+ }
+ );
+ } else {
+ $scope.remove();
+ }
+ };
+
+ $scope.remove = function() {
$('#loadingViewSpinner').show();
- Container.remove({id: $stateParams.id}, function (d) {
+ Container.remove({id: $stateParams.id, force: true}, function (d) {
if (d.message) {
$('#loadingViewSpinner').hide();
Notifications.error("Failure", d, "Unable to remove container");
diff --git a/app/components/containers/containers.html b/app/components/containers/containers.html
index 41e322b5d..2ba31535e 100644
--- a/app/components/containers/containers.html
+++ b/app/components/containers/containers.html
@@ -31,7 +31,7 @@
-
+
Add container
diff --git a/app/components/containers/containersController.js b/app/components/containers/containersController.js
index ee1ccedf3..656d0c111 100644
--- a/app/components/containers/containersController.js
+++ b/app/components/containers/containersController.js
@@ -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;
diff --git a/app/components/service/serviceController.js b/app/components/service/serviceController.js
index 9f7661e2e..e39ed08fa 100644
--- a/app/components/service/serviceController.js
+++ b/app/components/service/serviceController.js
@@ -224,7 +224,7 @@ function ($scope, $stateParams, $state, $location, $anchorScroll, Service, Servi
$scope.removeService = function() {
ModalService.confirmDeletion(
- 'Do you want to delete this service? All the containers associated to this service will be removed too.',
+ 'Do you want to remove this service? All the containers associated to this service will be removed too.',
function onConfirm(confirmed) {
if(!confirmed) { return; }
removeService();
diff --git a/app/components/services/servicesController.js b/app/components/services/servicesController.js
index 72c5ada89..b4e5d54ba 100644
--- a/app/components/services/servicesController.js
+++ b/app/components/services/servicesController.js
@@ -70,7 +70,7 @@ function ($q, $scope, $stateParams, $state, Service, ServiceHelper, Notification
$scope.removeAction = function() {
ModalService.confirmDeletion(
- 'Do you want to delete the selected service(s)? All the containers associated to the selected service(s) will be removed too.',
+ 'Do you want to remove the selected service(s)? All the containers associated to the selected service(s) will be removed too.',
function onConfirm(confirmed) {
if(!confirmed) { return; }
removeServices();
diff --git a/app/components/user/userController.js b/app/components/user/userController.js
index abeb71fe7..6c0040432 100644
--- a/app/components/user/userController.js
+++ b/app/components/user/userController.js
@@ -14,7 +14,7 @@ function ($scope, $state, $stateParams, UserService, ModalService, Notifications
$scope.deleteUser = function() {
ModalService.confirmDeletion(
- 'Do you want to delete this user? This user will not be able to login into Portainer anymore.',
+ 'Do you want to remove this user? This user will not be able to login into Portainer anymore.',
function onConfirm(confirmed) {
if(!confirmed) { return; }
deleteUser();
diff --git a/app/components/users/usersController.js b/app/components/users/usersController.js
index 218b97cd7..6e35233bf 100644
--- a/app/components/users/usersController.js
+++ b/app/components/users/usersController.js
@@ -103,7 +103,7 @@ function ($scope, $state, UserService, ModalService, Notifications, Pagination)
$scope.removeAction = function () {
ModalService.confirmDeletion(
- 'Do you want to delete the selected users? They will not be able to login into Portainer anymore.',
+ 'Do you want to remove the selected users? They will not be able to login into Portainer anymore.',
function onConfirm(confirmed) {
if(!confirmed) { return; }
deleteSelectedUsers();
diff --git a/app/rest/container.js b/app/rest/container.js
index 4130a5592..fa16d9d3b 100644
--- a/app/rest/container.js
+++ b/app/rest/container.js
@@ -23,7 +23,7 @@ angular.module('portainer.rest')
transformResponse: genericHandler
},
remove: {
- method: 'DELETE', params: {id: '@id', v: 0},
+ method: 'DELETE', params: {id: '@id', v: 0, force: '@force'},
transformResponse: genericHandler
},
rename: {
diff --git a/app/services/modalService.js b/app/services/modalService.js
index b9d9453bb..f6667fe5e 100644
--- a/app/services/modalService.js
+++ b/app/services/modalService.js
@@ -75,7 +75,7 @@ angular.module('portainer.services')
message: message,
buttons: {
confirm: {
- label: 'Delete',
+ label: 'Remove',
className: 'btn-danger'
}
},