Module: check_mk
Branch: master
Commit: 63822f759c14489896620c483c719a9a63b62d2a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=63822f759c1448…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Thu Oct 9 15:46:11 2014 +0200
Some corrected spellings
---
web/htdocs/views.py | 2 +-
web/plugins/wato/check_parameters.py | 22 +++++++++++-----------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 7eaaf03..ede7d28 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -223,7 +223,7 @@ def DatasourceSelection():
return DropdownChoice(
title = _('Datasource'),
- help = _('The datasources defines which type of objects should be displayed with this view.'),
+ help = _('The datasources define which type of objects should be displayed with this view.'),
choices = datasources,
sorted = True,
columns = 1,
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 14a849b..c49ab8c 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -1442,7 +1442,7 @@ register_check_parameters(
Dictionary(
elements = [
( "error_states", ListChoice(
- title = _("Modem States whats lead to critical state"),
+ title = _("Modem States that lead to a critical state"),
help = _("If one of the selected state occur, the check will repsond with a Critical state "),
choices = [
( 1, "other" ),
@@ -2024,8 +2024,8 @@ filesystem_elements = [
Integer(title = _("Critical if below"), unit = _("hours"), default_value = 6, ),
])),
( "trend_showtimeleft",
- Checkbox( title = _("Display timeleft in check output"), label = _("Enable"),
- help = _("Normally the timeleft until disk full is only displayed when "
+ Checkbox( title = _("Display time left in check output"), label = _("Enable"),
+ help = _("Normally, the time left until the disk is full is only displayed when "
"the configured levels have been breached. If you set this option "
"the check always reports this information"))
),
@@ -2318,7 +2318,7 @@ register_check_parameters(
Alternative(
title = _("Used bandwidth (traffic)"),
help = _("Settings levels on the used bandwidth is optional. If you do set "
- "levels you might also consider using an averaging."),
+ "levels you might also consider using averaging."),
elements = [
Tuple(
title = _("Percentual levels (in relation to policy speed)"),
@@ -2492,7 +2492,7 @@ register_check_parameters(
"currently used memory (RAM or SWAP) by all processes and sets this in relation "
"to the total RAM of the system. This means that the memory usage can exceed 100%. "
"A usage of 200% means that the total size of all processes is twice as large as "
- "the main memory, so <b>at least</b> the half of it is currently swapped out. "
+ "the main memory, so <b>at least</b> half of it is currently swapped out. "
"Besides Linux and UNIX systems, these parameters are also used for memory checks "
"of other devices, like Fortigate devices."),
elements = [
@@ -2551,7 +2551,7 @@ register_check_parameters(
title = _("Averaging"),
help = _("If this parameter is set, all measured values will be averaged "
"over the specified time interval before levels are being applied. Per "
- "default, averaging is turned off. "),
+ "default, averaging is turned off."),
unit = _("minutes"),
minvalue = 1,
default_value = 60,
@@ -2748,7 +2748,7 @@ register_check_parameters(
_("State of ESX hosts and virtual machines"),
Dictionary(
help = _("Usually the check goes to WARN if a VM or host is powered off and OK otherwise. "
- "You can change this behaviour on a per-state-base here."),
+ "You can change this behaviour on a per-state-basis here."),
optional_keys = False,
elements = [
( "states",
@@ -5749,7 +5749,7 @@ register_check_parameters(subgroup_applications,
Checkbox(
title = _("Monitoring of forwarded logfiles"),
label = _("Warn if list of forwarded logfiles changes"),
- help = _("If this option is enabled then the check monitors the list of forwarded "
+ help = _("If this option is enabled, the check monitors the list of forwarded "
"logfiles and will warn you if at any time a logfile is missing or exceeding "
"when compared to the initial list that was snapshotted during service detection. "
"Reinventorize this check in order to make it OK again."),
@@ -5768,9 +5768,9 @@ register_check_parameters(subgroup_applications,
register_rule(group + '/' + subgroup_applications,
varname = "logwatch_groups",
title = _('Logfile Grouping Patterns'),
- help = _('The check <tt>logwatch</tt> normaly creates one service for each logfile '
+ help = _('The check <tt>logwatch</tt> normally creates one service for each logfile. '
'By defining grouping patterns you can switch to the check <tt>logwatch.groups</tt>. '
- 'That check monitors a list of logfiles at once. This is usefull if you have '
+ 'That check monitors a list of logfiles at once. This is useful if you have '
'e.g. a folder with rotated logfiles where the name of the current logfile'
'also changes with each rotation'),
valuespec = ListOf(
@@ -5923,7 +5923,7 @@ register_check_parameters(
help = _("By activating averaging, Check_MK will compute the average of "
"the CPU utilization over a given interval. If you have defined "
"alerting levels then these will automatically be applied on the "
- "averaged value. This helps to mask out short peaks. "),
+ "averaged value. This helps to mask out short peaks."),
unit = _("minutes"),
minvalue = 1,
default_value = 15,
Module: check_mk
Branch: master
Commit: c5feb6c2f84ea3d8fa67cdbac0bab12bf1eaceb6
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c5feb6c2f84ea3…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Oct 9 15:26:52 2014 +0200
Fix exception when creating a new view
---
web/htdocs/views.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 4c30441..e5df3ce 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -517,7 +517,7 @@ def render_view_config(view, general_properties=True):
view['datasource'] = ds_name
for ident, vs in view_editor_specs(ds_name, general_properties):
- vs.render_input(ident, view[ident])
+ vs.render_input(ident, view.get(ident))
# Is used to change the view structure to be compatible to
# the valuespec This needs to perform the inverted steps of the
Module: check_mk
Branch: master
Commit: 8c38c662bb0ace4fc43f113f649ba97976ca4793
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8c38c662bb0ace…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Oct 9 13:59:14 2014 +0200
Feature for showing context buttons also for non-single contexts
---
web/htdocs/views.py | 6 +++--
web/htdocs/visuals.py | 67 +++++++++++++++++++++++++++++++------------------
2 files changed, 46 insertions(+), 27 deletions(-)
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 7eaaf03..4c30441 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -711,7 +711,7 @@ def page_view():
if not view:
raise MKGeneralException(_("No view defined with the name '%s'.") % html.attrencode(view_name))
- html.set_page_context(dict(visuals.get_context_html_vars(view)))
+ html.set_page_context(dict(visuals.get_singlecontext_html_vars(view)))
show_view(view, True, True, True)
@@ -1421,8 +1421,8 @@ def show_context_links(thisview, show_filters, display_options,
view_optiondial_off("refresh")
- # WATO: If we have a host context, then show button to WATO, if permissions allow this
if 'B' in display_options:
+ # WATO: If we have a host context, then show button to WATO, if permissions allow this
if html.has_var("host") \
and config.wato_enabled \
and config.may("wato.use") \
@@ -1436,9 +1436,11 @@ def show_context_links(thisview, show_filters, display_options,
html.context_button(_("WATO"), url, "wato", id="wato",
bestof = config.context_buttons_to_show)
+ # Button for creating an instant report (if reporting is available)
if config.reporting_available():
html.context_button(_("Export as PDF"), html.makeuri([], filename="report_instant.py"), "report")
+ # Buttons to other views, dashboards, etc.
links = visuals.collect_context_links(thisview)
for linktitle, uri, icon, buttonid in links:
html.context_button(linktitle, url=uri, icon=icon, id=buttonid, bestof=config.context_buttons_to_show)
diff --git a/web/htdocs/visuals.py b/web/htdocs/visuals.py
index 95d6f24..1a2b118 100644
--- a/web/htdocs/visuals.py
+++ b/web/htdocs/visuals.py
@@ -32,18 +32,22 @@ import config, table
visual_types = {
'views': {
- 'ident_attr': 'view_name',
- 'title': _("view"),
- 'plural_title': _("views"),
- 'module_name': 'views',
+ 'show_url' : 'view.py',
+ 'ident_attr' : 'view_name',
+ 'title' : _("view"),
+ 'plural_title' : _("views"),
+ 'module_name' : 'views',
+ 'multicontext_links' : False,
},
'dashboards': {
- 'ident_attr': 'name',
- 'title': _("dashboard"),
- 'plural_title': _("dashboards"),
- 'module_name': 'dashboard',
- 'popup_add_handler': 'popup_list_dashboards',
- 'add_visual_handler': 'popup_add_dashlet',
+ 'show_url' : 'dashboard.py',
+ 'ident_attr' : 'name',
+ 'title' : _("dashboard"),
+ 'plural_title' : _("dashboards"),
+ 'module_name' : 'dashboard',
+ 'popup_add_handler' : 'popup_list_dashboards',
+ 'add_visual_handler' : 'popup_add_dashlet',
+ 'multicontext_links' : False,
},
}
@@ -1089,7 +1093,7 @@ def visual_title(what, visual):
# Beware: if a single context visual is being visited *without* a context, then
# the value of the context variable(s) is None. In order to avoid exceptions,
# we simply drop these here.
- extra_titles = [ v for k, v in get_context_html_vars(visual) if v != None ]
+ extra_titles = [ v for k, v in get_singlecontext_html_vars(visual) if v != None ]
# FIXME: Is this really only needed for visuals without single infos?
if not visual['single_infos']:
used_filters = [ multisite_filters[fn] for fn in visual["context"].keys() ]
@@ -1130,7 +1134,7 @@ def get_single_info_keys(visual):
keys += info_params(info_key)
return list(set(keys))
-def get_context_html_vars(visual):
+def get_singlecontext_html_vars(visual):
vars = []
for key in get_single_info_keys(visual):
vars.append((key, html.var(key, visual['context'].get(key))))
@@ -1141,7 +1145,7 @@ def get_context_html_vars(visual):
def collect_context_links(this_visual, mobile = False, only_types = []):
# compute list of html variables needed for this visual
active_filter_vars = set([])
- for var, val in get_context_html_vars(this_visual):
+ for var, val in get_singlecontext_html_vars(this_visual):
if html.has_var(var):
active_filter_vars.add(var)
@@ -1151,14 +1155,15 @@ def collect_context_links(this_visual, mobile = False, only_types = []):
context_links += collect_context_links_of(what, this_visual, active_filter_vars, mobile)
return context_links
-def collect_context_links_of(what, this_visual, active_filter_vars, mobile):
+def collect_context_links_of(visual_type_name, this_visual, active_filter_vars, mobile):
context_links = []
# FIXME: Make this cross module access cleaner
- module_name = visual_types[what]["module_name"]
+ visual_type = visual_types[visual_type_name]
+ module_name = visual_type["module_name"]
thing_module = __import__(module_name)
- thing_module.__dict__['load_%s'% what]()
- available = thing_module.__dict__['permitted_%s' % what]()
+ thing_module.__dict__['load_%s'% visual_type_name]()
+ available = thing_module.__dict__['permitted_%s' % visual_type_name]()
# sort buttons somehow
visuals = available.values()
@@ -1178,23 +1183,35 @@ def collect_context_links_of(what, this_visual, active_filter_vars, mobile):
or mobile and not visual.get('mobile'):
continue
- if not visual['single_infos']:
- continue # skip non single visuals
+ # For dashboards and views we currently only show a link button,
+ # if the target dashboard/view shares a single info with the
+ # current visual.
+ if not visual['single_infos'] and not visual_type["multicontext_links"]:
+ continue # skip non single visuals for dashboard, views
- needed_vars = get_context_html_vars(visual)
+ # We can show a button only if all single contexts of the
+ # target visual are known currently
+ needed_vars = get_singlecontext_html_vars(visual)
skip = False
vars_values = []
for var, val in needed_vars:
if var not in active_filter_vars:
- skip = True
+ skip = True # At least one single context missing
break
-
vars_values.append((var, val))
if not skip:
- # add context link to this visual
- uri = html.makeuri_contextless(vars_values + [(visual_types[what]['ident_attr'], name)],
- filename = what[:-1] + '.py')
+ # add context link to this visual. For reports we put in
+ # the *complete* context, even the non-single one.
+ if visual_type["multicontext_links"]:
+ uri = html.makeuri([(visual_type['ident_attr'], name)],
+ filename = visual_type["show_url"])
+
+ # For views and dashboards currently the current filter
+ # settings
+ else:
+ uri = html.makeuri_contextless(vars_values + [(visual_type['ident_attr'], name)],
+ filename = visual_type["show_url"])
icon = visual.get("icon")
buttonid = "cb_" + name
context_links.append((_u(linktitle), uri, icon, buttonid))