Merge branch 'ent-7489-11802-iconos-desfasados-en-dashboard' into 'develop'

fixed error with name on agent module view

See merge request artica/pandorafms!4257
This commit is contained in:
Daniel Rodriguez 2021-08-10 12:20:39 +00:00
commit a936deb255
1 changed files with 27 additions and 17 deletions

View File

@ -315,9 +315,9 @@ class AgentModuleWidget extends Widget
function ($carry, $item) { function ($carry, $item) {
$d = explode('|', $item); $d = explode('|', $item);
if (isset($d[1]) === true) { if (isset($d[1]) === true) {
$carry[] = $d[1]; $carry[] = \io_safe_output($d[1]);
} else { } else {
$carry[] = $item; $carry[] = \io_safe_output($item);
} }
return $carry; return $carry;
@ -424,7 +424,7 @@ class AgentModuleWidget extends Widget
foreach ($allModules as $module_name) { foreach ($allModules as $module_name) {
$file_name = ui_print_truncate_text( $file_name = ui_print_truncate_text(
$module_name, \io_safe_output($module_name),
'module_small', 'module_small',
false, false,
true, true,
@ -466,7 +466,7 @@ class AgentModuleWidget extends Widget
} }
$file_name = \ui_print_truncate_text( $file_name = \ui_print_truncate_text(
$row['agent_alias'], \io_safe_output($row['agent_alias']),
'agent_small', 'agent_small',
false, false,
true, true,
@ -636,13 +636,13 @@ class AgentModuleWidget extends Widget
} }
// Extract info all modules selected. // Extract info all modules selected.
$target_modules = explode( $target_modules = $this->values['mModules'];
self::MODULE_SEPARATOR, if (is_metaconsole() === true) {
$this->values['mModules'] $target_modules = explode(
); self::MODULE_SEPARATOR,
if (is_metaconsole() === true $this->values['mModules']
&& $this->values['mShowCommonModules'] === '0' );
) {
$all_modules = $target_modules; $all_modules = $target_modules;
} else { } else {
$all_modules = Module::search( $all_modules = Module::search(
@ -661,7 +661,12 @@ class AgentModuleWidget extends Widget
if (is_object($item) === true) { if (is_object($item) === true) {
$carry[$item->name()] = null; $carry[$item->name()] = null;
} else { } else {
$carry[$item] = null; if ((is_metaconsole() === true
&& $this->values['mShowCommonModules'] !== '1')
|| is_metaconsole() === false
) {
$carry[$item] = null;
}
} }
return $carry; return $carry;
@ -699,9 +704,19 @@ class AgentModuleWidget extends Widget
if (is_metaconsole() === true if (is_metaconsole() === true
&& $this->values['mShowCommonModules'] === '1' && $this->values['mShowCommonModules'] === '1'
) { ) {
// MC should connect to nodes and retrieve information
// from targets.
$modules = $agent->searchModules( $modules = $agent->searchModules(
['id_agente_modulo' => $target_modules] ['id_agente_modulo' => $target_modules]
); );
foreach ($modules as $module) {
if ($module === null) {
$reduceAllModules[] = null;
} else {
$reduceAllModules[$module->name()] = null;
}
}
} else { } else {
$modules = $agent->searchModules( $modules = $agent->searchModules(
['nombre' => array_keys($reduceAllModules)] ['nombre' => array_keys($reduceAllModules)]
@ -714,10 +729,6 @@ class AgentModuleWidget extends Widget
continue; continue;
} }
if ((bool) is_metaconsole() === true) {
$reduceAllModules[$module->name()] = null;
}
$visualData[$agent_id]['modules'][$module->name()] = $module->getStatus()->estado(); $visualData[$agent_id]['modules'][$module->name()] = $module->getStatus()->estado();
} }
@ -729,7 +740,6 @@ class AgentModuleWidget extends Widget
} }
} }
ksort($reduceAllModules);
$allModules = array_keys($reduceAllModules); $allModules = array_keys($reduceAllModules);
if ($allModules === null) { if ($allModules === null) {
$allModules = []; $allModules = [];