[Netflow live] Remove unit from statistics table

Former-commit-id: 2b0289fef0b663b558794b2ac1b16d0128c68bc9
This commit is contained in:
fermin831 2019-03-14 09:07:17 +01:00
parent 473a40e7d2
commit 834c18e49e

View File

@ -236,11 +236,10 @@ function sort_netflow_data(&$netflow_data)
* @param string start_date Start date. * @param string start_date Start date.
* @param string end_date End date. * @param string end_date End date.
* @param string aggregate Aggregate field. * @param string aggregate Aggregate field.
* @param string unit Unit to show.
* *
* @return The statistics table. * @return The statistics table.
*/ */
function netflow_stat_table($data, $start_date, $end_date, $aggregate, $unit) function netflow_stat_table($data, $start_date, $end_date, $aggregate)
{ {
global $nfdump_date_format; global $nfdump_date_format;
@ -256,7 +255,7 @@ function netflow_stat_table($data, $start_date, $end_date, $aggregate, $unit)
$table->head = []; $table->head = [];
$table->head[0] = '<b>'.netflow_format_aggregate($aggregate).'</b>'; $table->head[0] = '<b>'.netflow_format_aggregate($aggregate).'</b>';
$table->head[1] = '<b>'.netflow_format_unit($unit).'</b>'; $table->head[1] = '<b>'.__('Value').'</b>';
$table->style[0] = 'padding: 6px;'; $table->style[0] = 'padding: 6px;';
$table->style[1] = 'padding: 6px;'; $table->style[1] = 'padding: 6px;';
@ -264,14 +263,20 @@ function netflow_stat_table($data, $start_date, $end_date, $aggregate, $unit)
$agg = $data[$j]['agg']; $agg = $data[$j]['agg'];
if (!isset($values[$agg])) { if (!isset($values[$agg])) {
$values[$agg] = $data[$j]['data']; $values[$agg] = $data[$j]['data'];
$table->data[$x][0] = $agg;
$table->data[$x][1] = format_numeric($data[$j]['data']).'&nbsp;'.netflow_format_unit($unit);
} else { } else {
$values[$agg] += $data[$j]['data']; $values[$agg] += $data[$j]['data'];
$table->data[$x][0] = $agg;
$table->data[$x][1] = format_numeric($data[$j]['data']).'&nbsp;'.netflow_format_unit($unit);
} }
$table->data[$x][0] = $agg;
$table->data[$x][1] = format_for_graph(
$data[$j]['data'],
2,
'.',
',',
1024,
'B'
);
$j++; $j++;
$x++; $x++;
} }
@ -1214,7 +1219,7 @@ function netflow_draw_item($start_date, $end_date, $interval_length, $type, $fil
$filter, $filter,
$aggregate, $aggregate,
$max_aggregates, $max_aggregates,
$unit, true,
$connection_name, $connection_name,
$address_resolution $address_resolution
); );
@ -1223,7 +1228,7 @@ function netflow_draw_item($start_date, $end_date, $interval_length, $type, $fil
} }
if ($output == 'HTML' || $output == 'PDF') { if ($output == 'HTML' || $output == 'PDF') {
$html = netflow_stat_table($data, $start_date, $end_date, $aggregate, $unit); $html = netflow_stat_table($data, $start_date, $end_date, $aggregate);
return $html; return $html;
} else if ($output == 'XML') { } else if ($output == 'XML') {
return netflow_stat_xml($data); return netflow_stat_xml($data);