Fix JS Time unless counter.

There is still a small glitch with the global refresh of 10s
sometimes setting an empty string for next_check.

Try check_interval = 5s with Icinga 2.
This commit is contained in:
Michael Friedrich 2014-03-09 19:23:49 +01:00
parent 48e0616ba4
commit 2883fa0bd0
1 changed files with 13 additions and 10 deletions

View File

@ -266,19 +266,22 @@
if (m !== null) { if (m !== null) {
var nm = parseInt(m[1]); var nm = parseInt(m[1]);
var ns = parseInt(m[2]); var ns = parseInt(m[2]);
if (nm >= 0) { if (nm > 0) {
if (ns > 0) { if (ns > 0) {
ns--; ns--;
} else { } else if (ns == 0) {
ns = 59; ns = 59;
nm--; nm--;
} else { //negative means recalculate against 1m
ns = (60 - ns - 1);
nm--;
} }
} else { } else if (nm <= 0) {
if (ns < 59) { if (ns == -59) {
ns++;
} else {
ns = 0; ns = 0;
nm--; nm--;
} else {
ns--;
} }
} }
$(el).html(nm + 'm ' + ns + 's'); $(el).html(nm + 'm ' + ns + 's');