1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +02:00

refactor(handlers): remove duplicated code (#127)

This commit is contained in:
Anthony Lapenna 2016-08-17 13:50:55 +12:00 committed by GitHub
parent fb67769928
commit 54fd9561f0
2 changed files with 6 additions and 19 deletions

View file

@ -1,20 +1,7 @@
// Events query API return a list of JSON object.
// The Docker API often returns a list of JSON object.
// This handler wrap the JSON objects in an array.
function queryEventsHandler(data) {
var str = "[" + data.replace(/\n/g, " ").replace(/\}\s*\{/g, "}, {") + "]";
return angular.fromJson(str);
}
// Image create API return a list of JSON object.
// This handler wrap the JSON objects in an array.
function createImageHandler(data) {
var str = "[" + data.replace(/\n/g, " ").replace(/\}\s*\{/g, "}, {") + "]";
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) {
// Used by the API in: Image push, Image create, Events query.
function jsonObjectsToArrayHandler(data) {
var str = "[" + data.replace(/\n/g, " ").replace(/\}\s*\{/g, "}, {") + "]";
return angular.fromJson(str);
}