Module: check_mk
Branch: master
Commit: 7d6b08580cbfd3225b5ccca97fb76d3672a7e75a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7d6b08580cbfd3…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Tue Apr 26 17:27:48 2016 +0200
3125 FIX fixed grouping of werk list by version
The entries in the werk list when grouping by version were still sorted by date only and
thus there
could be multiple groups for one version, interrupted by an older version.
---
.werks/3125 | 11 +++++++++++
ChangeLog | 1 +
web/htdocs/werks.py | 20 +++++++++++++++++++-
3 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/.werks/3125 b/.werks/3125
new file mode 100644
index 0000000..bdba236
--- /dev/null
+++ b/.werks/3125
@@ -0,0 +1,11 @@
+Title: fixed grouping of werk list by version
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1461684350
+
+The entries in the werk list when grouping by version were still sorted by date only and
thus there
+could be multiple groups for one version, interrupted by an older version.
diff --git a/ChangeLog b/ChangeLog
index fcaeffb..d6f5372 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -247,6 +247,7 @@
* 3402 FIX: Using information from inventory in column tooltips now longer crashes
* 3413 FIX: Correctly display non-Ascii-characters in host tag values in host tag
filter
* 3029 FIX: rule editor icon: fixed query of invalid livestatus column...
+ * 3125 FIX: fixed grouping of werk list by version...
WATO:
* 3244 WATO BI Module: swap order of aggregation function and child node
selection...
diff --git a/web/htdocs/werks.py b/web/htdocs/werks.py
index 8363ace..89e4c5f 100644
--- a/web/htdocs/werks.py
+++ b/web/htdocs/werks.py
@@ -384,7 +384,14 @@ def render_werks_table():
def begin_group(title):
table.begin(title=title, limit=None, searchable = False, sortable = False,
css="werks")
- for werk in werks_sorted_by_date(g_werks.values()):
+ werklist = []
+
+ if werk_table_options["grouping"] == "version":
+ werklist = werks_sorted_by_version(g_werks.values())
+ else:
+ werklist = werks_sorted_by_date(g_werks.values())
+
+ for werk in werklist:
if werk_matches_options(werk, werk_table_options):
group = werk_group_value(werk, werk_table_options["grouping"])
if group != current_group:
@@ -581,3 +588,14 @@ def insert_manpage_links(text):
def werks_sorted_by_date(werks):
return sorted(werks, cmp = lambda a, b: -cmp(a["date"],
b["date"]))
+
+
+# sort by version and within one version by date
+def werks_sorted_by_version(werks):
+ def by_version(lhs, rhs):
+ if lhs["version"] == rhs["version"]:
+ return cmp(lhs["date"], rhs["date"])
+ else:
+ return cmp(lhs["version"], rhs["version"])
+
+ return sorted(werks, cmp=by_version, reverse=True)