From 24f1a55499f3b953e0f0b64289306f57c0c60bc3 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Tue, 16 Jul 2013 12:39:38 +0200 Subject: [PATCH] Show error message in one flow tab instead of growl, when the server is not available(cherry picked from commit 525788947b244199e7956ec9305e4953947b56c8) --- src/sunstone/public/js/plugins/oneflow-services.js | 14 +++++++++++--- .../public/js/plugins/oneflow-templates.js | 12 ++++++++++-- src/sunstone/public/js/sunstone-util.js | 7 ++++++- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/sunstone/public/js/plugins/oneflow-services.js b/src/sunstone/public/js/plugins/oneflow-services.js index 2a0aaba905..ca92059b04 100644 --- a/src/sunstone/public/js/plugins/oneflow-services.js +++ b/src/sunstone/public/js/plugins/oneflow-services.js @@ -977,8 +977,11 @@ var service_tab_content = '\ \ \ \ + \ \ - \ +\ '; var dataTable_services; @@ -987,8 +990,13 @@ var service_actions = { "Service.list" : { type: "list", call: Service.list, - callback: updateServicesView, - error: onError + callback: function(request, service_list) { + $("#oneflow-services #error_message").hide(); + updateServicesView(request, service_list); + }, + error: function(request, error_json) { + onError(request, error_json, $("#oneflow-services #error_message")); + } }, "Service.show" : { diff --git a/src/sunstone/public/js/plugins/oneflow-templates.js b/src/sunstone/public/js/plugins/oneflow-templates.js index a3bdb15d8a..a11256d157 100644 --- a/src/sunstone/public/js/plugins/oneflow-templates.js +++ b/src/sunstone/public/js/plugins/oneflow-templates.js @@ -108,7 +108,10 @@ var service_template_tab_content = '\ \ \ \ + \ \ + \ '; @@ -465,8 +468,13 @@ var service_template_actions = { "ServiceTemplate.list" : { type: "list", call: ServiceTemplate.list, - callback: updateServiceTemplatesView, - error: onError + callback: function(request, service_list) { + $("#oneflow-templates #error_message").hide(); + updateServiceTemplatesView(request, service_list); + }, + error: function(request, error_json) { + onError(request, error_json, $("#oneflow-templates #error_message")) + } }, "ServiceTemplate.show" : { diff --git a/src/sunstone/public/js/sunstone-util.js b/src/sunstone/public/js/sunstone-util.js index 0b6af09b30..178bd5dec4 100644 --- a/src/sunstone/public/js/sunstone-util.js +++ b/src/sunstone/public/js/sunstone-util.js @@ -415,7 +415,7 @@ function initCheckAllBoxes(datatable, custom_context){ //standard handling for the server errors on ajax requests. //Pops up a message with the information. -function onError(request,error_json) { +function onError(request,error_json, container) { var method; var action; var object; @@ -451,6 +451,11 @@ function onError(request,error_json) { return false; }; + if (container) { + container.show(); + return false; + } + if (message.match(/^Network is unreachable .+$/)){ if (!onError.disabled){ notifyError(tr("Network is unreachable: is OpenNebula running?"));