Module: check_mk
Branch: master
Commit: dd5a47da74afa918a5181f3de1f58af07402cccb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=dd5a47da74afa9…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Feb 25 13:42:29 2016 +0100
#3243 FIX Fix missing custom graphs in sidebar snapin Views if explicit topic is set
---
.werks/3243 | 10 ++++++++++
ChangeLog | 1 +
web/plugins/sidebar/shipped.py | 39 ++++++++++++++++++++++++++++++---------
3 files changed, 41 insertions(+), 9 deletions(-)
diff --git a/.werks/3243 b/.werks/3243
new file mode 100644
index 0000000..5c59bf0
--- /dev/null
+++ b/.werks/3243
@@ -0,0 +1,10 @@
+Title: Fix missing custom graphs in sidebar snapin Views if explicit topic is set
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1456404127
+
+
diff --git a/ChangeLog b/ChangeLog
index 420b99f..982d88c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -44,6 +44,7 @@
* 3178 FIX: docsis_channels_upstream: Fixed crash in graphs
* 3082 FIX: windows agent: with realtime updates active, shutting down the agent
could take very long
* 2997 FIX: Fixed broken SNMP subchecks...
+ * 3243 FIX: Fix missing custom graphs in sidebar snapin Views if explicit topic is
set
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/web/plugins/sidebar/shipped.py b/web/plugins/sidebar/shipped.py
index 641ae99..48878a9 100644
--- a/web/plugins/sidebar/shipped.py
+++ b/web/plugins/sidebar/shipped.py
@@ -93,9 +93,9 @@ def render_views():
views.load_views()
dashboard.load_dashboards()
- def render_topic(topic, s):
+ def render_topic(topic, entries):
first = True
- for t, title, name, is_view in s:
+ for t, title, name, is_view in entries:
if is_view and config.visible_views and name not in config.visible_views:
continue
if is_view and config.hidden_views and name in config.hidden_views:
@@ -106,21 +106,42 @@ def render_views():
first = False
if is_view:
bulletlink(title, "view.py?view_name=%s" % name, onclick =
"return wato_views_clicked(this)")
+ elif "?name=" in name:
+ bulletlink(title, name)
else:
bulletlink(title, 'dashboard.py?name=%s' % name, onclick =
"return wato_views_clicked(this)")
# TODO: One day pagestypes should handle the complete snapin.
- for page_type in pagetypes.all_page_types().values():
- if issubclass(page_type, pagetypes.PageRenderer):
- for t, title, url in page_type.sidebar_links():
- if t == topic:
- bulletlink(title, url)
+ # for page_type in pagetypes.all_page_types().values():
+ # if issubclass(page_type, pagetypes.PageRenderer):
+ # for t, title, url in page_type.sidebar_links():
+ # if t == topic:
+ # bulletlink(title, url)
if not first: # at least one item rendered
html.end_foldable_container()
- for topic, s in visuals_by_topic(views.permitted_views().items() +
dashboard.permitted_dashboards().items()):
- render_topic(topic, s)
+ # TODO: One bright day drop this whole visuals stuff and only use page_types
+ page_type_topics = {}
+ for page_type in pagetypes.all_page_types().values():
+ if issubclass(page_type, pagetypes.PageRenderer):
+ for t, title, url in page_type.sidebar_links():
+ page_type_topics.setdefault(t, []).append((t, title, url, False))
+
+ visuals_topics_with_entries = visuals_by_topic(views.permitted_views().items() +
dashboard.permitted_dashboards().items())
+ all_topics_with_entries = []
+ for topic, entries in visuals_topics_with_entries:
+ if topic in page_type_topics:
+ entries = entries + page_type_topics[topic]
+ del page_type_topics[topic]
+ all_topics_with_entries.append((topic, entries))
+
+ all_topics_with_entries += page_type_topics.items()
+ all_topics_with_entries.sort()
+
+ for topic, entries in all_topics_with_entries:
+ render_topic(topic, entries)
+
links = []
if config.may("general.edit_views"):