2018-02-01 12:27:52 +00:00
|
|
|
angular.module('portainer.docker')
|
2018-05-06 07:15:57 +00:00
|
|
|
.factory('Service', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', 'HttpRequestHelper',
|
|
|
|
function ServiceFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider, HttpRequestHelper) {
|
2017-01-31 23:26:29 +00:00
|
|
|
'use strict';
|
2017-07-20 14:22:27 +00:00
|
|
|
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/services/:id/:action', {
|
2017-03-12 16:24:15 +00:00
|
|
|
endpointId: EndpointProvider.endpointID
|
|
|
|
},
|
|
|
|
{
|
2017-01-31 23:26:29 +00:00
|
|
|
get: { method: 'GET', params: {id: '@id'} },
|
2017-10-15 17:24:40 +00:00
|
|
|
query: { method: 'GET', isArray: true, params: {filters: '@filters'} },
|
2017-06-20 11:00:32 +00:00
|
|
|
create: {
|
|
|
|
method: 'POST', params: {action: 'create'},
|
2018-06-20 13:53:58 +00:00
|
|
|
headers: {
|
|
|
|
'X-Registry-Auth': HttpRequestHelper.registryAuthenticationHeader,
|
|
|
|
// TODO: This is a temporary work-around that allows us to leverage digest pinning on
|
|
|
|
// the Docker daemon side. It has been moved client-side since Docker API version > 1.29.
|
|
|
|
// We should introduce digest pinning in Portainer as well.
|
|
|
|
'version': '1.29'
|
|
|
|
},
|
2017-11-12 19:27:28 +00:00
|
|
|
ignoreLoadingBar: true
|
2017-06-20 11:00:32 +00:00
|
|
|
},
|
2018-06-20 13:53:58 +00:00
|
|
|
update: {
|
|
|
|
method: 'POST', params: { id: '@id', action: 'update', version: '@version' },
|
|
|
|
headers: {
|
|
|
|
// TODO: This is a temporary work-around that allows us to leverage digest pinning on
|
|
|
|
// the Docker daemon side. It has been moved client-side since Docker API version > 1.29.
|
|
|
|
// We should introduce digest pinning in Portainer as well.
|
|
|
|
'version': '1.29'
|
|
|
|
}
|
|
|
|
},
|
2018-02-28 06:19:28 +00:00
|
|
|
remove: { method: 'DELETE', params: {id: '@id'} },
|
|
|
|
logs: {
|
|
|
|
method: 'GET', params: { id: '@id', action: 'logs' },
|
|
|
|
timeout: 4500, ignoreLoadingBar: true,
|
2018-05-04 07:45:05 +00:00
|
|
|
transformResponse: logsHandler
|
2018-02-28 06:19:28 +00:00
|
|
|
}
|
2017-01-31 23:26:29 +00:00
|
|
|
});
|
|
|
|
}]);
|