Module: check_mk
Branch: master
Commit: 1ce5ce4d4c79ca4dac79790a6f721ae6b3ccb854
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1ce5ce4d4c79ca…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jan 11 10:10:06 2017 +0100
4267 FIX PDF export of filtered alert statistics view was always empty
Change-Id: Ie5437cc5d076f80ca0d8fdf5fbddcb9bf8a71ffb
---
.werks/4267 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/views.py | 5 ++++-
web/htdocs/visuals.py | 2 +-
web/plugins/visuals/filters.py | 17 +++++------------
5 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/.werks/4267 b/.werks/4267
new file mode 100644
index 0000000..d7067b0
--- /dev/null
+++ b/.werks/4267
@@ -0,0 +1,10 @@
+Title: PDF export of filtered alert statistics view was always empty
+Level: 1
+Component: reporting
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i4
+Date: 1484125389
+
+
diff --git a/ChangeLog b/ChangeLog
index 1263aa1..e57e451 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -68,6 +68,7 @@
Reporting & Availability:
* 3652 FIX: Unbreak PDF exports...
+ * 4267 FIX: PDF export of filtered alert statistics view was always empty
Event Console:
* 4154 Do not send notifications if host found and currently in downtime...
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 10501ea..de23118 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -1603,7 +1603,6 @@ def show_view(view, show_heading = False, show_buttons = True,
else:
rows = []
-
# Apply non-Livestatus filters
for filter in all_active_filters:
rows = filter.filter_table(rows)
@@ -2216,8 +2215,12 @@ def do_query_data(query, columns, add_columns, merge_column,
query += "Columns: %s\n" % " ".join(columns)
query += add_headers
sites.live().set_prepend_site(True)
+
if limit != None:
sites.live().set_limit(limit + 1) # + 1: We need to know, if limit is exceeded
+ else:
+ sites.live().set_limit(None)
+
if config.debug_livestatus_queries \
and html.output_format == "html" and
display_options.enabled(display_options.W):
html.open_div(class_=["livestatus", "message"])
diff --git a/web/htdocs/visuals.py b/web/htdocs/visuals.py
index 0b1f120..ea962b1 100644
--- a/web/htdocs/visuals.py
+++ b/web/htdocs/visuals.py
@@ -1053,7 +1053,7 @@ def add_context_to_uri_vars(visual, only_infos=None,
only_count=False):
for info_key in only_infos:
for filter_name, filter_vars in visual['context'].items():
if type(filter_vars) == dict: # this is a multi-context filter
- # We add the filter only if *none* if its HTML variables are present on
the URL
+ # We add the filter only if *none* of its HTML variables are present on
the URL
# This important because checkbox variables are not present if the box is
not checked.
skip = False
for uri_varname, value in filter_vars.items():
diff --git a/web/plugins/visuals/filters.py b/web/plugins/visuals/filters.py
index eb09efa..77a9a65 100644
--- a/web/plugins/visuals/filters.py
+++ b/web/plugins/visuals/filters.py
@@ -884,16 +884,13 @@ class FilterLogClass(Filter):
(8, _("Alert Handlers")) ]
Filter.__init__(self, "log_class", _("Logentry class"),
- "log", [ "logclass%d" % l for l, c in
self.log_classes ], [])
+ "log", [ "logclass_filled" ] + [
"logclass%d" % l for l, c in self.log_classes ], [])
def double_height(self):
return True
def display(self):
- if html.var("filled_in"):
- defval = ""
- else:
- defval = "on"
+ html.hidden_field("logclass_filled", "1", add_var=True)
html.open_table(cellspacing=0, cellpadding=0)
if config.filter_columns == 1:
num_cols = 4
@@ -904,7 +901,7 @@ class FilterLogClass(Filter):
if col == 1:
html.open_tr()
html.open_td()
- html.checkbox("logclass%d" % l, defval)
+ html.checkbox("logclass%d" % l, True)
html.write(c)
html.close_td()
if col == num_cols:
@@ -920,14 +917,10 @@ class FilterLogClass(Filter):
def filter(self, infoname):
headers = []
- if html.var("filled_in"):
- defval = ""
- else:
- defval = "on"
-
for l, c in self.log_classes:
- if html.var("logclass%d" % l, defval) == "on":
+ if html.get_checkbox("logclass%d" % l) != False:
headers.append("Filter: class = %d\n" % l)
+
if len(headers) == 0:
return "Limit: 0\n" # no class allowed
else: