1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 20:35:25 +02:00

fix(volumes): add unicity check on volumes (#3779)

* fix(volumes): add unicity check on volumes

* fix(volumes): add header to volume creation request

* fix(volumes): change few things
This commit is contained in:
Maxime Bajeux 2020-05-08 23:40:49 +02:00 committed by GitHub
parent 7fa73d1147
commit 8046fb0438
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 3 deletions

View file

@ -7,6 +7,11 @@ angular.module('portainer.docker').factory('Volume', [
'VolumesInterceptor',
function VolumeFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider, VolumesInterceptor) {
'use strict';
function addVolumeNameToHeader(config) {
return config.data.Name;
}
return $resource(
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/volumes/:id/:action',
{
@ -15,7 +20,13 @@ angular.module('portainer.docker').factory('Volume', [
{
query: { method: 'GET', interceptor: VolumesInterceptor, timeout: 15000 },
get: { method: 'GET', params: { id: '@id' } },
create: { method: 'POST', params: { action: 'create' }, transformResponse: genericHandler, ignoreLoadingBar: true },
create: {
method: 'POST',
params: { action: 'create' },
transformResponse: genericHandler,
ignoreLoadingBar: true,
headers: { 'X-Portainer-VolumeName': addVolumeNameToHeader },
},
remove: {
method: 'DELETE',
transformResponse: genericHandler,