rendering custom url dashlets in some cases
Message-ID: <54f84dfa.SwNPpVp4CXC6ytRm%lm(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.5 6/20/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: 6ee3586f96fbde207a804f1e0e90a175eb2ed374
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6ee3586f96fbde…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Mar 5 13:37:06 2015 +0100
#2090 FIX Fixed errors when editing / rendering custom url dashlets in some cases
It was allowed to configure empty URL or empty URL function which lead to an
exception when rendering the dashlet.
A wrong URL was constructed for URLs which have no URL parameters.
---
.werks/2090 | 13 +++++++++++++
ChangeLog | 1 +
web/htdocs/js/dashboard.js | 6 +++++-
web/plugins/dashboard/dashlets.py | 2 ++
4 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/.werks/2090 b/.werks/2090
new file mode 100644
index 0000000..82e73c6
--- /dev/null
+++ b/.werks/2090
@@ -0,0 +1,13 @@
+Title: Fixed errors when editing / rendering custom url dashlets in some cases
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1425558851
+
+It was allowed to configure empty URL or empty URL function which lead to an
+exception when rendering the dashlet.
+
+A wrong URL was constructed for URLs which have no URL parameters.
diff --git a/ChangeLog b/ChangeLog
index de9f62d..521e480 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -280,6 +280,7 @@
* 2011 FIX: "Service Group" view sorts/groups the services now correctly by
host
* 2024 FIX: Views: Fixed problem when filtering views by strings containing
umlauts...
* 2054 FIX: Sidebar snapin "Tree of folders": fixed exception when using
localized default value...
+ * 2090 FIX: Fixed errors when editing / rendering custom url dashlets in some
cases...
WATO:
* 1760 Added search form to manual checks page
diff --git a/web/htdocs/js/dashboard.js b/web/htdocs/js/dashboard.js
index e697ddc..04882e8 100644
--- a/web/htdocs/js/dashboard.js
+++ b/web/htdocs/js/dashboard.js
@@ -326,7 +326,11 @@ function dashboard_scheduler(initial) {
if ((initial && document.getElementById("dashlet_inner_" +
nr).innerHTML == '')
|| (refresh > 0 && timestamp % refresh == 0)) {
if (typeof(url) === 'string') {
- get_url(url + "&mtime=" + dashboard_mtime,
dashboard_update_contents, "dashlet_inner_" + nr);
+ if (url.indexOf('\?') !== -1)
+ url += "&mtime=" + dashboard_mtime;
+ else
+ url += "?mtime=" + dashboard_mtime;
+ get_url(url, dashboard_update_contents, "dashlet_inner_" +
nr);
}
else {
url(); // Execute "on_refresh" javascript function
diff --git a/web/plugins/dashboard/dashlets.py b/web/plugins/dashboard/dashlets.py
index 62b413e..2cbad09 100644
--- a/web/plugins/dashboard/dashlets.py
+++ b/web/plugins/dashboard/dashlets.py
@@ -613,10 +613,12 @@ dashlet_types["url"] = {
("url", TextAscii(
title = _('URL'),
size = 50,
+ allow_empty = False,
)),
("urlfunc", TextAscii(
title = _('Dynamic URL rendering function'),
size = 50,
+ allow_empty = False,
)),
("show_in_iframe", Checkbox(
title = _('Render in iframe'),