2018-02-01 12:27:52 +00:00
|
|
|
angular.module('portainer.docker')
|
2018-05-06 07:15:57 +00:00
|
|
|
.factory('Image', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', 'HttpRequestHelper',
|
|
|
|
function ImageFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider, HttpRequestHelper) {
|
2017-01-31 23:26:29 +00:00
|
|
|
'use strict';
|
2017-06-20 11:00:32 +00:00
|
|
|
|
2017-07-20 14:22:27 +00:00
|
|
|
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/images/:id/:action', {
|
2017-03-12 16:24:15 +00:00
|
|
|
endpointId: EndpointProvider.endpointID
|
|
|
|
},
|
|
|
|
{
|
2017-01-31 23:26:29 +00:00
|
|
|
query: {method: 'GET', params: {all: 0, action: 'json'}, isArray: true},
|
|
|
|
get: {method: 'GET', params: {action: 'json'}},
|
|
|
|
search: {method: 'GET', params: {action: 'search'}},
|
|
|
|
history: {method: 'GET', params: {action: 'history'}, isArray: true},
|
|
|
|
insert: {method: 'POST', params: {id: '@id', action: 'insert'}},
|
2017-11-12 19:27:28 +00:00
|
|
|
tag: {method: 'POST', params: {id: '@id', action: 'tag', force: 0, repo: '@repo', tag: '@tag'}, ignoreLoadingBar: true},
|
2017-01-31 23:26:29 +00:00
|
|
|
inspect: {method: 'GET', params: {id: '@id', action: 'json'}},
|
|
|
|
push: {
|
|
|
|
method: 'POST', params: {action: 'push', id: '@tag'},
|
2017-06-20 11:00:32 +00:00
|
|
|
isArray: true, transformResponse: jsonObjectsToArrayHandler,
|
2017-11-12 19:27:28 +00:00
|
|
|
headers: { 'X-Registry-Auth': HttpRequestHelper.registryAuthenticationHeader },
|
|
|
|
ignoreLoadingBar: true
|
2017-01-31 23:26:29 +00:00
|
|
|
},
|
|
|
|
create: {
|
|
|
|
method: 'POST', params: {action: 'create', fromImage: '@fromImage', tag: '@tag'},
|
2017-06-20 11:00:32 +00:00
|
|
|
isArray: true, transformResponse: jsonObjectsToArrayHandler,
|
2017-11-12 19:27:28 +00:00
|
|
|
headers: { 'X-Registry-Auth': HttpRequestHelper.registryAuthenticationHeader },
|
|
|
|
ignoreLoadingBar: true
|
2017-01-31 23:26:29 +00:00
|
|
|
},
|
|
|
|
remove: {
|
2017-02-15 22:14:56 +00:00
|
|
|
method: 'DELETE', params: {id: '@id', force: '@force'},
|
2017-01-31 23:26:29 +00:00
|
|
|
isArray: true, transformResponse: deleteImageHandler
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}]);
|