Module: check_mk
Branch: master
Commit: dd8d0ba81f81d32f7981d1a6b1e991a71f4fe3d0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=dd8d0ba81f81d3…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jan 30 08:09:31 2018 +0100
5662 Tactical overview: Can now be configured to not show stale hosts/services
There is a new permission <i>See stale objects in tactical overview snapin</i>
which
can be used to hide the stale hosts and services column from the tactical overview
snapin. This permission is enabled by default for all roles to stick with the current
default behaviour.
Change-Id: I9db89529f80f7877734d2b1821ab84b9aaed85fd
---
.werks/5662 | 13 +++++++++++++
web/htdocs/default_permissions.py | 5 +++++
web/plugins/sidebar/shipped.py | 6 ++++--
3 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/.werks/5662 b/.werks/5662
new file mode 100644
index 0000000..374770a
--- /dev/null
+++ b/.werks/5662
@@ -0,0 +1,13 @@
+Title: Tactical overview: Can now be configured to not show stale hosts/services
+Level: 1
+Component: multisite
+Compatible: compat
+Edition: cre
+Version: 1.5.0i3
+Date: 1517296086
+Class: feature
+
+There is a new permission <i>See stale objects in tactical overview
snapin</i> which
+can be used to hide the stale hosts and services column from the tactical overview
+snapin. This permission is enabled by default for all roles to keep the current
+default behaviour.
diff --git a/web/htdocs/default_permissions.py b/web/htdocs/default_permissions.py
index 6cfac31..0cdb5fe 100644
--- a/web/htdocs/default_permissions.py
+++ b/web/htdocs/default_permissions.py
@@ -165,6 +165,11 @@ def load_plugins(force):
"and the configured <a
href=\"wato.py?mode=edit_configvar&varname=failed_notification_horizon\">Failed
notification horizon</a>."),
[ "admin" ])
+ config.declare_permission("general.see_stales_in_tactical_overview",
+ _("See stale objects in tactical overview snapin"),
+ _("Show the column for stale host and service checks in the tactical
overview snapin."),
+ [ "guest", "user", "admin" ])
+
loaded_with_language = current_language
diff --git a/web/plugins/sidebar/shipped.py b/web/plugins/sidebar/shipped.py
index dff3f4c..20cc2e2 100644
--- a/web/plugins/sidebar/shipped.py
+++ b/web/plugins/sidebar/shipped.py
@@ -755,6 +755,8 @@ def render_tactical_overview(extra_filter_headers="",
extra_url_variables=None):
html.open_table(class_=["content_center", "tacticaloverview"],
cellspacing=2, cellpadding=0, border=0)
+ show_stales = config.user.may("general.see_stales_in_tactical_overview")
+
for row in rows:
if row["what"] == "event":
amount, problems, unhandled_problems = row["data"]
@@ -770,7 +772,7 @@ def render_tactical_overview(extra_filter_headers="",
extra_url_variables=None):
html.th(row["title"])
html.th(_("Problems"))
html.th(_("Unhandled"))
- if td_class == 'col4':
+ if show_stales and td_class == 'col4':
html.th(_("Stale"))
html.close_tr()
@@ -786,7 +788,7 @@ def render_tactical_overview(extra_filter_headers="",
extra_url_variables=None):
link(str(value), url)
html.close_td()
- if td_class == 'col4':
+ if show_stales and td_class == 'col4':
if row["views"]["stale"]:
url = html.makeuri_contextless(row["views"]["stale"]
+ extra_url_variables, filename="view.py")
html.open_td(class_=[td_class, "states prob" if stales != 0
else None])