Module: check_mk
Branch: master
Commit: c60f02886227084e7d3f39159d473d0e206e50a6
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c60f0288622708…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Feb 7 07:46:16 2019 +0100
Service discovery: Fix "Updating..." message hiding error result
The "Updating..." message is shown to the user during service discovery
when the request takes more than 2 seconds. In case the discovery
produces a final result this message should be hidden. In case an
unhandled exception occured during discovery within the 2 seconds, the
"Updating..." dialog did overwrite the error message.
Change-Id: Ibf69af2d27f64e9f4852898cbe60b327a38e9d48
---
web/htdocs/js/modules/activation.js | 3 +++
web/htdocs/js/modules/async_progress.js | 2 +-
web/htdocs/js/modules/service_discovery.js | 10 ++++++++++
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/web/htdocs/js/modules/activation.js b/web/htdocs/js/modules/activation.js
index eac9dfc..c6daaaa 100644
--- a/web/htdocs/js/modules/activation.js
+++ b/web/htdocs/js/modules/activation.js
@@ -122,6 +122,9 @@ function handle_start_activation(_unused, response_json)
"update_function": update_activation_state,
"is_finished_function": is_activation_progress_finished,
"finish_function": finish_activation,
+ "error_function": function(response) {
+ async_progress.show_error(response);
+ },
"post_data": ""
});
}
diff --git a/web/htdocs/js/modules/async_progress.js
b/web/htdocs/js/modules/async_progress.js
index d5c23bb..73699ed 100644
--- a/web/htdocs/js/modules/async_progress.js
+++ b/web/htdocs/js/modules/async_progress.js
@@ -56,7 +56,7 @@ function handle_update(handler_data, response_json)
{
var response = JSON.parse(response_json);
if (response.result_code == 1) {
- show_error(response.result);
+ handler_data.error_function(response.result);
return; // Abort on error!
} else {
handler_data.update_function(handler_data, response.result);
diff --git a/web/htdocs/js/modules/service_discovery.js
b/web/htdocs/js/modules/service_discovery.js
index 1bd1273..f2902dc 100644
--- a/web/htdocs/js/modules/service_discovery.js
+++ b/web/htdocs/js/modules/service_discovery.js
@@ -54,6 +54,7 @@ export function start(host_name, folder_path, discovery_options,
transid, reques
"is_finished_function": is_finished,
"update_function": update,
"finish_function": finish,
+ "error_function": error,
"post_data": get_post_data(host_name, folder_path, discovery_options,
transid, request_vars)
});
}
@@ -107,6 +108,15 @@ function finish(response)
lock_controls(false);
}
+function error(response)
+{
+ if (g_show_updating_timer) {
+ clearTimeout(g_show_updating_timer);
+ }
+ async_progress.show_error(response);
+}
+
+
function update(handler_data, response) {
if (g_show_updating_timer) {
clearTimeout(g_show_updating_timer);