From 65046caad4edc6bbfeceaedefef425c048693e5c Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Mon, 24 Apr 2023 15:28:54 +0200 Subject: [PATCH] #9771 added summary for extensions task --- .../wizards/DiscoveryTaskList.class.php | 64 +++++++++++++++---- 1 file changed, 52 insertions(+), 12 deletions(-) diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index c60f63e5d2..0a040c4fa5 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -968,18 +968,16 @@ class DiscoveryTaskList extends HTML $data[9] .= ''; } - if ((int) $task['type'] !== DISCOVERY_EXTENSION) { - $data[9] .= ''; - $data[9] .= html_print_image( - 'images/details.svg', - true, - [ - 'title' => __('View summary'), - 'class' => 'main_menu_icon invert_filter', - ] - ); - $data[9] .= ''; - } + $data[9] .= ''; + $data[9] .= html_print_image( + 'images/details.svg', + true, + [ + 'title' => __('View summary'), + 'class' => 'main_menu_icon invert_filter', + ] + ); + $data[9] .= ''; } if ($task['disabled'] != 2 && $task['utimestamp'] > 0 @@ -1462,6 +1460,48 @@ class DiscoveryTaskList extends HTML $table->data[$i][1] = ''; $table->data[$i][1] .= ($total - $agents); $table->data[$i++][1] .= ''; + } else if ((int) $task['type'] === DISCOVERY_EXTENSION) { + // Content. + if (is_array($task['stats']) === true) { + $countSummary = 1; + foreach ($task['stats'] as $key => $summary) { + $table->data[$i][0] = ''.__('Summary').' '.$countSummary.''; + $table->data[$i][1] = ''; + $i++; + if (is_array($summary) === true) { + foreach ($summary as $k2 => $v) { + if (is_array($v) === true) { + if ($k2 === 'summary') { + $countSummary++; + foreach ($v as $k3 => $v2) { + $table->data[$i][0] = $k3; + $table->data[$i][1] = $v2; + $i++; + } + } else { + $table->data[$i][0] = json_encode([$k2 => $v]); + $table->data[$i][1] = ''; + $i++; + } + } else { + if ($k2 === 'info') { + $table->data[$i][0] = ''.$v.''; + $table->data[$i][1] = ''; + $i++; + } else { + $table->data[$i][0] = json_encode([$k2 => $v]); + $table->data[$i][1] = ''; + $i++; + } + } + } + } else { + $table->data[$i][0] = $summary; + $table->data[$i][1] = ''; + $i++; + } + } + } } else { // Content. if (is_array($task['stats']['summary']) === true) {