Module: check_mk
Branch: master
Commit: 17a858c8d4bac8723451c1837048dea8dc99556f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=17a858c8d4bac8…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Oct 17 11:22:03 2014 +0200
age valuespec: no longer cuts too high values
---
web/htdocs/valuespec.py | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index 9753664..db439c2 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -177,13 +177,20 @@ class Age(ValueSpec):
if self._label:
html.write(self._label + " ")
- for uid, title, value, length in [ ("days", _("days"),
days, 3),
- ("hours", _("hours"),
hours, 2),
- ("minutes", _("mins"),
minutes, 2),
- ("seconds", _("secs"),
seconds, 2) ]:
+ takeover = 0
+ first = True
+ for uid, title, value, tkovr_fac in [ ("days", _("days"),
days, 24),
+ ("hours", _("hours"),
hours, 60),
+ ("minutes", _("mins"),
minutes, 60),
+ ("seconds", _("secs"),
seconds, 60) ]:
if uid in self._display:
- html.number_input(varprefix + "_" + uid, value, length)
+ value += takeover
+ takeover = 0
+ html.number_input(varprefix + "_" + uid, value, first and 6 or
2)
html.write(" %s " % title)
+ first = False
+ else:
+ takeover = (takeover + value) * tkovr_fac
html.write("</div>")
def from_html_vars(self, varprefix):