Module: check_mk
Branch: master
Commit: bda8003b43c25657acd3a022423ffd80e5df9307
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bda8003b43c256…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Thu Aug 10 15:38:06 2017 +0200
Revert "View editor: Prefix painter/sorter choices with related info titles"
This reverts commit 76d8095cb399144fe1c10444314c6e596d478000.
The commit broke "Problems" / "Alert Statistics" / "Edit
view", leading to a
GUI crash. No idea what exactly is affected by this revert, but I can't see
any negative effect, and editing the problematic view works again.
To be investigated further by the author of the original commit...
Change-Id: I362fd224d1e438c9a3e53b0047d340f9bc27960b
---
web/htdocs/views.py | 30 +++++-------------------------
1 file changed, 5 insertions(+), 25 deletions(-)
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index ab7822f..03d8ef2 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, get_painter_title_for_choices(p)) for
name, p
+ choices = [ (name, p["title"]) for name, p
in sorters_of_datasource(ds_name).items() ],
sorted = True,
no_preselect = True,
@@ -2428,20 +2428,13 @@ def allowed_for_datasource(collection, datasourcename):
allowed = {}
for name, item in collection.items():
- infos_needed = infos_needed_by_painter(item, add_columns)
+ 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])
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:
@@ -2457,29 +2450,16 @@ 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, title, vs_params))
+ choices.append((name, painter["title"], vs_params))
else:
- choices.append((name, title))
+ choices.append((name, painter["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)