Module: check_mk
Branch: master
Commit: 9c22a30e191c41fe370ed9caf0eca736785bafcf
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9c22a30e191c41…
Author: Kenneth Okoh <ko(a)mathias-kettner.de>
Date: Fri Oct 26 15:32:40 2018 +0200
Moved server_time from shipped.py to dedicated module
Change-Id: I5d604c8e9006d05fb9979246376207f06f6c321f
---
cmk/gui/plugins/sidebar/server_time.py | 60 ++++++++++++++++++++++++++++++++++
cmk/gui/plugins/sidebar/shipped.py | 35 --------------------
2 files changed, 60 insertions(+), 35 deletions(-)
diff --git a/cmk/gui/plugins/sidebar/server_time.py
b/cmk/gui/plugins/sidebar/server_time.py
new file mode 100644
index 0000000..b4f2559
--- /dev/null
+++ b/cmk/gui/plugins/sidebar/server_time.py
@@ -0,0 +1,60 @@
+#!/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 time
+
+from cmk.gui.i18n import _
+from cmk.gui.globals import html
+
+from cmk.gui.plugins.sidebar import (
+ sidebar_snapins,
+ snapin_width,
+)
+
+
+def render_current_time():
+ html.div(time.strftime("%H:%M"), class_="time")
+
+sidebar_snapins["time"] = {
+ "title" : _("Server Time"),
+ "description" : _("A large clock showing the current time of the web
server"),
+ "refresh" : True,
+ "render" : render_current_time,
+ "allowed" : [ "user", "admin", "guest", ],
+ "styles" : """
+div.time {
+ text-align: center;
+ font-size: 18pt;
+ font-weight: bold;
+ /* The border needs to be substracted from the width */
+ border: 1px solid #8cc;
+ -moz-border-radius: 10px;
+ background-color: #588;
+ color: #aff;
+ width: %dpx;
+}
+""" % (snapin_width - 2)
+}
diff --git a/cmk/gui/plugins/sidebar/shipped.py b/cmk/gui/plugins/sidebar/shipped.py
index 3b06247..54424f7 100644
--- a/cmk/gui/plugins/sidebar/shipped.py
+++ b/cmk/gui/plugins/sidebar/shipped.py
@@ -29,7 +29,6 @@
# TODO: Refactor all snapins to the new snapin API and move page handlers
# from sidebar.py to the snapin objects that need these pages.
-import time
import re
import cmk.paths
@@ -407,40 +406,6 @@ table.performance td.right {
}
#.
-# .--Server Time---------------------------------------------------------.
-# | ____ _____ _ |
-# | / ___| ___ _ ____ _____ _ __ |_ _(_)_ __ ___ ___ |
-# | \___ \ / _ \ '__\ \ / / _ \ '__| | | | | '_ ` _ \ / _ \ |
-# | ___) | __/ | \ V / __/ | | | | | | | | | | __/ |
-# | |____/ \___|_| \_/ \___|_| |_| |_|_| |_| |_|\___| |
-# | |
-# '----------------------------------------------------------------------'
-
-def render_current_time():
- html.div(time.strftime("%H:%M"), class_="time")
-
-sidebar_snapins["time"] = {
- "title" : _("Server Time"),
- "description" : _("A large clock showing the current time of the web
server"),
- "refresh" : True,
- "render" : render_current_time,
- "allowed" : [ "user", "admin", "guest", ],
- "styles" : """
-div.time {
- text-align: center;
- font-size: 18pt;
- font-weight: bold;
- /* The border needs to be substracted from the width */
- border: 1px solid #8cc;
- -moz-border-radius: 10px;
- background-color: #588;
- color: #aff;
- width: %dpx;
-}
-""" % (snapin_width - 2)
-}
-
-#.
# .--Nagios--------------------------------------------------------------.
# | _ _ _ |
# | | \ | | __ _ __ _(_) ___ ___ |