Module: check_mk
Branch: master
Commit: ba0ab9859591b95b229bc86dbdb4e433c7190618
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ba0ab9859591b9…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Nov 4 13:43:49 2015 +0100
#2723 FIX Hiding "discard changes button" after successful activation of
changes
---
.werks/2723 | 9 +++++
ChangeLog | 1 +
web/htdocs/js/wato.js | 88 ++++++++++++++-----------------------------------
web/htdocs/wato.py | 18 ----------
4 files changed, 34 insertions(+), 82 deletions(-)
diff --git a/.werks/2723 b/.werks/2723
new file mode 100644
index 0000000..feb9275
--- /dev/null
+++ b/.werks/2723
@@ -0,0 +1,9 @@
+Title: Hiding "discard changes button" after successful activation of changes
+Level: 1
+Component: wato
+Compatible: compat
+Version: 1.2.7i4
+Date: 1446641006
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 04d5dcd..0d63b3d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -68,6 +68,7 @@
* 1298 FIX: Fixed broken WebAPI...
* 1299 FIX: BI: Fixed recently introduced bug when editing BI Rules...
* 2721 FIX: Fixed user profile sync in distributed environments after profile change
+ * 2723 FIX: Hiding "discard changes button" after successful activation of
changes
Event Console:
* 2733 Visibility of Event Console events more flexible now...
diff --git a/web/htdocs/js/wato.js b/web/htdocs/js/wato.js
index e0748f5..d71c54f 100644
--- a/web/htdocs/js/wato.js
+++ b/web/htdocs/js/wato.js
@@ -509,63 +509,6 @@ function update_bulk_moveto(val) {
fields = null;
}
-// .----------------------------------------------------------------------.
-// | _ _ _ _ _ |
-// | / \ ___| |_(_)_ ____ _| |_(_) ___ _ __ |
-// | / _ \ / __| __| \ \ / / _` | __| |/ _ \| '_ \ |
-// | / ___ \ (__| |_| |\ V / (_| | |_| | (_) | | | | |
-// | /_/ \_\___|\__|_| \_/ \__,_|\__|_|\___/|_| |_| |
-// | |
-// +----------------------------------------------------------------------+
-
-function wato_do_activation(est) {
- var siteid = 'local';
-
- // Hide the activate changes button
- var button = document.getElementById('act_changes_button');
- if (button) {
- button.style.display = 'none';
- }
- button = document.getElementById('discard_changes_button');
- if (button) {
- button.style.display = 'none';
- button = null;
- }
-
- get_url("wato_ajax_activation.py",
- wato_activation_result, siteid);
- replication_progress[siteid] = 20; // 10 of 10 10ths
-
setTimeout("replication_step('"+siteid+"',"+est+");",
est/10);
-}
-
-function wato_activation_result(siteid, code) {
- replication_progress[siteid] = 0;
- var oState = document.getElementById("repstate_" + siteid);
- var oMsg = document.getElementById("repmsg_" + siteid);
- if (code.substr(0, 3) == "OK:") {
- oState.innerHTML = "<div class='repprogress ok' style='width:
160px;'>OK</div>";
- oMsg.innerHTML = code.substr(3);
-
- // Reload page after 1 secs
- setTimeout(wato_replication_finish, 1000);
- } else {
- oState.innerHTML = '';
- oMsg.innerHTML = code;
- wato_hide_changes_button();
- }
- oState = null;
- oMsg = null;
-}
-
-function wato_hide_changes_button()
-{
- var button = document.getElementById('act_changes_button');
- if (button) {
- button.style.display = 'none';
- button = null;
- }
-}
-
// +----------------------------------------------------------------------+
// | ____ _ _ _ _ |
// | | _ \ ___ _ __ | (_) ___ __ _| |_(_) ___ _ __ |
@@ -601,27 +544,29 @@ function wato_replication_result(siteid, code) {
var oDiv = document.getElementById("repstate_" + siteid);
if (code.substr(0, 3) == "OK:") {
oDiv.innerHTML = "<div class='repprogress ok' style='width:
160px;'>" +
- code.substr(3) + "</div>";
+ code.substr(3) + "</div>";
num_replsites--;
}
else
oDiv.innerHTML = code;
if (0 == num_replsites) {
- setTimeout(wato_replication_finish, 1000);
+ setTimeout(finish_replication, 1000);
}
}
-function wato_replication_finish() {
+function finish_replication()
+{
// check if we have a sidebar-main frame setup
if (this.parent && parent && parent.frames[1] == this)
reload_sidebar();
- var oDiv = document.getElementById("act_changes_button");
- oDiv.style.display = "none";
- oDiv = null
+ hide_changes_buttons();
+ hide_pending_changes_container();
+}
- // Hide the pending changes container
+function hide_pending_changes_container()
+{
var oPending = document.getElementById("pending_changes");
if (oPending) {
oPending.style.display = "none";
@@ -629,6 +574,21 @@ function wato_replication_finish() {
}
}
+function hide_changes_buttons()
+{
+ var button = document.getElementById('act_changes_button');
+ if (button) {
+ button.style.display = 'none';
+ button = null;
+ }
+
+ button = document.getElementById('discard_changes_button');
+ if (button) {
+ button.style.display = 'none';
+ button = null;
+ }
+}
+
function wato_randomize_secret(id, len) {
var secret = "";
for (var i=0; i<len; i++) {
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 1921720..e71b80f 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -5414,24 +5414,6 @@ def mode_changelog(phase):
if sitestatus_do_async_replication and num_replsites > 0:
html.javascript("var num_replsites = %d;\n" % num_replsites)
- elif sitestatus_do_async_replication:
- # Single site setup
- if cmc_rush_ahead_activation():
- html.message(_("All changes have been activated."))
- changes_activated = True
- else:
- # Is rendered on the page after hitting the "activate" button
- # Renders the html to show the progress and starts the sync via
javascript
- html.write("<table class=data>")
- html.write("<tr><th
class=left>%s</th><th>%s</th></tr>" %
(_('Progress'), _('Status')))
- html.write('<tr class="data odd0"><td
class=repprogress><div
id="repstate_local"></div></td>')
- html.write('<td
id="repmsg_local"><i>%s</i></td></tr></table>'
% _('activating...'))
-
- srs = load_replication_status().get(None, {})
- estimated_duration = srs.get("times", {}).get('act',
2.0)
- html.javascript("wato_do_activation(%d);" %
- (int(estimated_duration * 1000.0)))
-
sitestatus_do_async_replication = None # could survive in global context!
pending = parse_audit_log("pending")