From ae3c9bc2f52fbe496a5c2ebf98fe0904f49af7ed Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Thu, 18 Jan 2024 10:28:57 +0100 Subject: [PATCH] #12754 Fixed status --- pandora_console/include/ajax/module.php | 29 ++++++++++++++----- .../lib/Dashboard/Widgets/ModulesByStatus.php | 14 ++++++++- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index bddf72a217..2a9580a000 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -1900,12 +1900,24 @@ if (check_login()) { unset($expl[$exist]); } - array_push($expl, '1', '2'); + array_push($expl, '1', '2', '3', '4', '5'); $status = implode(',', $expl); } - if (empty($status) === false) { + if (str_contains($status, '5') === true) { + $expl = explode(',', $status); + $exist = array_search('5', $expl); + if (isset($exist) === true) { + unset($expl[$exist]); + } + + array_push($expl, '4', '5'); + + $status = implode(',', $expl); + } + + if (empty($status) === false || $status === '0') { $where .= sprintf( ' AND tagente_estado.estado IN (%s) AND tagente_modulo.delete_pending = 0', @@ -2148,24 +2160,25 @@ if (check_login()) { ); switch ((int) $row['estado']) { - case 0: + case AGENT_MODULE_STATUS_NORMAL: $status_img = ui_print_status_image(STATUS_MODULE_OK, __('Normal'), true); break; - case 1: - case 6: + case AGENT_MODULE_STATUS_CRITICAL_BAD: + case AGENT_MODULE_STATUS_NOT_NORMAL: $status_img = ui_print_status_image(STATUS_MODULE_CRITICAL, __('Critical'), true); break; - case 2: + case AGENT_MODULE_STATUS_WARNING: $status_img = ui_print_status_image(STATUS_MODULE_WARNING, __('Warning'), true); break; - case 3: + case AGENT_MODULE_STATUS_UNKNOWN: $status_img = ui_print_status_image(STATUS_MODULE_UNKNOWN, __('Unknown'), true); break; - case 5: + case AGENT_MODULE_STATUS_NO_DATA: + case AGENT_MODULE_STATUS_NOT_INIT: $status_img = ui_print_status_image(STATUS_MODULE_NO_DATA, __('Not init'), true); break; diff --git a/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php b/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php index e490135734..866c14494a 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php +++ b/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php @@ -523,7 +523,19 @@ class ModulesByStatus extends Widget unset($expl[$exist]); } - array_push($expl, '1', '2'); + array_push($expl, '1', '2', '3', '4', '5'); + + $status = implode(',', $expl); + } + + if (str_contains($status, '5') === true) { + $expl = explode(',', $status); + $exist = array_search('5', $expl); + if (isset($exist) === true) { + unset($expl[$exist]); + } + + array_push($expl, '4', '5'); $status = implode(',', $expl); }