Module: check_mk
Branch: master
Commit: b12b4882eb41b9e15501dd4166e37d385765f3c1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b12b4882eb41b9…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Oct 22 07:45:01 2018 +0200
Fixed icons after toggling of BI assumptions
Change-Id: I993560eb682f04108b39934a97a12bca071b1655
---
web/htdocs/js/checkmk.js | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/web/htdocs/js/checkmk.js b/web/htdocs/js/checkmk.js
index 4bfa019..d1d7569 100644
--- a/web/htdocs/js/checkmk.js
+++ b/web/htdocs/js/checkmk.js
@@ -3559,10 +3559,9 @@ function toggle_assumption(link, site, host, service)
var img = link.getElementsByTagName("img")[0];
// get current state
- var current = img.src;
- while (current.indexOf('/') > -1)
- current = current.substr(current.indexOf('/') + 1);
- current = current.replace(/button_assume_/, "").replace(/.png/,
"");
+ var path_parts = img.src.split("/");
+ var file_part = path_parts.pop();
+ var current = file_part.replace(/icon_assume_/, "").replace(/.png/,
"");
if (current == 'none')
// Assume WARN when nothing assumed yet
@@ -3574,7 +3573,7 @@ function toggle_assumption(link, site, host, service)
// Disable assumption when ok assumed
current = 'none';
else
- // In all other cases increas the assumption
+ // In all other cases increase the assumption
current = parseInt(current) + 1;
var url = "bi_set_assumption.py?site=" + encodeURIComponent(site)
@@ -3583,7 +3582,7 @@ function toggle_assumption(link, site, host, service)
url += '&service=' + encodeURIComponent(service);
}
url += '&state=' + current;
- img.src = "images/button_assume_" + current + ".png";
+ img.src = path_parts.join("/") + "/icon_assume_" + current +
".png";
get_url(url);
}