portainer/js/services.js

61 lines
3.0 KiB
JavaScript
Raw Normal View History

2013-06-09 00:12:14 +00:00
'use strict';
2013-06-09 01:20:29 +00:00
angular.module('dockerui.services', ['ngResource'])
.factory('Container', function($resource, DOCKER_ENDPOINT) {
// Resource for interacting with the docker containers
// http://docs.docker.io/en/latest/api/docker_remote_api.html#containers
return $resource(DOCKER_ENDPOINT + '/containers/:id/:action', {}, {
query: {method: 'GET', params:{ all: 0, action: 'json'}, isArray: true},
get :{method: 'GET', params: { action:'json'}},
2013-06-09 23:56:54 +00:00
start: {method: 'POST', params: {id: '@id', action: 'start'}},
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'}},
2013-06-09 01:20:29 +00:00
changes :{method: 'GET', params: {action:'changes'}, isArray: true},
create :{method: 'POST', params: {action:'create'}},
2013-06-09 23:56:54 +00:00
remove :{method: 'DELETE', params: {id: '@id', v:0}}
2013-06-09 01:20:29 +00:00
});
})
.factory('Image', function($resource, DOCKER_ENDPOINT) {
// Resource for docker images
// http://docs.docker.io/en/latest/api/docker_remote_api.html#images
2013-06-09 23:11:40 +00:00
return $resource(DOCKER_ENDPOINT + '/images/:id/:action', {}, {
2013-06-09 01:20: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'}},
2013-06-09 23:11:40 +00:00
history :{method: 'GET', params: { action:'history'}, isArray: true},
2013-06-09 01:20:29 +00:00
create :{method: 'POST', params: {action:'create'}},
2013-06-09 23:56:54 +00:00
insert :{method: 'POST', params: {id: '@id', action:'insert'}},
push :{method: 'POST', params: {id: '@id', action:'push'}},
tag :{method: 'POST', params: {id: '@id', action:'tag'}},
delete :{id: '@id', method: 'DELETE'}
2013-06-09 01:20:29 +00:00
});
2013-06-09 23:56:54 +00:00
})
2013-06-10 01:31:05 +00:00
.factory('Docker', function($resource, DOCKER_ENDPOINT) {
// Information for docker
// http://docs.docker.io/en/latest/api/docker_remote_api.html#display-system-wide-information
return $resource(DOCKER_ENDPOINT + '/version', {}, {
get: {method: 'GET'}
});
})
.factory('Auth', function($resource, DOCKER_ENDPOINT) {
// Auto Information for docker
// http://docs.docker.io/en/latest/api/docker_remote_api.html#set-auth-configuration
return $resource(DOCKER_ENDPOINT + '/auth', {}, {
get: {method: 'GET'},
update: {method: 'POST'}
});
})
.factory('System', function($resource, DOCKER_ENDPOINT) {
// System for docker
// http://docs.docker.io/en/latest/api/docker_remote_api.html#display-system-wide-information
return $resource(DOCKER_ENDPOINT + '/info', {}, {
get: {method: 'GET'}
});
})
2013-06-09 23:56:54 +00:00
.factory('Settings', function() {
return {
displayAll: false
};
2013-06-09 00:12:14 +00:00
});