mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
refactor(ui): updated image view (#112)
This commit is contained in:
parent
111cd4ac64
commit
9293b28ef4
6 changed files with 198 additions and 117 deletions
25
app/shared/responseHandlers.js
Normal file
25
app/shared/responseHandlers.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
// Events query API return 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 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) {
|
||||
var response = angular.fromJson(data);
|
||||
if (!Array.isArray(response)) {
|
||||
var arr = [];
|
||||
arr.push(response);
|
||||
return arr;
|
||||
}
|
||||
return response;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue