Module: check_mk
Branch: master
Commit: 88a0f8071d34762a375b7b15b2eeab6d2c08c6cd
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=88a0f8071d3476…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue May 6 18:05:40 2014 +0200
BI Availability timewarp: new buttons for moving back and forth
---
.werks/967 | 8 +++++++
ChangeLog | 1 +
web/htdocs/htmllib.py | 3 +++
...on_close_hi.png => button_closetimewarp_hi.png} | Bin 3132 -> 3132 bytes
...on_close_lo.png => button_closetimewarp_lo.png} | Bin 3760 -> 3760 bytes
web/plugins/views/availability.py | 24 ++++++++++++++++++--
6 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/.werks/967 b/.werks/967
new file mode 100644
index 0000000..317377c
--- /dev/null
+++ b/.werks/967
@@ -0,0 +1,8 @@
+Title: BI Availability timewarp: new buttons for moving back and forth
+Level: 1
+Component: reporting
+Version: 1.2.5i3
+Date: 1399392315
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 6aa3c1f..f6d99a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -98,6 +98,7 @@
Reporting & Availability:
* 0756 Allow availability of multisite BI aggregates at once...
* 0966 CSV export for availability works now also for BI aggregates
+ * 0967 BI Availability timewarp: new buttons for moving back and forth
* 0962 FIX: Fix CSV-Export in availability table
Event Console:
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index b569b51..eceb14b 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -332,6 +332,9 @@ class html:
def empty_icon_button(self):
self.write('<img class="iconbutton trans"
src="images/trans.png">')
+ def disabled_icon_button(self, icon):
+ self.write('<img class="iconbutton" align=absmiddle
src="images/icon_%s.png">' % icon)
+
def jsbutton(self, varname, text, onclick, style=''):
if style:
style = ' style="%s"' % style
diff --git a/web/htdocs/images/button_close_hi.png
b/web/htdocs/images/button_closetimewarp_hi.png
similarity index 100%
rename from web/htdocs/images/button_close_hi.png
rename to web/htdocs/images/button_closetimewarp_hi.png
diff --git a/web/htdocs/images/button_close_lo.png
b/web/htdocs/images/button_closetimewarp_lo.png
similarity index 100%
rename from web/htdocs/images/button_close_lo.png
rename to web/htdocs/images/button_closetimewarp_lo.png
diff --git a/web/plugins/views/availability.py b/web/plugins/views/availability.py
index 52be48c..9901ada 100644
--- a/web/plugins/views/availability.py
+++ b/web/plugins/views/availability.py
@@ -877,7 +877,10 @@ def render_timeline(timeline_rows, from_time, until_time,
considered_duration,
table.cell(_("Links"), css="buttons")
if what == "bi":
url = html.makeuri([("timewarp",
str(int(row["from"])))])
- html.icon_button(url, _("Time warp - show BI aggregate during this time
period"), "timewarp")
+ if html.var("timewarp") and int(html.var("timewarp")) ==
int(row["from"]):
+ html.disabled_icon_button("timewarp_off")
+ else:
+ html.icon_button(url, _("Time warp - show BI aggregate during this
time period"), "timewarp")
else:
url = html.makeuri([("anno_site", tl_site),
("anno_host", tl_host),
@@ -1403,7 +1406,24 @@ def render_bi_availability(title, aggr_rows):
expansion_level=bi.load_ex_level(),
only_problems=False, lazy=False)
html.plug()
html.write('<h3>')
- html.icon_button(html.makeuri([("timewarp", "")]),
_("Close Timewarp"), "close")
+
+ # render icons for back and forth
+ if int(these_rows[0]["from"]) == timewarp:
+ html.disabled_icon_button("back_off")
+ have_forth = False
+ previous_row = None
+ for row in these_rows:
+ if int(row["from"]) == timewarp and previous_row != None:
+ html.icon_button(html.makeuri([("timewarp",
str(int(previous_row["from"])))]), _("Jump one phase back"),
"back")
+ elif previous_row and int(previous_row["from"]) == timewarp
and row != these_rows[-1]:
+ html.icon_button(html.makeuri([("timewarp",
str(int(row["from"])))]), _("Jump one phase forth"),
"forth")
+ have_forth = True
+ previous_row = row
+ if not have_forth:
+ html.disabled_icon_button("forth_off")
+
+ html.write(" ")
+ html.icon_button(html.makeuri([("timewarp", "")]),
_("Close Timewarp"), "closetimewarp")
timewarpcode = html.drain()
html.unplug()
timewarpcode += '%s %s</h3>' % (_("Timewarp to
"), time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(timewarp))) + \