Module: check_mk
Branch: master
Commit: 396f873239620f9d5767029fef0100636da82052
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=396f873239620f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Aug 28 10:52:31 2017 +0200
Revert "Revert "View editor: Prefix painter/sorter choices with related info titles""
This reverts commit bda8003b43c25657acd3a022423ffd80e5df9307.
---
web/htdocs/views.py | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 03d8ef2..ab7822f 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -1215,7 +1215,7 @@ def view_editor_specs(ds_name, general_properties=True):
elements = [
DropdownChoice(
title = _('Column'),
- choices = [ (name, p["title"]) for name, p
+ choices = [ (name, get_painter_title_for_choices(p)) for name, p
in sorters_of_datasource(ds_name).items() ],
sorted = True,
no_preselect = True,
@@ -2428,13 +2428,20 @@ def allowed_for_datasource(collection, datasourcename):
allowed = {}
for name, item in collection.items():
- columns = get_painter_columns(item)
- infos_needed = set([ c.split("_", 1)[0] for c in columns if c != "site" and c not in add_columns])
+ infos_needed = infos_needed_by_painter(item, add_columns)
if len(infos_needed.difference(infos_available)) == 0:
allowed[name] = item
return allowed
+def infos_needed_by_painter(painter, add_columns=None):
+ if add_columns is None:
+ add_columns = []
+
+ columns = get_painter_columns(painter)
+ return set([ c.split("_", 1)[0] for c in columns if c != "site" and c not in add_columns])
+
+
# Returns either the valuespec of the painter parameters or None
def get_painter_params_valuespec(painter):
if "params" not in painter:
@@ -2450,16 +2457,29 @@ def painter_choices(painters, add_params=False):
choices = []
for name, painter in painters.items():
+ title = get_painter_title_for_choices(painter)
+
# Add the optional valuespec for painter parameters
if add_params and "params" in painter:
vs_params = get_painter_params_valuespec(painter)
- choices.append((name, painter["title"], vs_params))
+ choices.append((name, title, vs_params))
else:
- choices.append((name, painter["title"]))
+ choices.append((name, title))
return sorted(choices, key=lambda x: x[1])
+def get_painter_title_for_choices(painter):
+ info_title = "/".join([ visuals.infos[info_name]["title_plural"] for info_name
+ in sorted(infos_needed_by_painter(painter)) ])
+
+ # TODO: Cleanup the special case for sites. How? Add an info for it?
+ if painter["columns"] == ["site"]:
+ info_title = _("Site")
+
+ return "%s: %s" % (info_title, painter["title"])
+
+
def painter_choices_with_params(painters):
return painter_choices(painters, add_params=True)
Module: check_mk
Branch: master
Commit: b21a8ea9ebede3c804ffe0518ae89f8095b1218c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b21a8ea9ebede3…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Aug 28 08:00:18 2017 +0200
Small speed up of test executions
Change-Id: I49a6dd97819ebc1e6232c938b4589960c8e4de5c
---
tests/testlib/__init__.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tests/testlib/__init__.py b/tests/testlib/__init__.py
index d166b88..6579c2b 100644
--- a/tests/testlib/__init__.py
+++ b/tests/testlib/__init__.py
@@ -558,15 +558,17 @@ class Site(object):
# These things are needed to make the site basically being setup. So this
# is checked during site initialization instead of a dedicated test.
def verify_cmk(self):
+ # First test whether or not the Check_MK is working at all
p = self.execute(["cmk", "--help"], stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, close_fds=True)
stdout = p.communicate()[0]
assert p.returncode == 0, "Failed to execute 'cmk': %s" % stdout
- p = self.execute(["cmk", "-U"], stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT, close_fds=True)
- stdout = p.communicate()[0]
- assert p.returncode == 0, "Failed to execute 'cmk -U': %s" % stdout
+ # Then ensure the core configuration is up-to-date
+ #p = self.execute(["cmk", "-U"], stdout=subprocess.PIPE,
+ # stderr=subprocess.STDOUT, close_fds=True)
+ #stdout = p.communicate()[0]
+ #assert p.returncode == 0, "Failed to execute 'cmk -U': %s" % stdout
def prepare_for_tests(self):