Module: check_mk
Branch: master
Commit: bbbe2205e66962aaa844b3b02b85ee30e081b7c3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bbbe2205e66962…
Author: Kenneth Okoh <ko(a)mathias-kettner.de>
Date: Thu Nov 8 13:27:53 2018 +0100
Moved (host & service) groups from shipped.py to dedicated modules
Change-Id: Ibe8e3d2a6afdbe02aaaa3b1cf061b82fa688617c
---
cmk/gui/plugins/sidebar/groups.py | 53 ++++++++++++++++++++++++++++++++++++++
cmk/gui/plugins/sidebar/shipped.py | 32 -----------------------
2 files changed, 53 insertions(+), 32 deletions(-)
diff --git a/cmk/gui/plugins/sidebar/groups.py b/cmk/gui/plugins/sidebar/groups.py
new file mode 100644
index 0000000..190cc54
--- /dev/null
+++ b/cmk/gui/plugins/sidebar/groups.py
@@ -0,0 +1,53 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# tails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+import cmk.gui.sites as sites
+from cmk.gui.i18n import _
+from cmk.gui.globals import html
+
+from cmk.gui.plugins.sidebar import sidebar_snapins, bulletlink
+
+def render_groups(what):
+ html.open_ul()
+ for name, alias in sites.all_groups(what):
+ url = "view.py?view_name=%sgroup&%sgroup=%s" % (what, what,
html.urlencode(name))
+ bulletlink(alias or name, url)
+ html.close_ul()
+
+sidebar_snapins["hostgroups"] = {
+ "title" : _("Host Groups"),
+ "description" : _("Directs links to all host groups"),
+ "render" : lambda: render_groups("host"),
+ "restart": True,
+ "allowed" : [ "user", "admin", "guest" ]
+}
+sidebar_snapins["servicegroups"] = {
+ "title" : _("Service Groups"),
+ "description" : _("Direct links to all service groups"),
+ "render" : lambda: render_groups("service"),
+ "restart": True,
+ "allowed" : [ "user", "admin", "guest" ]
+}
diff --git a/cmk/gui/plugins/sidebar/shipped.py b/cmk/gui/plugins/sidebar/shipped.py
index 54424f7..2e8c04b 100644
--- a/cmk/gui/plugins/sidebar/shipped.py
+++ b/cmk/gui/plugins/sidebar/shipped.py
@@ -189,38 +189,6 @@ sidebar_snapins["dashboards"] = {
}
#.
-# .--Groups--------------------------------------------------------------.
-# | ____ |
-# | / ___|_ __ ___ _ _ _ __ ___ |
-# | | | _| '__/ _ \| | | | '_ \/ __| |
-# | | |_| | | | (_) | |_| | |_) \__ \ |
-# | \____|_| \___/ \__,_| .__/|___/ |
-# | |_| |
-# '----------------------------------------------------------------------'
-
-def render_groups(what):
- html.open_ul()
- for name, alias in sites.all_groups(what):
- url = "view.py?view_name=%sgroup&%sgroup=%s" % (what, what,
html.urlencode(name))
- bulletlink(alias or name, url)
- html.close_ul()
-
-sidebar_snapins["hostgroups"] = {
- "title" : _("Host Groups"),
- "description" : _("Directs links to all host groups"),
- "render" : lambda: render_groups("host"),
- "restart": True,
- "allowed" : [ "user", "admin", "guest" ]
-}
-sidebar_snapins["servicegroups"] = {
- "title" : _("Service Groups"),
- "description" : _("Direct links to all service groups"),
- "render" : lambda: render_groups("service"),
- "restart": True,
- "allowed" : [ "user", "admin", "guest" ]
-}
-
-#.
# .--Hosts---------------------------------------------------------------.
# | _ _ _ |
# | | | | | ___ ___| |_ ___ |