#9270 upgrades interface view + show interface on agent view
This commit is contained in:
parent
1522990afd
commit
532a90252c
|
@ -68,13 +68,16 @@ function print_filters($sec)
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$table->data[1][0] = __('Agents');
|
$table->data[1][0] = __('Filter Agents');
|
||||||
|
$table->data[1][1] = html_print_input_text('filter_agents', '', '', 20, 255, true);
|
||||||
|
|
||||||
|
$table->data[2][0] = __('Agents');
|
||||||
|
|
||||||
if (empty($agents) === true || $agents == -1) {
|
if (empty($agents) === true || $agents == -1) {
|
||||||
$agents = [];
|
$agents = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->data[1][1] = html_print_select(
|
$table->data[2][1] = html_print_select(
|
||||||
[],
|
[],
|
||||||
'selected_agents[]',
|
'selected_agents[]',
|
||||||
'',
|
'',
|
||||||
|
@ -90,8 +93,8 @@ function print_filters($sec)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Interfaces.
|
// Interfaces.
|
||||||
$table->data[1][3] = '<b>'.__('Interfaces').'</b>';
|
$table->data[2][3] = '<b>'.__('Interfaces').'</b>';
|
||||||
$table->data[1][4] = html_print_select(
|
$table->data[2][4] = html_print_select(
|
||||||
[],
|
[],
|
||||||
'selected_interfaces[]',
|
'selected_interfaces[]',
|
||||||
$selected_interfaces,
|
$selected_interfaces,
|
||||||
|
@ -677,6 +680,34 @@ function print_table(
|
||||||
$table_data[$loop_index]['if_agent_name'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente='.$agent_interfaces['agent_id'].'">'.$agent_interfaces['agent_alias'].'</a>';
|
$table_data[$loop_index]['if_agent_name'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente='.$agent_interfaces['agent_id'].'">'.$agent_interfaces['agent_alias'].'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$all_groups = agents_get_all_groups_agent($agent_interfaces['agent_id']);
|
||||||
|
$permission = check_acl_one_of_groups($config['id_user'], $all_groups, 'RR');
|
||||||
|
|
||||||
|
if ($permission) {
|
||||||
|
$params = [
|
||||||
|
'interface_name' => $agent_interfaces['if_name'],
|
||||||
|
'agent_id' => $agent_interfaces['agent_id'],
|
||||||
|
'traffic_module_in' => $agent_interfaces['traffic']['in'],
|
||||||
|
'traffic_module_out' => $agent_interfaces['traffic']['out'],
|
||||||
|
];
|
||||||
|
$params_json = json_encode($params);
|
||||||
|
$params_encoded = base64_encode($params_json);
|
||||||
|
$win_handle = dechex(crc32($interface['status_module_id'].$agent_interfaces['if_name']));
|
||||||
|
$graph_link = "<a href=\"javascript:winopeng_var('operation/agentes/interface_traffic_graph_win.php?params=";
|
||||||
|
$graph_link .= $params_encoded."','";
|
||||||
|
$graph_link .= $win_handle."', 800, 480)\">";
|
||||||
|
$graph_link .= html_print_image(
|
||||||
|
'images/chart.png',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'title' => __('Interface traffic'),
|
||||||
|
'class' => 'invert_filter',
|
||||||
|
]
|
||||||
|
).'</a>';
|
||||||
|
} else {
|
||||||
|
$graph_link = '';
|
||||||
|
}
|
||||||
|
|
||||||
$table_data[$loop_index]['if_name'] = $agent_interfaces['if_name'];
|
$table_data[$loop_index]['if_name'] = $agent_interfaces['if_name'];
|
||||||
$table_data[$loop_index]['if_status_image'] = $agent_interfaces['status_image'];
|
$table_data[$loop_index]['if_status_image'] = $agent_interfaces['status_image'];
|
||||||
$table_data[$loop_index]['if_speed_data'] = ($if_speed_value === null) ? __('N/A') : $if_speed_value.' '.$if_speed_unit;
|
$table_data[$loop_index]['if_speed_data'] = ($if_speed_value === null) ? __('N/A') : $if_speed_value.' '.$if_speed_unit;
|
||||||
|
@ -685,6 +716,7 @@ function print_table(
|
||||||
$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_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_usage_module_data_out'] = ($usage_module_data_out['datos'] === null) ? __('N/A') : $usage_module_data_out['datos'];
|
||||||
$table_data[$loop_index]['if_last_data'] = human_time_comparation($agent_interfaces['last_contact']);
|
$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++;
|
$loop_index++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,6 +137,7 @@ $(document).ready(function() {
|
||||||
if (sec === 'estado' && agent_id > 0) {
|
if (sec === 'estado' && agent_id > 0) {
|
||||||
load_agent_interfaces_selector([agent_id]);
|
load_agent_interfaces_selector([agent_id]);
|
||||||
}
|
}
|
||||||
|
$("#selected_agents").filterByText($("#text-filter_agents"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1411,8 +1411,8 @@ $agent_interfaces = agents_get_network_interfaces(
|
||||||
|
|
||||||
if (isset($agent_interfaces) !== true
|
if (isset($agent_interfaces) !== true
|
||||||
|| isset($agent_interfaces[$id_agente]) !== true
|
|| isset($agent_interfaces[$id_agente]) !== true
|
||||||
|| is_array($agent_interfaces[$id_agente]['interfaces']) !== true
|
|| (is_array($agent_interfaces[$id_agente]['interfaces']) !== true
|
||||||
|| is_object($agent_interfaces[$id_agente]['interfaces']) !== true
|
&& is_object($agent_interfaces[$id_agente]['interfaces']) !== true)
|
||||||
) {
|
) {
|
||||||
$agent_interfaces_count = 0;
|
$agent_interfaces_count = 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue