diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index f6f6ec6a7a..35e4c80690 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -55,19 +55,14 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals $table = new StdClass(); $table->width = '100%'; - $table->class = 'databox data'; + $table->class = 'floating_form'; + $table->id = 'tree_view_module_data'; $table->style = []; - $table->style['title'] = 'font-weight: bold;'; - - if (!$no_head) { - $table->head = []; - $table->head[] = __('Module'); - } - - $table->head_colspan[] = 2; + $table->style['title'] = 'height: 46px; width: 30%; padding-right: 5px; text-align: end;'; + $table->style['data'] = 'height: 46px; width: 70%; padding-left: 5px; font-family: \'Pandora-Regular\';'; $table->data = []; - // Module name + // Module name. if ($module['disabled']) { $cellName = ''.ui_print_truncate_text($module['nombre'], GENERIC_SIZE_TEXT, true, true, true, '[…]', 'text-transform: uppercase;').ui_print_help_tip(__('Disabled'), true).''; } else { @@ -76,16 +71,22 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals $row = []; $row['title'] = __('Name'); - $row['data'] = ''.$cellName.''; + $row['data'] = html_print_anchor( + [ + 'href' => $console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$module['id_agente'].'&tab=module&edit_module=1&id_agent_module='.$module['id_agente_modulo'].$url_hash, + 'content' => $cellName, + ], + true + ); $table->data['name'] = $row; - // Interval + // Interval. $row = []; $row['title'] = __('Interval'); $row['data'] = human_time_description_raw(modules_get_interval($module['id_agente_modulo']), true); $table->data['interval'] = $row; - // Warning Min/Max + // Warning Min/Max. if (modules_is_string_type($module['id_tipo_modulo'])) { $warning_status_str = __('Str.').': '.$module['str_warning']; } else { @@ -97,7 +98,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals $row['data'] = $warning_status_str; $table->data['warning_status'] = $row; - // Critical Min/Max + // Critical Min/Max. if (modules_is_string_type($module['id_tipo_modulo'])) { $critical_status_str = __('Str.').': '.$module['str_warning']; } else { @@ -109,7 +110,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals $row['data'] = $critical_status_str; $table->data['critical_status'] = $row; - // Module group + // Module group. $module_group = modules_get_modulegroup_name($module['id_module_group']); if ($module_group === false) { @@ -135,41 +136,33 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals ); $table->data['description'] = $row; - // Tags + // Tags. $tags = tags_get_module_tags($module['id_agente_modulo']); - if (empty($tags)) { - $tags = []; - } + if (empty($tags) === false) { + $user_tags = tags_get_user_tags($config['id_user']); - $user_tags = tags_get_user_tags($config['id_user']); - - foreach ($tags as $k => $v) { - if (!array_key_exists($v, $user_tags)) { - // only show user's tags. - unset($tags[$k]); - } else { - $tag_name = tags_get_name($v); - if (empty($tag_name)) { + foreach ($tags as $k => $v) { + if (!array_key_exists($v, $user_tags)) { + // Only show user's tags. unset($tags[$k]); } else { - $tags[$k] = $tag_name; + $tag_name = tags_get_name($v); + if (empty($tag_name) === true) { + unset($tags[$k]); + } else { + $tags[$k] = $tag_name; + } } } } - if (empty($tags)) { - $tags = ''.__('N/A').''; - } else { - $tags = implode(', ', $tags); - } - $row = []; $row['title'] = __('Tags'); - $row['data'] = $tags; + $row['data'] = (empty($tags) === true) ? ''.__('N/A').'' : implode(', ', $tags); $table->data['tags'] = $row; - // Data + // Data. $last_data = db_get_row_filter('tagente_estado', ['id_agente_modulo' => $module['id_agente_modulo'], 'order' => ['field' => 'id_agente_estado', 'order' => 'DESC']]); if ($config['render_proc']) { switch ($module['id_tipo_modulo']) { @@ -229,9 +222,9 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals switch ($module['id_tipo_modulo']) { case 15: $value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']); - if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') { + if ($value === '.1.3.6.1.2.1.1.3.0' || $value === '.1.3.6.1.2.1.25.1.1.0') { $data = "".human_milliseconds_to_string($last_data['datos']).''; - } else if (is_numeric($last_data['datos'])) { + } else if (is_numeric($last_data['datos']) === true) { $data = "".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).''; } else { $data = ui_print_truncate_text( @@ -264,13 +257,13 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals } } - if (!empty($last_data['utimestamp'])) { + if (empty($last_data['utimestamp']) === false) { $last_data_str = $data; - if ($module['unit'] != '') { + if (empty($module['unit']) === false) { $data_macro = modules_get_unit_macro($last_data['datos'], $module['unit']); - if ($data_macro) { - if (is_numeric($data_macro)) { + if ($data_macro !== false) { + if (is_numeric($data_macro) === true) { $last_data_str = "".remove_right_zeros(number_format($data_macro, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).''; } else { $last_data_str = ui_print_truncate_text( @@ -285,12 +278,12 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals } } else { $last_data_str .= ' '; - $last_data_str .= '('.$module['unit'].')'; + $last_data_str .= '('.$module['unit'].')'; } } $last_data_str .= ' '; - $last_data_str .= html_print_image('images/clock2.png', true, ['title' => $last_data['timestamp'], 'width' => '18px', 'class' => 'invert_filter']); + $last_data_str .= html_print_image('images/clock.svg', true, ['title' => $last_data['timestamp'], 'style' => 'margin-top: 3px; width: 20px', 'class' => 'invert_filter']); $is_snapshot = is_snapshot_data($last_data['datos']); $is_large_image = is_text_to_black_string($last_data['datos']); @@ -328,14 +321,17 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals $row['data'] = $time_elapsed; $table->data['tags'] = $row; - // End of table + // Title. + echo ''.__('Module information').''; + // End of table. html_print_table($table); $id_group = agents_get_agent_group($module['id_agente']); $group_name = db_get_value('nombre', 'tgrupo', 'id_grupo', $id_group); $agent_name = db_get_value('nombre', 'tagente', 'id_agente', $module['id_agente']); - if ($user_access_node && check_acl($config['id_user'], $id_group, 'AW')) { + /* + if ($user_access_node && check_acl($config['id_user'], $id_group, 'AW')) { // Actions table echo ''; - } + }*/ // id_module and id_agent hidden echo '