Module: check_mk
Branch: master
Commit: 400cca1cb55f3da447603b6bb1fde31cc949511f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=400cca1cb55f3d…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Jan 20 14:41:18 2016 +0100
#2830 FIX Improved sorting in view column "Services colored according to state"
The sorting of this view column was quite random.
It has been changed to case-insensitive hostname/service description sorting.
---
.werks/2830 | 10 ++++++++++
ChangeLog | 1 +
web/plugins/views/painters.py | 8 +++++++-
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/.werks/2830 b/.werks/2830
new file mode 100644
index 0000000..eb1d1ad
--- /dev/null
+++ b/.werks/2830
@@ -0,0 +1,10 @@
+Title: Improved sorting in view column "Services colored according to state"
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.2.7i4
+Date: 1453296945
+Class: fix
+
+The sorting of this view column was quite random.
+It has been changed to case-insensitive hostname/service description sorting.
diff --git a/ChangeLog b/ChangeLog
index 0f53543..416f176 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -227,6 +227,7 @@
* 2822 FIX: Availabiltiy: Fixed exception while rendering the timeline...
* 2901 FIX: Fixed issue editing availability annotations...
* 2904 FIX: Improved error handling when custom url dashlets raise an exception...
+ * 2830 FIX: Improved sorting in view column "Services colored according to
state"...
WATO:
* 2442 WATO remove host: improved cleanup of obsolete host files...
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index af76f73..57a3f18 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -1480,7 +1480,13 @@ multisite_painters["num_services_pending"] = {
def paint_service_list(row, columnname):
h = "<div class=objectlist>"
- for entry in row[columnname]:
+ def sort_key(entry):
+ if columnname.startswith("servicegroup"):
+ return entry[0].lower(), entry[1].lower()
+ else:
+ return entry[0].lower()
+
+ for entry in sorted(row[columnname], key = sort_key):
if columnname.startswith("servicegroup"):
host, svc, state, checked = entry
text = host + " ~ " + svc