mirror of https://github.com/portainer/portainer
fix(volumes): display an error message when trying to delete a bound volume
parent
1cd620a45e
commit
ca5cf33c8f
|
@ -36,9 +36,13 @@ function ($scope, $state, Volume, Messages) {
|
|||
if (volume.Checked) {
|
||||
counter = counter + 1;
|
||||
Volume.remove({name: volume.Name}, function (d) {
|
||||
Messages.send("Volume deleted", volume.Name);
|
||||
var index = $scope.volumes.indexOf(volume);
|
||||
$scope.volumes.splice(index, 1);
|
||||
if (d.message) {
|
||||
Messages.error("Unable to remove volume", {}, d.message);
|
||||
} else {
|
||||
Messages.send("Volume deleted", volume.Name);
|
||||
var index = $scope.volumes.indexOf(volume);
|
||||
$scope.volumes.splice(index, 1);
|
||||
}
|
||||
complete();
|
||||
}, function (e) {
|
||||
Messages.error("Failure", e, "Unable to remove volume");
|
||||
|
|
|
@ -165,7 +165,9 @@ angular.module('portainer.services', ['ngResource', 'ngSanitize'])
|
|||
query: {method: 'GET'},
|
||||
get: {method: 'GET'},
|
||||
create: {method: 'POST', params: {action: 'create'}, transformResponse: genericHandler},
|
||||
remove: {method: 'DELETE'}
|
||||
remove: {
|
||||
method: 'DELETE', transformResponse: genericHandler
|
||||
}
|
||||
});
|
||||
}])
|
||||
.factory('Config', ['$resource', 'CONFIG_ENDPOINT', function ConfigFactory($resource, CONFIG_ENDPOINT) {
|
||||
|
@ -212,7 +214,7 @@ angular.module('portainer.services', ['ngResource', 'ngSanitize'])
|
|||
msg = e.data.message;
|
||||
} else if (e.message) {
|
||||
msg = e.message;
|
||||
} else if (e.data.length > 0 && e.data[0].message) {
|
||||
} else if (e.data && e.data.length > 0 && e.data[0].message) {
|
||||
msg = e.data[0].message;
|
||||
}
|
||||
$.gritter.add({
|
||||
|
|
Loading…
Reference in New Issue