Module: check_mk
Branch: master
Commit: d1910804131593d3646288791e2173f789a428f6
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d1910804131593…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Nov 6 15:22:14 2015 +0100
#2742 FIX Make selection of folders and host group tag filter use nicer drawing
characters
---
.werks/2742 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/htmllib.py | 25 ++++++-------------------
web/htdocs/wato.py | 2 +-
web/plugins/visuals/filters.py | 2 +-
web/plugins/visuals/wato.py | 4 ++--
6 files changed, 21 insertions(+), 23 deletions(-)
diff --git a/.werks/2742 b/.werks/2742
new file mode 100644
index 0000000..8c4d4bf
--- /dev/null
+++ b/.werks/2742
@@ -0,0 +1,10 @@
+Title: Make selection of folders and host group tag filter use nicer drawing characters
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i4
+Date: 1446819695
+
+
diff --git a/ChangeLog b/ChangeLog
index 07e548c..f51e4ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -83,6 +83,7 @@
* 1299 FIX: BI: Fixed recently introduced bug when editing BI Rules...
* 2721 FIX: Fixed user profile sync in distributed environments after profile change
* 2723 FIX: Hiding "discard changes button" after successful activation of
changes
+ * 2742 FIX: Make selection of folders and host group tag filter use nicer drawing
characters
Notifications:
* 2728 FIX: Removed debug notification script (was not executable)...
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 22a671c..417464d 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -588,23 +588,9 @@ class html:
self.form_vars.append(varname)
def sorted_select(self, varname, choices, deflt="", onchange=None, attrs =
{}):
- def sort_function(a, b):
- aStr = bStr = ''
-
- if isinstance(a[1], HTML):
- aStr = a[1].value
- else:
- aStr = a[1]
- if isinstance(b[1], HTML):
- bStr = b[1].value
- else:
- bStr = b[1]
-
- return cmp(aStr.lower(), bStr.lower())
-
# Sort according to display texts, not keys
sorted = choices[:]
- sorted.sort(sort_function)
+ sorted.sort(lambda a,b: cmp(a[1].lower(), b[1].lower()))
self.select(varname, sorted, deflt, onchange, attrs)
# Choices is a list pairs of (key, title). They keys of the choices
@@ -615,14 +601,15 @@ class html:
attrs.setdefault('size', 1)
attributes = ' ' + ' '.join([ '%s="%s"' % (k,
v) for k, v in attrs.iteritems() ])
- self.write("<select%s name=\"%s\"
id=\"%s\"%s>\n" % (onchange_code, varname, varname, attributes))
+ self.write("<select%s name=\"%s\"
id=\"%s\"%s>\n" %
+ (onchange_code, varname, varname, attributes))
for value, text in choices:
if value == None:
value = ""
- sel = value == current and " SELECTED" or ""
- self.write('<option value="%s"%s>%s</option>\n'
%
+ sel = value == current and " selected" or ""
+ self.write("<option
value=\"%s\"%s>%s</option>\n" %
(self.attrencode(value), sel, self.attrencode(text)))
- self.write('</select>\n')
+ self.write("</select>\n")
if varname:
self.form_vars.append(varname)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index f91afb9..38ef972 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -15449,7 +15449,7 @@ def show_rule_in_table(rulespec, tag_specs, host_list, item_list,
varname, value
def folder_selection(folder, depth=0):
if depth:
- title_prefix = " " * depth + "`
" + "- " * depth
+ title_prefix = (u"\u00a0" * 6 * depth) + u"\u2514\u2500 "
else:
title_prefix = ""
sel = [ (folder[".path"], HTML(title_prefix +
html.attrencode(folder["title"]))) ]
diff --git a/web/plugins/visuals/filters.py b/web/plugins/visuals/filters.py
index 11d046c..a351e33 100644
--- a/web/plugins/visuals/filters.py
+++ b/web/plugins/visuals/filters.py
@@ -967,7 +967,7 @@ class FilterHostTags(Filter):
groups = [ (e[0], e[1].lstrip("/") ) for e in config.wato_host_tags ]
operators = [
("is", _("=")),
- ("isnot", HTML(_("≠"))),
+ ("isnot", _(u"≠")),
]
# replace unicode strings, before writing out as "json"
diff --git a/web/plugins/visuals/wato.py b/web/plugins/visuals/wato.py
index 3238f53..cae6ab6 100644
--- a/web/plugins/visuals/wato.py
+++ b/web/plugins/visuals/wato.py
@@ -92,11 +92,11 @@ class FilterWatoFile(Filter):
def folder_selection(self, folder, prefix, depth):
my_path = folder[".path"]
if depth:
- title_prefix = " " * depth + "`
" + "- " * depth
+ title_prefix = (u"\u00a0" * 6 * depth) + u"\u2514\u2500
"
else:
title_prefix = ""
self.path_to_tree[my_path] = folder["title"]
- sel = [ (my_path , HTML(title_prefix +
html.attrencode(folder["title"]))) ]
+ sel = [ (my_path , title_prefix + folder["title"]) ]
sel += self.sublist(folder.get(".folders", {}), my_path, depth)
return sel