From 7aedc39f694969910bd4f647f89c06da7f2ea3ec Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 7 Jan 2021 13:48:57 +0100 Subject: [PATCH 1/3] Task list status --- .../wizards/DiscoveryTaskList.class.php | 110 +++++++++++------- 1 file changed, 67 insertions(+), 43 deletions(-) diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index a0a5fe549f..3c4f0fcb22 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -539,46 +539,9 @@ class DiscoveryTaskList extends HTML $data[4] = '-'; } - $can_be_reviewed = false; - if (empty($task['summary']) === false - && $task['summary'] == 'cancelled' - ) { - $data[5] = __('Cancelled').ui_print_help_tip( - __('Server has been restarted while executing this task, please retry.'), - true - ); - } else if ($task['review_mode'] == DISCOVERY_STANDARD) { - if ($task['status'] <= 0 - && empty($task['summary']) === false - ) { - $data[5] = __('Done'); - } else if ($task['utimestamp'] == 0 - && empty($task['summary']) - ) { - $data[5] = __('Not started'); - } else { - $data[5] = __('Pending'); - } - } else { - if ($task['status'] <= 0 - && empty($task['summary']) === false - ) { - $can_be_reviewed = true; - $data[5] = ''; - $data[5] .= __('Review'); - $data[5] .= ''; - } else if ($task['utimestamp'] == 0 - && empty($task['summary']) - ) { - $data[5] = __('Not started'); - } else { - if ($task['review_mode'] == DISCOVERY_RESULTS) { - $data[5] = __('Processing'); - } else { - $data[5] = __('Searching'); - } - } - } + $_rs = $this->getStatusMessage($task); + $can_be_reviewed = $_rs['can_be_reviewed']; + $data[5] = $_rs['message']; switch ($task['type']) { case DISCOVERY_CLOUD_AZURE_COMPUTE: @@ -954,7 +917,7 @@ class DiscoveryTaskList extends HTML */ private function progressTaskGraph($task) { - $result .= '
'; + $result = '
'; $result .= '
'; $result .= ''._('Overall Progress').''; @@ -1546,9 +1509,9 @@ class DiscoveryTaskList extends HTML ); if (empty($summary)) { - $out .= __('No changes. Re-Scheduled'); + $out = __('No changes. Re-Scheduled'); } else { - $out .= __('Scheduled for creation'); + $out = __('Scheduled for creation'); $out .= '
    '; $out .= join('', $summary); $out .= '
'; @@ -1560,4 +1523,65 @@ class DiscoveryTaskList extends HTML } + /** + * Generates task status string for given task. + * + * @param array $task Discovery task (retrieved from DB). + * + * @return array Message to be displayed and review status. + */ + public function getStatusMessage(array $task) + { + $status = ''; + $can_be_reviewed = false; + + if (empty($task['summary']) === false + && $task['summary'] == 'cancelled' + ) { + $status = __('Cancelled').ui_print_help_tip( + __('Server has been restarted while executing this task, please retry.'), + true + ); + } else if ($task['review_mode'] == DISCOVERY_STANDARD) { + if ($task['status'] <= 0 + && empty($task['summary']) === false + ) { + $status = __('Done'); + } else if ($task['utimestamp'] == 0 + && empty($task['summary']) + ) { + $status = __('Not started'); + } else if ($task['utimestamp'] > 0) { + $status = __('Done'); + } else { + $status = __('Pending'); + } + } else { + if ($task['status'] <= 0 + && empty($task['summary']) === false + ) { + $can_be_reviewed = true; + $status = ''; + $status .= __('Review'); + $status .= ''; + } else if ($task['utimestamp'] == 0 + && empty($task['summary']) + ) { + $status = __('Not started'); + } else { + if ($task['review_mode'] == DISCOVERY_RESULTS) { + $status = __('Processing'); + } else { + $status = __('Searching'); + } + } + } + + return [ + 'message' => $status, + 'can_be_reviewed' => $can_be_reviewed, + ]; + } + + } From de716ddc4a554b9065dbc77769b84d1a1c95548b Mon Sep 17 00:00:00 2001 From: marcos Date: Fri, 12 Mar 2021 11:55:54 +0100 Subject: [PATCH 2/3] fixed visual error group view --- pandora_console/include/styles/pandora.css | 2 +- pandora_console/operation/agentes/group_view.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 935520bc78..63d64c6342 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -1775,7 +1775,7 @@ table.databox { padding: 9px 7px; font-weight: normal; color: #fff; - text-align: justify; + text-align: center; } .databox > th * { diff --git a/pandora_console/operation/agentes/group_view.php b/pandora_console/operation/agentes/group_view.php index befd7439fb..54ba514851 100644 --- a/pandora_console/operation/agentes/group_view.php +++ b/pandora_console/operation/agentes/group_view.php @@ -319,7 +319,7 @@ if (!empty($result_groups)) { $link = ""; } else { - $link = ""; } @@ -336,7 +336,7 @@ if (!empty($result_groups)) { // Agents not init echo ""; if (isset($data['_is_tag_'])) { - $link = ""; } else { $link = ""; } else { - $link = ""; } From ac3587208b116e8af97df9406f4e65a973c1420d Mon Sep 17 00:00:00 2001 From: marcos Date: Fri, 12 Mar 2021 12:10:56 +0100 Subject: [PATCH 3/3] fixed visual error --- pandora_console/operation/agentes/group_view.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/operation/agentes/group_view.php b/pandora_console/operation/agentes/group_view.php index 54ba514851..61dfda1a22 100644 --- a/pandora_console/operation/agentes/group_view.php +++ b/pandora_console/operation/agentes/group_view.php @@ -190,7 +190,7 @@ if (!empty($result_groups)) { echo ''; echo "".__('Force').''; - echo "".__('Group').'/'.__('Tags').''; + echo "".__('Group').'/'.__('Tags').''; echo "".__('Total').''; echo "".__('Unknown').''; echo "".__('Not init').'';