1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-05 05:45:22 +02:00

feat(image): add the ability to push an image tag

This commit is contained in:
Anthony Lapenna 2016-08-17 12:27:54 +12:00
parent 722dc0b3af
commit f0e4cdc13e
4 changed files with 35 additions and 3 deletions

View file

@ -12,6 +12,13 @@ function createImageHandler(data) {
return angular.fromJson(str);
}
// Image push API return a list of JSON object.
// This handler wrap the JSON objects in an array.
function pushImageHandler(data) {
var str = "[" + data.replace(/\n/g, " ").replace(/\}\s*\{/g, "}, {") + "]";
return angular.fromJson(str);
}
// Image delete API returns an array on success and an object on error.
// This handler creates an array from an object in case of error.
function deleteImageHandler(data) {

View file

@ -93,9 +93,12 @@ angular.module('uifordocker.services', ['ngResource', 'ngSanitize'])
search: {method: 'GET', params: {action: 'search'}},
history: {method: 'GET', params: {action: 'history'}, isArray: true},
insert: {method: 'POST', params: {id: '@id', action: 'insert'}},
push: {method: 'POST', params: {id: '@id', action: 'push'}},
tag: {method: 'POST', params: {id: '@id', action: 'tag', force: 0, repo: '@repo', tag: '@tag'}},
inspect: {method: 'GET', params: {id: '@id', action: 'json'}},
push: {
method: 'POST', params: {action: 'push', id: '@tag'},
isArray: true, transformResponse: pushImageHandler
},
create: {
method: 'POST', params: {action: 'create', fromImage: '@fromImage', tag: '@tag'},
isArray: true, transformResponse: createImageHandler