
The previous implementation of the ajaxError event did not pass along all the available information to the original caller. Corrected with this patch. Display a message if the error is requestRejected. Updated guest vms processing to use the additional information. Corrected the error handler to show the JSON response reason when available. Signed-off-by: Adam King <rak@linux.vnet.ibm.com> --- ui/js/src/kimchi.guest_main.js | 6 ++++-- ui/js/src/kimchi.main.js | 8 ++++++-- ui/pages/i18n.html.tmpl | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ui/js/src/kimchi.guest_main.js b/ui/js/src/kimchi.guest_main.js index bbd8d3d..bdd5a69 100644 --- a/ui/js/src/kimchi.guest_main.js +++ b/ui/js/src/kimchi.guest_main.js @@ -165,8 +165,10 @@ kimchi.listVmsAuto = function() { } kimchi.vmTimeout = window.setTimeout("kimchi.listVmsAuto();", 5000); - }, function(err) { - kimchi.message.error(err.responseJSON.reason); + }, function(errorResponse, textStatus, errorThrown) { + if(errorResponse.responseJSON && errorResponse.responseJSON.reason) { + kimchi.message.error(errorResponse.responseJSON.reason); + } kimchi.vmTimeout = window.setTimeout("kimchi.listVmsAuto();", 5000); }); }; diff --git a/ui/js/src/kimchi.main.js b/ui/js/src/kimchi.main.js index 8d12525..aac7e28 100644 --- a/ui/js/src/kimchi.main.js +++ b/ui/js/src/kimchi.main.js @@ -164,8 +164,12 @@ kimchi.main = function() { }); return; } - - ajaxSettings['originalError'] && ajaxSettings['originalError'](jqXHR); + else if((jqXHR['status'] == 0) && ("error"==jqXHR.statusText)) { + kimchi.message.error(i18n['KCHAPI6007E'].replace("%1", jqXHR.state())); + } + if(ajaxSettings['originalError']) { + ajaxSettings['originalError'](jqXHR, jqXHR.statusText, errorThrown); + } }); kimchi.user.showUser(true); diff --git a/ui/pages/i18n.html.tmpl b/ui/pages/i18n.html.tmpl index bf8a0d7..ba3a407 100644 --- a/ui/pages/i18n.html.tmpl +++ b/ui/pages/i18n.html.tmpl @@ -50,6 +50,7 @@ var i18n = { 'KCHAPI6004E': "$_("This is not a valid URL.")", 'KCHAPI6005E': "$_("No such data available.")", 'KCHAPI6006E': "$_("options needed.")", + 'KCHAPI6007E': "$_("Can not contact the host system. Verify the host system is up and that you have network connectivity to it. HTTP request response %1. ")", 'KCHAPI6001M': "$_("Delete Confirmation")", 'KCHAPI6002M': "$_("OK")", -- 1.8.1.4