Module: check_mk
Branch: master
Commit: 32a2b8086bb77f304b3e60e464c9dd07e4b0b749
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=32a2b8086bb77f…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Oct 6 18:23:13 2014 +0200
Remove hard code, add module name to load to visual_types
---
web/htdocs/visuals.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/web/htdocs/visuals.py b/web/htdocs/visuals.py
index d107439..23e777e 100644
--- a/web/htdocs/visuals.py
+++ b/web/htdocs/visuals.py
@@ -32,14 +32,16 @@ import config, table
visual_types = {
'views': {
- 'ident_attr': 'view_name',
- 'title': _("view"),
- 'plural_title': _("views"),
+ 'ident_attr': 'view_name',
+ 'title': _("view"),
+ 'plural_title': _("views"),
+ 'module_name': 'views',
},
'dashboards': {
- 'ident_attr': 'name',
+ 'ident_attr': 'name',
'title': _("dashboard"),
'plural_title': _("dashboards"),
+ 'module_name': 'dashboard',
},
}
@@ -1027,7 +1029,7 @@ def collect_context_links_of(what, this_visual, active_filter_vars,
mobile):
context_links = []
# FIXME: Make this cross module access cleaner
- module_name = what == 'views' and what or what[:-1]
+ module_name = visual_types[what]["module_name"]
thing_module = __import__(module_name)
thing_module.__dict__['load_%s'% what]()
available = thing_module.__dict__['permitted_%s' % what]()