Fixed the style for the agents with a hudge list of ips

This commit is contained in:
mdtrooper 2014-10-24 11:03:45 +02:00
parent c025f0ee83
commit edf25fe620
1 changed files with 30 additions and 20 deletions

View File

@ -236,7 +236,11 @@ $table_data->data[] = $data;
if (!empty($addresses)) { if (!empty($addresses)) {
$data = array(); $data = array();
$data[0] = '<b>' . __('Other IP addresses') . '</b>'; $data[0] = '<b>' . __('Other IP addresses') . '</b>';
$data[1] = implode('<br>',$addresses); $data[1] = '<div style="max-height: 150px; overflow-y: auto;">' .
implode('<br>',$addresses) .
'</div>';
//~ $table_data->data[] = '<div style="max-height: 200px; overflow: hidden;>' .
//~ $data . '</div>';
$table_data->data[] = $data; $table_data->data[] = $data;
} }
@ -253,7 +257,7 @@ $table_data->data[] = $data;
$has_remote_conf = enterprise_hook('config_agents_has_remote_configuration',array($agent["id_agente"])); $has_remote_conf = enterprise_hook('config_agents_has_remote_configuration',array($agent["id_agente"]));
if(enterprise_installed()) { if (enterprise_installed()) {
$data = array(); $data = array();
$data[0] = '<b>' . __('Remote configuration') . '</b>'; $data[0] = '<b>' . __('Remote configuration') . '</b>';
if (!$has_remote_conf) { if (!$has_remote_conf) {
@ -270,7 +274,8 @@ if ($config['activate_gis'] || $agent['url_address'] != '') {
$data = array(); $data = array();
// Position Information // Position Information
if ($config['activate_gis']) { if ($config['activate_gis']) {
$dataPositionAgent = gis_get_data_last_position_agent($agent['id_agente']); $dataPositionAgent =
gis_get_data_last_position_agent($agent['id_agente']);
$data[0] = '<b>' . __('Position (Long, Lat)') . '</b>'; $data[0] = '<b>' . __('Position (Long, Lat)') . '</b>';
@ -306,15 +311,20 @@ if ($agent['timezone_offset'] != 0) {
} }
// Custom fields // Custom fields
$fields = db_get_all_rows_filter('tagent_custom_fields', array('display_on_front' => 1)); $fields = db_get_all_rows_filter(
'tagent_custom_fields',
array('display_on_front' => 1));
if ($fields === false) { if ($fields === false) {
$fields = array (); $fields = array ();
} }
foreach ($fields as $field) { foreach ($fields as $field) {
$data = array(); $data = array();
$data[0] = '<b>' . $field['name'] . ui_print_help_tip (__('Custom field'), true) . '</b>'; $data[0] = '<b>' . $field['name'] .
$custom_value = db_get_value_filter('description', 'tagent_custom_data', array('id_field' => $field['id_field'], 'id_agent' => $id_agente)); ui_print_help_tip (__('Custom field'), true) . '</b>';
$custom_value = db_get_value_filter(
'description', 'tagent_custom_data',
array('id_field' => $field['id_field'], 'id_agent' => $id_agente));
if ($custom_value === false || $custom_value == '') { if ($custom_value === false || $custom_value == '') {
$custom_value = '<i>'.__('N/A').'</i>'; $custom_value = '<i>'.__('N/A').'</i>';
} }
@ -326,10 +336,11 @@ foreach ($fields as $field) {
// START: TABLE INCIDENTS // START: TABLE INCIDENTS
$last_incident = db_get_row_sql("SELECT * FROM tincidencia $last_incident = db_get_row_sql("
WHERE estado IN (0,1) SELECT * FROM tincidencia
AND id_agent=$id_agente WHERE estado IN (0,1)
ORDER BY actualizacion DESC"); AND id_agent = $id_agente
ORDER BY actualizacion DESC");
if ($last_incident != false) { if ($last_incident != false) {
@ -390,20 +401,20 @@ if (!empty($modules)) {
if ($matches[1]) { if ($matches[1]) {
$interface_name = $matches[1]; $interface_name = $matches[1];
$interface_name_escaped = str_replace("/", "\/", $interface_name); $interface_name_escaped = str_replace("/", "\/", $interface_name);
if (!isset($interfaces[$interface_name]) if (!isset($interfaces[$interface_name])
|| (isset($interfaces[$interface_name]) || (isset($interfaces[$interface_name])
&& preg_match ("/^ifOperStatus_$interface_name_escaped$/i", (string)$module['nombre'], $matches))) { && preg_match ("/^ifOperStatus_$interface_name_escaped$/i", (string)$module['nombre'], $matches))) {
$interfaces[$interface_name] = $module; $interfaces[$interface_name] = $module;
} }
} }
} }
} }
unset($modules); unset($modules);
if (!empty($interfaces)) { if (!empty($interfaces)) {
$table_interface = new stdClass(); $table_interface = new stdClass();
$table_interface->id = 'agent_interface_info'; $table_interface->id = 'agent_interface_info';
$table_interface->class = 'databox'; $table_interface->class = 'databox';
@ -413,15 +424,14 @@ if (!empty($modules)) {
$table_interface->style['interface_graph'] = 'width: 20px;'; $table_interface->style['interface_graph'] = 'width: 20px;';
$table_interface->head = array(); $table_interface->head = array();
$options = array( $options = array(
"class" => "closed", "class" => "closed",
"style" => "vertical-align:middle; cursor:pointer;" "style" => "vertical-align:middle; cursor:pointer;");
);
$table_interface->head[0] = html_print_image("images/go.png", true, $options) . "&nbsp;&nbsp;"; $table_interface->head[0] = html_print_image("images/go.png", true, $options) . "&nbsp;&nbsp;";
$table_interface->head[0] .= '<span style="vertical-align: middle;">' . __('Interface information') .' (SNMP)</span>'; $table_interface->head[0] .= '<span style="vertical-align: middle;">' . __('Interface information') .' (SNMP)</span>';
$table_interface->head_colspan = array(); $table_interface->head_colspan = array();
$table_interface->head_colspan[0] = 5; $table_interface->head_colspan[0] = 5;
$table_interface->data = array(); $table_interface->data = array();
foreach ($interfaces as $interface_name => $module) { foreach ($interfaces as $interface_name => $module) {
$interface_name_escaped = str_replace("/", "\/", $interface_name); $interface_name_escaped = str_replace("/", "\/", $interface_name);
@ -447,7 +457,7 @@ if (!empty($modules)) {
$mac = $matches[0]; $mac = $matches[0];
} }
} }
// Get the ifInOctets and ifOutOctets modules of the interface // Get the ifInOctets and ifOutOctets modules of the interface
$columns = array( $columns = array(
"id_agente_modulo", "id_agente_modulo",
@ -477,7 +487,7 @@ if (!empty($modules)) {
else { else {
$interface_traffic_modules = false; $interface_traffic_modules = false;
} }
if ($interface_traffic_modules != false) { if ($interface_traffic_modules != false) {
$params = array( $params = array(
'interface_name' => $interface_name, 'interface_name' => $interface_name,