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