Commit f12c505a authored by Franco Fichtner's avatar Franco Fichtner

gateways: always show the same precision; closes #1594

parent e438bfc9
...@@ -415,8 +415,8 @@ function return_gateways_status($byname = false) ...@@ -415,8 +415,8 @@ function return_gateways_status($byname = false)
$status[$target]['monitorip'] = $info[0]; $status[$target]['monitorip'] = $info[0];
$status[$target]['srcip'] = $info[1]; $status[$target]['srcip'] = $info[1];
$status[$target]['name'] = $info[2]; $status[$target]['name'] = $info[2];
$status[$target]['delay'] = empty($info[6]) ? "0ms" : round($info[6], 1) ."ms" ; $status[$target]['delay'] = sprintf('%0.1f ms', empty($info[6]) ? 0.0 : round($info[6], 1));
$status[$target]['loss'] = empty($info[7]) ? "0.0%" : round($info[7], 1) . "%"; $status[$target]['loss'] = sprintf('%0.1f %%', empty($info[7]) ? 0.0 : round($info[7], 1));
$status[$target]['status'] = trim($info[8]); $status[$target]['status'] = trim($info[8]);
} }
...@@ -445,20 +445,19 @@ function return_gateways_status($byname = false) ...@@ -445,20 +445,19 @@ function return_gateways_status($byname = false)
} }
/* failsafe for down interfaces */ /* failsafe for down interfaces */
if ($target == "none") { if ($target == 'none') {
$target = $gwitem['name']; $target = $gwitem['name'];
$status[$target]['name'] = $gwitem['name']; $status[$target]['name'] = $gwitem['name'];
$status[$target]['delay'] = "0.0ms"; $status[$target]['status'] = 'down';
$status[$target]['loss'] = "100.0%";
$status[$target]['status'] = "down";
} else { } else {
$status[$target]['monitorip'] = $tgtip; $status[$target]['monitorip'] = $tgtip;
$status[$target]['srcip'] = $srcip; $status[$target]['srcip'] = $srcip;
$status[$target]['name'] = $gwitem['name']; $status[$target]['name'] = $gwitem['name'];
$status[$target]['delay'] = "0.0ms"; $status[$target]['status'] = 'none';
$status[$target]['loss'] = "0.0%";
$status[$target]['status'] = "none";
} }
$status[$target]['delay'] = '0.0 ms';
$status[$target]['loss'] = '100.0 %';
} }
return($status); return($status);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment