-
{{ tag }}
+
+
+
+
+ {{ tag }}
- Note: you can click on the trash icon to delete a tag
+
+ Note: you can click on the upload icon to push an image
+ and on the trash icon to delete a tag
+
diff --git a/app/components/image/imageController.js b/app/components/image/imageController.js
index a249b9905..1502debad 100644
--- a/app/components/image/imageController.js
+++ b/app/components/image/imageController.js
@@ -15,6 +15,21 @@ function ($scope, $stateParams, $state, Image, Messages) {
});
}
+ $scope.pushImage = function(tag) {
+ $('#loadingViewSpinner').show();
+ Image.push({tag: tag}, function (d) {
+ if (d[d.length-1].error) {
+ Messages.error("Unable to push image", d[d.length-1].error);
+ } else {
+ Messages.send('Image successfully pushed');
+ }
+ $('#loadingViewSpinner').hide();
+ }, function (e) {
+ $('#loadingViewSpinner').hide();
+ Messages.error("Unable to push image", e.data);
+ });
+ };
+
$scope.removeImage = function (id) {
$('#loadingViewSpinner').show();
Image.remove({id: id}, function (d) {
diff --git a/app/shared/responseHandlers.js b/app/shared/responseHandlers.js
index a0e44306c..958f8661b 100644
--- a/app/shared/responseHandlers.js
+++ b/app/shared/responseHandlers.js
@@ -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) {
diff --git a/app/shared/services.js b/app/shared/services.js
index 7a323ba9e..8d7ed6bd7 100644
--- a/app/shared/services.js
+++ b/app/shared/services.js
@@ -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