Merge pull request #204 from cloud-inovasi/fix193-image-error-message
fix(image): support array in Messages.errorpull/205/head
commit
1cd620a45e
|
@ -50,8 +50,8 @@ function genericHandler(data) {
|
||||||
// This handler returns the original array on success or a newly created array containing
|
// This handler returns the original array on success or a newly created array containing
|
||||||
// only one JSON object with the field message filled with the error message on failure.
|
// only one JSON object with the field message filled with the error message on failure.
|
||||||
function deleteImageHandler(data) {
|
function deleteImageHandler(data) {
|
||||||
var response = [];
|
|
||||||
// A string is returned on failure (Docker < 1.12)
|
// A string is returned on failure (Docker < 1.12)
|
||||||
|
var response = [];
|
||||||
if (!isJSON(data)) {
|
if (!isJSON(data)) {
|
||||||
response.push({message: data});
|
response.push({message: data});
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,12 +207,13 @@ angular.module('portainer.services', ['ngResource', 'ngSanitize'])
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
error: function (title, e, fallbackText) {
|
error: function (title, e, fallbackText) {
|
||||||
console.log(JSON.stringify(e, null, 4));
|
|
||||||
var msg = fallbackText;
|
var msg = fallbackText;
|
||||||
if (e.data && e.data.message) {
|
if (e.data && e.data.message) {
|
||||||
msg = e.data.message;
|
msg = e.data.message;
|
||||||
} else if (e.message) {
|
} else if (e.message) {
|
||||||
msg = e.message;
|
msg = e.message;
|
||||||
|
} else if (e.data.length > 0 && e.data[0].message) {
|
||||||
|
msg = e.data[0].message;
|
||||||
}
|
}
|
||||||
$.gritter.add({
|
$.gritter.add({
|
||||||
title: $sanitize(title),
|
title: $sanitize(title),
|
||||||
|
|
Loading…
Reference in New Issue