portainer/app/docker/rest/container.js

71 lines
2.1 KiB
JavaScript
Raw Normal View History

angular.module('portainer.docker')
2018-05-06 07:15:57 +00:00
.factory('Container', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider',
function ContainerFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
'use strict';
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/containers/:id/:action', {
name: '@name',
endpointId: EndpointProvider.endpointID
},
{
2018-05-06 07:15:57 +00:00
query: {
method: 'GET', params: { all: 0, action: 'json', filters: '@filters' },
isArray: true
},
get: {
method: 'GET', params: { action: 'json' }
},
stop: {
method: 'POST', params: { id: '@id', t: 5, action: 'stop' }
},
restart: {
method: 'POST', params: { id: '@id', t: 5, action: 'restart' }
},
kill: {
method: 'POST', params: { id: '@id', action: 'kill' }
},
pause: {
method: 'POST', params: { id: '@id', action: 'pause' }
},
unpause: {
method: 'POST', params: { id: '@id', action: 'unpause' }
},
logs: {
method: 'GET', params: { id: '@id', action: 'logs' },
timeout: 4500, ignoreLoadingBar: true,
transformResponse: logsHandler
},
stats: {
method: 'GET', params: { id: '@id', stream: false, action: 'stats' },
2017-11-12 19:27:28 +00:00
timeout: 4500, ignoreLoadingBar: true
},
top: {
method: 'GET', params: { id: '@id', action: 'top' },
2017-11-12 19:27:28 +00:00
timeout: 4500, ignoreLoadingBar: true
},
start: {
method: 'POST', params: {id: '@id', action: 'start'},
transformResponse: genericHandler
},
create: {
method: 'POST', params: {action: 'create'},
2017-11-12 19:27:28 +00:00
transformResponse: genericHandler,
ignoreLoadingBar: true
},
remove: {
method: 'DELETE', params: {id: '@id', v: '@v', force: '@force'},
transformResponse: genericHandler
},
rename: {
2018-05-06 07:15:57 +00:00
method: 'POST', params: { id: '@id', action: 'rename', name: '@name' },
transformResponse: genericHandler
},
exec: {
method: 'POST', params: {id: '@id', action: 'exec'},
2017-11-12 19:27:28 +00:00
transformResponse: genericHandler, ignoreLoadingBar: true
},
inspect: {
method: 'GET', params: { id: '@id', action: 'json' }
}
});
}]);