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

feat(services): add a confirmation modal before deleting one or multiple services (#742)

This commit is contained in:
Anthony Lapenna 2017-03-30 11:22:59 +02:00 committed by GitHub
parent f9c1941384
commit a48503d821
2 changed files with 29 additions and 6 deletions

View file

@ -1,6 +1,6 @@
angular.module('service', [])
.controller('ServiceController', ['$scope', '$stateParams', '$state', '$location', '$anchorScroll', 'Service', 'ServiceHelper', 'Task', 'Node', 'Messages', 'Pagination',
function ($scope, $stateParams, $state, $location, $anchorScroll, Service, ServiceHelper, Task, Node, Messages, Pagination) {
.controller('ServiceController', ['$scope', '$stateParams', '$state', '$location', '$anchorScroll', 'Service', 'ServiceHelper', 'Task', 'Node', 'Messages', 'Pagination', 'ModalService',
function ($scope, $stateParams, $state, $location, $anchorScroll, Service, ServiceHelper, Task, Node, Messages, Pagination, ModalService) {
$scope.state = {};
$scope.state.pagination_count = Pagination.getPaginationCount('service_tasks');
@ -213,8 +213,17 @@ 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.',
function onConfirm(confirmed) {
if(!confirmed) { return; }
removeService();
}
);
};
$scope.removeService = function removeService() {
function removeService() {
$('#loadingViewSpinner').show();
Service.remove({id: $stateParams.id}, function (d) {
if (d.message) {
@ -229,7 +238,7 @@ function ($scope, $stateParams, $state, $location, $anchorScroll, Service, Servi
$('#loadingViewSpinner').hide();
Messages.error("Failure", e, "Unable to remove service");
});
};
}
function translateServiceArrays(service) {
service.ServiceSecrets = service.Secrets;