1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-25 08:19:40 +02:00
portainer/app/docker/rest/volume.js
Maxime Bajeux ebac85b462
feat(volumes): add a switch to use CIFS volumes (#3823)
* feat(volumes): add a switch to use CIFS volumes

* feat(volumes): switch between nfs and cifs

* feat(volumes): autofix sharepoint, hide driveroptions and allow to create unnammed volume

* feat(volumes): change cifs version select options

* feat(volumes): change few things
2020-05-15 13:28:51 +12:00

38 lines
1.1 KiB
JavaScript

import { genericHandler } from './response/handlers';
angular.module('portainer.docker').factory('Volume', [
'$resource',
'API_ENDPOINT_ENDPOINTS',
'EndpointProvider',
'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',
{
endpointId: EndpointProvider.endpointID,
},
{
query: { method: 'GET', interceptor: VolumesInterceptor, timeout: 15000 },
get: { method: 'GET', params: { id: '@id' } },
create: {
method: 'POST',
params: { action: 'create' },
transformResponse: genericHandler,
ignoreLoadingBar: true,
headers: { 'X-Portainer-VolumeName': addVolumeNameToHeader },
},
remove: {
method: 'DELETE',
transformResponse: genericHandler,
params: { id: '@id' },
},
}
);
},
]);