Module: check_mk
Branch: master
Commit: 9c09bdb700325680c4234fdf127326aa3073be92
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9c09bdb7003256…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Dec 19 09:11:34 2014 +0100
#1798 FIX Filters are now retained when adding a view to a dashboard
Only the context of the URL variables was retained before. The hard coded
context in the view was lost.
---
.werks/1798 | 11 +++++++++++
ChangeLog | 1 +
web/htdocs/dashboard.py | 4 ++--
web/htdocs/htmllib.py | 4 ++--
4 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/.werks/1798 b/.werks/1798
new file mode 100644
index 0000000..65a1e66
--- /dev/null
+++ b/.werks/1798
@@ -0,0 +1,11 @@
+Title: Filters are now retained when adding a view to a dashboard
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1418976614
+
+Only the context of the URL variables was retained before. The hard coded
+context in the view was lost.
diff --git a/ChangeLog b/ChangeLog
index a7b65db..2a97522 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -47,6 +47,7 @@
* 1773 FIX: Fixed different exceptions when using localized multisite
* 1774 FIX: IE: Always use the latest available rendering enginge of the used
browser...
* 1777 FIX: Fixed js error making the "add to visual" link break on pages
with context...
+ * 1798 FIX: Filters are now retained when adding a view to a dashboard...
WATO:
* 1760 Added search form to manual checks page
diff --git a/web/htdocs/dashboard.py b/web/htdocs/dashboard.py
index 1181048..2c71a1b 100644
--- a/web/htdocs/dashboard.py
+++ b/web/htdocs/dashboard.py
@@ -1173,6 +1173,7 @@ def popup_add_dashlet(dashboard_name, dashlet_type, context,
params):
if dashboard_name not in available_dashboards:
return
dashboard = load_dashboard_with_cloning(dashboard_name)
+
dashlet = default_dashlet_definition(dashlet_type)
dashlet["context"] = context
@@ -1181,13 +1182,12 @@ def popup_add_dashlet(dashboard_name, dashlet_type, context,
params):
else:
dashlet.update(params)
-
# When a view shal be added to the dashboard, load the view and put it into the
dashlet
if dashlet_type == 'view':
# save the original context and override the context provided by the view
context = dashlet['context']
load_view_into_dashlet(dashlet, len(dashboard['dashlets']), view_name)
- dashlet['context'] = context
+ dashlet['context'].update(context)
add_dashlet(dashlet, dashboard)
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index e2a5bd8..61bb742 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -901,13 +901,13 @@ class html:
if self.myfile == "view":
mode_name = self.var('mode') == "availability" and
"availability" or "view"
- encoded_vars = []
+ encoded_vars = {}
for k, v in self.page_context.items():
if v == None:
v = ''
elif type(v) == unicode:
v = v.encode('utf-8')
- encoded_vars.append((k, v))
+ encoded_vars[k] = v
h += '<div class="visualadd"><a
class="visualadd" href="javascript:void(0)" ' \
'onclick="toggle_add_to_visual(event, this, \'%s\', %s,
{\'name\': \'%s\'})">' \