mirror of https://github.com/portainer/portainer
feat(app/volumes): add confirmation modal before deleting volumes in volumes view and volume view (#4597)
parent
bd98b8956a
commit
58bf76a58f
|
@ -51,6 +51,8 @@ angular.module('portainer.docker').controller('VolumeController', [
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.removeVolume = function removeVolume() {
|
$scope.removeVolume = function removeVolume() {
|
||||||
|
ModalService.confirmDeletion('Do you want to remove this volume?', (confirmed) => {
|
||||||
|
if (confirmed) {
|
||||||
VolumeService.remove($scope.volume)
|
VolumeService.remove($scope.volume)
|
||||||
.then(function success() {
|
.then(function success() {
|
||||||
Notifications.success('Volume successfully removed', $transition$.params().id);
|
Notifications.success('Volume successfully removed', $transition$.params().id);
|
||||||
|
@ -59,6 +61,8 @@ angular.module('portainer.docker').controller('VolumeController', [
|
||||||
.catch(function error(err) {
|
.catch(function error(err) {
|
||||||
Notifications.error('Failure', err, 'Unable to remove volume');
|
Notifications.error('Failure', err, 'Unable to remove volume');
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function getVolumeDataFromContainer(container, volumeId) {
|
function getVolumeDataFromContainer(container, volumeId) {
|
||||||
|
|
|
@ -9,8 +9,11 @@ angular.module('portainer.docker').controller('VolumesController', [
|
||||||
'HttpRequestHelper',
|
'HttpRequestHelper',
|
||||||
'EndpointProvider',
|
'EndpointProvider',
|
||||||
'Authentication',
|
'Authentication',
|
||||||
function ($q, $scope, $state, VolumeService, ServiceService, VolumeHelper, Notifications, HttpRequestHelper, EndpointProvider, Authentication) {
|
'ModalService',
|
||||||
|
function ($q, $scope, $state, VolumeService, ServiceService, VolumeHelper, Notifications, HttpRequestHelper, EndpointProvider, Authentication, ModalService) {
|
||||||
$scope.removeAction = function (selectedItems) {
|
$scope.removeAction = function (selectedItems) {
|
||||||
|
ModalService.confirmDeletion('Do you want to remove the selected volume(s)?', (confirmed) => {
|
||||||
|
if (confirmed) {
|
||||||
var actionCount = selectedItems.length;
|
var actionCount = selectedItems.length;
|
||||||
angular.forEach(selectedItems, function (volume) {
|
angular.forEach(selectedItems, function (volume) {
|
||||||
HttpRequestHelper.setPortainerAgentTargetHeader(volume.NodeName);
|
HttpRequestHelper.setPortainerAgentTargetHeader(volume.NodeName);
|
||||||
|
@ -30,6 +33,8 @@ angular.module('portainer.docker').controller('VolumesController', [
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.offlineMode = false;
|
$scope.offlineMode = false;
|
||||||
|
|
Loading…
Reference in New Issue