#9270 InOctets and outOctets must be enabbled for graph

This commit is contained in:
Jonathan 2023-01-30 17:01:06 +01:00
parent 532a90252c
commit c75a49c6ec
3 changed files with 69 additions and 55 deletions

View File

@ -847,6 +847,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
$permission = check_acl($config['id_user'], $agent['id_grupo'], 'RR');
if ($permission) {
if ($interface['traffic']['in'] > 0 && $interface['traffic']['out'] > 0) {
$params = [
'interface_name' => $interface_name,
'agent_id' => $id_agente,
@ -871,6 +872,9 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
['title' => __('Interface traffic')]
);
$graph_link .= '</a>';
} else {
$graph_link = __('inOctets and outOctets must be enabled.');
}
} else {
$graph_link = '';
}

View File

@ -539,8 +539,10 @@ function print_table(
$select_if_usage_module_data_out_down
);
$table->head[8] = __('Last data');
$table->head[8] .= ui_get_sorting_arrows(
$table->head[8] = __('Graph');
$table->head[9] = __('Last data');
$table->head[9] .= ui_get_sorting_arrows(
$last_data.'up',
$last_data.'down',
$select_if_last_data_up,
@ -684,6 +686,7 @@ function print_table(
$permission = check_acl_one_of_groups($config['id_user'], $all_groups, 'RR');
if ($permission) {
if ($agent_interfaces['traffic']['in'] > 0 && $agent_interfaces['traffic']['out'] > 0) {
$params = [
'interface_name' => $agent_interfaces['if_name'],
'agent_id' => $agent_interfaces['agent_id'],
@ -704,6 +707,9 @@ function print_table(
'class' => 'invert_filter',
]
).'</a>';
} else {
$graph_link = __('inOctets and outOctets must be enabled.');
}
} else {
$graph_link = '';
}
@ -715,8 +721,8 @@ function print_table(
$table_data[$loop_index]['if_out_octets'] = ($ifOutOctets['datos'] === null) ? __('N/A') : $ifOutOctets['datos'];
$table_data[$loop_index]['if_usage_module_data_in'] = ($usage_module_data_in['datos'] === null) ? __('N/A') : $usage_module_data_in['datos'];
$table_data[$loop_index]['if_usage_module_data_out'] = ($usage_module_data_out['datos'] === null) ? __('N/A') : $usage_module_data_out['datos'];
$table_data[$loop_index]['if_graph'] = $graph_link;
$table_data[$loop_index]['if_last_data'] = human_time_comparation($agent_interfaces['last_contact']);
$table_data[$loop_index]['if_last_data'] .= $graph_link;
$loop_index++;
}

View File

@ -1265,6 +1265,7 @@ if (is_ajax() === true) {
$permission = check_acl($config['id_user'], $agent['id_grupo'], 'RR');
if ($permission) {
if ($interface['traffic']['in'] > 0 && $interface['traffic']['out'] > 0) {
$params = [
'interface_name' => $interface_name,
'agent_id' => $id_agent,
@ -1275,6 +1276,9 @@ if (is_ajax() === true) {
$params_encoded = base64_encode($params_json);
$win_handle = dechex(crc32($interface['status_module_id'].$interface_name));
$graph_link = "<a href=\"javascript:winopeng_var('operation/agentes/interface_traffic_graph_win.php?params=$params_encoded','$win_handle', 800, 480)\">".html_print_image('images/chart_curve.png', true, ['title' => __('Interface traffic')]).'</a>';
} else {
$graph_link = __('inOctets and outOctets must be enabled.');
}
} else {
$graph_link = '';
}