From 52134623347ae0693bc2f889ab4038c36ffb40ab Mon Sep 17 00:00:00 2001 From: Jorge Rincon Date: Fri, 24 Nov 2023 12:54:19 +0100 Subject: [PATCH] #12067 Aggregated Agents Modules and module group --- pandora_console/extensions/agents_modules.php | 2 +- pandora_console/extensions/module_groups.php | 1 + pandora_console/index.php | 72 ++++++++++++++++++- 3 files changed, 71 insertions(+), 4 deletions(-) diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index d6c4f3bb32..588d64f3d7 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -880,7 +880,7 @@ function mainAgentsModules() return; } - echo ''; + echo '
'; echo ''; diff --git a/pandora_console/extensions/module_groups.php b/pandora_console/extensions/module_groups.php index f1cb6b91c5..957d3a17a1 100644 --- a/pandora_console/extensions/module_groups.php +++ b/pandora_console/extensions/module_groups.php @@ -345,6 +345,7 @@ function mainModuleGroups() $table = new StdClass(); $table->class = 'info_table'; $table->style[0] = 'font-weight: bolder; min-width: 230px;'; + $table->id = 'agent_group_module_group'; $table->width = '100%'; $head[0] = __('Groups'); diff --git a/pandora_console/index.php b/pandora_console/index.php index 95641b313f..35b907cbec 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -1672,8 +1672,8 @@ require 'include/php_to_js_values.php'; let counter = 0; $("#keywords").on("click", function(e) { counter++; - let falEasternEgg = true; - if (counter == 5 && falEasternEgg == true) { + let flagEasternEgg = $("#flagEasternEgg").val(); + if (counter == 5 && flagEasternEgg == true) { easterEggThinkGreen(); } }); @@ -1772,7 +1772,6 @@ require 'include/php_to_js_values.php'; $('#summary_status_groups_detail > tbody > tr > td').each(function(index, fila) { var hasClassRed = $(fila).hasClass('group_view_crit'); - console.log(hasClassRed); if (hasClassRed) { $(fila).removeClass('group_view_crit').addClass('group_view_ok'); $(fila).children('a').removeClass('group_view_crit').addClass('group_view_ok'); @@ -1798,6 +1797,73 @@ require 'include/php_to_js_values.php'; } }); + // Agents Modules. + $('#agents_modules_table > tbody > tr > td').each(function(index, fila) { + // Change status. + var hasClassRed = $(fila).hasClass('group_view_crit'); + var hasClassGrey = $(fila).hasClass('group_view_unk'); + if (hasClassRed == true) { + $(fila).removeClass('group_view_crit').addClass('group_view_ok'); + $(fila).children('a').removeClass('group_view_crit').addClass('group_view_ok'); + } else if (hasClassRed == false) { + var hasClassGroupRed = $(fila).children('a').children('div').attr('style'); + if (hasClassGroupRed !== undefined) { + let findedRed = hasClassGroupRed.indexOf('background: #e63c52'); + if (findedRed >= 0) { + elementChange.hasClassRed = true; + elementChange.hasClassGrey = false; + elementChange.elementID = $(fila).children('a').children('div'); + elementChange.class = false; + setClassGreen(elementChange); + } + } + } + + if (hasClassGrey == true) { + $(fila).removeClass('group_view_unk').addClass('group_view_ok'); + $(fila).children('a').removeClass('group_view_unk').addClass('group_view_ok'); + } else if (hasClassGrey == false) { + var hasClassGroupGrey = $(fila).children('a').children('div').attr('style'); + if (hasClassGroupGrey !== undefined) { + let findedGrey = hasClassGroupGrey.indexOf('background: #B2B2B2'); + if (findedGrey >= 0) { + elementChange.hasClassRed = false; + elementChange.hasClassGrey = true; + elementChange.elementID = $(fila).children('a').children('div'); + elementChange.class = false; + setClassGreen(elementChange); + } + } + } + }); + + // Combined table of agent group and module group. + $('#agent_group_module_group > tbody > tr > td').each(function(index, fila) { + var hasClassGroupRed = $(fila).children('div').attr('style'); + if (hasClassGroupRed !== undefined) { + let findedRed = hasClassGroupRed.indexOf(' background:#e63c52;'); + if (findedRed >= 0) { + elementChange.hasClassRed = true; + elementChange.hasClassGrey = false; + elementChange.elementID = $(fila).children('div'); + elementChange.class = false; + setClassGreen(elementChange); + } + } + + var hasClassGroupGrey = $(fila).children('div').attr('style'); + if (hasClassGroupGrey !== undefined) { + let findedGrey = hasClassGroupGrey.indexOf(' background:#B2B2B2;'); + if (findedGrey >= 0) { + elementChange.hasClassRed = false; + elementChange.hasClassGrey = true; + elementChange.elementID = $(fila).children('div'); + elementChange.class = false; + setClassGreen(elementChange); + } + } + }); + } function setClassGreen(element) {