fixed errors in custom fields view

This commit is contained in:
daniel 2018-11-16 11:58:49 +01:00
parent e6cd8c5471
commit 0a097d185d
4 changed files with 32 additions and 28 deletions

View File

@ -21,6 +21,7 @@ global $config;
include_once($config['homedir'] . "/include/functions_agents.php"); include_once($config['homedir'] . "/include/functions_agents.php");
include_once($config['homedir'] . "/include/functions_modules.php"); include_once($config['homedir'] . "/include/functions_modules.php");
include_once($config['homedir'] . "/include/functions_ui.php"); include_once($config['homedir'] . "/include/functions_ui.php");
include_once($config['homedir'] . '/include/functions_custom_fields.php');
enterprise_include_once ('include/functions_metaconsole.php'); enterprise_include_once ('include/functions_metaconsole.php');
$get_custom_fields_data = (bool) get_parameter('get_custom_fields_data', 0); $get_custom_fields_data = (bool) get_parameter('get_custom_fields_data', 0);
@ -260,6 +261,7 @@ if($build_table_child_custom_fields){
$query = sprintf("SELECT tam.nombre, $query = sprintf("SELECT tam.nombre,
tam.min_warning, tam.max_warning, tam.min_warning, tam.max_warning,
tam.min_critical, tam.max_critical, tam.min_critical, tam.max_critical,
tam.str_warning, tam.str_critical,
tae.estado, tae.current_interval, tae.estado, tae.current_interval,
tae.utimestamp, tae.datos tae.utimestamp, tae.datos
FROM tagente_modulo tam FROM tagente_modulo tam
@ -280,29 +282,30 @@ if($build_table_child_custom_fields){
$table_modules->head = array(); $table_modules->head = array();
$table_modules->head[0] = __('Module name'); $table_modules->head[0] = __('Module name');
$table_modules->head[1] = __('Data'); $table_modules->head[1] = __('Data');
$table_modules->head[2] = __('Min Warning'); $table_modules->head[2] = __('Treshold');
$table_modules->head[3] = __('Max Warning'); $table_modules->head[3] = __('Current interval');
$table_modules->head[4] = __('Min Critical'); $table_modules->head[4] = __('Timestamp');
$table_modules->head[5] = __('Max Critical'); $table_modules->head[5] = __('Status');
$table_modules->head[6] = __('Current interval');
$table_modules->head[7] = __('Timestamp');
$table_modules->head[8] = __('Status');
$table_modules->data = array(); $table_modules->data = array();
if(isset($modules) && is_array($modules)){ if(isset($modules) && is_array($modules)){
foreach ($modules as $key => $value) { foreach ($modules as $key => $value) {
$table_modules->data[$key][0] = $value['nombre']; $table_modules->data[$key][0] = $value['nombre'];
$table_modules->data[$key][1] = $value['datos']; $table_modules->data[$key][1] = $value['datos'];
$table_modules->data[$key][2] = $value['min_warning']; $table_modules->data[$key][2] = ui_print_module_warn_value (
$table_modules->data[$key][3] = $value['max_warning']; $value["max_warning"],
$table_modules->data[$key][4] = $value['min_critical']; $value["min_warning"],
$table_modules->data[$key][5] = $value['max_critical']; $value["str_warning"],
$table_modules->data[$key][6] = $value['current_interval']; $value["max_critical"],
$table_modules->data[$key][7] = date('d/m/Y h:i:s', $value['utimestamp']); $value["min_critical"],
$value["str_critical"]
);
$table_modules->data[$key][3] = $value['current_interval'];
$table_modules->data[$key][4] = ui_print_timestamp($value['utimestamp'], true);
switch ($value['estado']) { switch ($value['estado']) {
case 0: case 0:
case 300: case 300:
$table_modules->data[$key][8] = html_print_image( $table_modules->data[$key][5] = html_print_image(
'images/status_sets/default/severity_normal.png', 'images/status_sets/default/severity_normal.png',
true, true,
array( array(
@ -312,7 +315,7 @@ if($build_table_child_custom_fields){
break; break;
case 1: case 1:
case 100: case 100:
$table_modules->data[$key][8] = html_print_image( $table_modules->data[$key][5] = html_print_image(
'images/status_sets/default/severity_critical.png', 'images/status_sets/default/severity_critical.png',
true, true,
array( array(
@ -322,7 +325,7 @@ if($build_table_child_custom_fields){
break; break;
case 2: case 2:
case 200: case 200:
$table_modules->data[$key][8] = html_print_image( $table_modules->data[$key][5] = html_print_image(
'images/status_sets/default/severity_warning.png', 'images/status_sets/default/severity_warning.png',
true, true,
array( array(
@ -331,7 +334,7 @@ if($build_table_child_custom_fields){
); );
break; break;
case 3: case 3:
$table_modules->data[$key][8] = html_print_image( $table_modules->data[$key][5] = html_print_image(
'images/status_sets/default/severity_maintenance.png', 'images/status_sets/default/severity_maintenance.png',
true, true,
array( array(
@ -341,7 +344,7 @@ if($build_table_child_custom_fields){
break; break;
case 4: case 4:
case 5: case 5:
$table_modules->data[$key][8] = html_print_image( $table_modules->data[$key][5] = html_print_image(
'images/status_sets/default/severity_informational.png', 'images/status_sets/default/severity_informational.png',
true, true,
array( array(
@ -350,7 +353,7 @@ if($build_table_child_custom_fields){
); );
break; break;
default: default:
$table_modules->data[$key][8] = html_print_image( $table_modules->data[$key][5] = html_print_image(
'images/status_sets/default/severity_normal.png', 'images/status_sets/default/severity_normal.png',
true, true,
array( array(

View File

@ -194,7 +194,7 @@ function io_html_to_ascii($hex) {
* *
* @return void * @return void
*/ */
function io_safe_output_array(&$item, $key, $utf8 = true) { function io_safe_output_array(&$item, $key=false, $utf8=true) {
$item = io_safe_output($item, $utf8); $item = io_safe_output($item, $utf8);
} }

View File

@ -1124,7 +1124,7 @@ var // currently active contextMenu trigger
// reset and apply changes in the end because nested // reset and apply changes in the end because nested
// elements' widths wouldn't be calculatable otherwise // elements' widths wouldn't be calculatable otherwise
if (!nested) { if (!nested) {
$menu.find('ul').andSelf().css({ $menu.find('ul').addBack().css({
position: '', position: '',
display: '', display: '',
minWidth: '', minWidth: '',

View File

@ -459,11 +459,12 @@ switch ($tab) {
} }
$open_maps_to_migrate = array(); $open_maps_to_migrate = array();
foreach ($old_networkmaps_open as $old_map_open) { if(isset($old_networkmaps_open) && is_array($old_networkmaps_open)){
$text_filter = $old_map_open['text_filter']; foreach ($old_networkmaps_open as $old_map_open) {
$text_filter = $old_map_open['text_filter'];
if ($text_filter != "migrated") { if ($text_filter != "migrated") {
$open_maps_to_migrate[] = $old_map_open['id_networkmap']; $open_maps_to_migrate[] = $old_map_open['id_networkmap'];
}
} }
} }