Merge remote-tracking branch 'origin/develop' into ent-7074-Command-Center

This commit is contained in:
Daniel Barbero Martin 2021-03-17 17:28:52 +01:00
commit edb2dfb2fc
3 changed files with 69 additions and 56 deletions

View File

@ -667,57 +667,9 @@ class DiscoveryTaskList extends HTML
$data[4] = '-'; $data[4] = '-';
} }
$can_be_reviewed = false; $_rs = $this->getStatusMessage($task);
if (empty($task['summary']) === false $can_be_reviewed = $_rs['can_be_reviewed'];
&& $task['summary'] == 'cancelled' $data[5] = $_rs['message'];
) {
$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['type'] == DISCOVERY_APP_VMWARE) {
if ($task['status'] <= 0 && $task['utimestamp'] != 0) {
$data[5] = __('Done');
} else if ($task['status'] > 0) {
$data[5] = __('Pending');
} else {
$data[5] = __('Not started');
}
} else {
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
&& (int) $task['type'] === DISCOVERY_HOSTDEVICES
) {
$can_be_reviewed = true;
$data[5] = '<span class="link review" onclick="show_review('.$task['id_rt'].',\''.$task['name'].'\')">';
$data[5] .= __('Review');
$data[5] .= '</span>';
} 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');
}
}
}
switch ($task['type']) { switch ($task['type']) {
case DISCOVERY_CLOUD_AZURE_COMPUTE: case DISCOVERY_CLOUD_AZURE_COMPUTE:
@ -1763,4 +1715,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 = '<span class="link review" onclick="show_review('.$task['id_rt'].',\''.$task['name'].'\')">';
$status .= __('Review');
$status .= '</span>';
} 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,
];
}
} }

View File

@ -1775,7 +1775,7 @@ table.databox {
padding: 9px 7px; padding: 9px 7px;
font-weight: normal; font-weight: normal;
color: #fff; color: #fff;
text-align: justify; text-align: center;
} }
.databox > th * { .databox > th * {

View File

@ -190,7 +190,7 @@ if (!empty($result_groups)) {
echo '<tr>'; echo '<tr>';
echo "<th class='w26px'>".__('Force').'</th>'; echo "<th class='w26px'>".__('Force').'</th>';
echo "<th width='30%' class='mw60px'>".__('Group').'/'.__('Tags').'</th>'; echo "<th width='30%' class='mw60px' style='text-align: justify'>".__('Group').'/'.__('Tags').'</th>';
echo "<th width='10%' class='mw60px center'>".__('Total').'</th>'; echo "<th width='10%' class='mw60px center'>".__('Total').'</th>';
echo "<th width='10%' class='mw60px center'>".__('Unknown').'</th>'; echo "<th width='10%' class='mw60px center'>".__('Unknown').'</th>';
echo "<th width='10%' class='mw60px center'>".__('Not init').'</th>'; echo "<th width='10%' class='mw60px center'>".__('Not init').'</th>';
@ -319,7 +319,7 @@ if (!empty($result_groups)) {
$link = "<a class='group_view_data $color_class bolder font_18px center' $link = "<a class='group_view_data $color_class bolder font_18px center'
href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_'].'&status='.AGENT_STATUS_UNKNOWN."'>"; href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_'].'&status='.AGENT_STATUS_UNKNOWN."'>";
} else { } else {
$link = "<a class='group_view_data $color_class bolder font_18x center' $link = "<a class='group_view_data $color_class bolder font_18px center'
href='index.php?sec=view&sec2=operation/agentes/estado_agente&group_id=".$data['_id_'].'&status='.AGENT_STATUS_UNKNOWN."'>"; href='index.php?sec=view&sec2=operation/agentes/estado_agente&group_id=".$data['_id_'].'&status='.AGENT_STATUS_UNKNOWN."'>";
} }
@ -336,7 +336,7 @@ if (!empty($result_groups)) {
// Agents not init // Agents not init
echo "<td class='group_view_data group_view_data_unk $color_class bolder font_18px center'>"; echo "<td class='group_view_data group_view_data_unk $color_class bolder font_18px center'>";
if (isset($data['_is_tag_'])) { if (isset($data['_is_tag_'])) {
$link = "<a class='group_view_data $color_class bolder ont_18px center' $link = "<a class='group_view_data $color_class bolder font_18px center'
href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_'].'&status='.AGENT_STATUS_NOT_INIT."'>"; href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_'].'&status='.AGENT_STATUS_NOT_INIT."'>";
} else { } else {
$link = "<a class='group_view_data $color_class bolder font_18px center' $link = "<a class='group_view_data $color_class bolder font_18px center'
@ -359,7 +359,7 @@ if (!empty($result_groups)) {
$link = "<a class='group_view_data $color_class bolder font_18px center' $link = "<a class='group_view_data $color_class bolder font_18px center'
href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_'].'&status='.AGENT_STATUS_NORMAL."'>"; href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_'].'&status='.AGENT_STATUS_NORMAL."'>";
} else { } else {
$link = "<a class='group_view_data $color_class bolder ont_18px center' $link = "<a class='group_view_data $color_class bolder font_18px center'
href='index.php?sec=view&sec2=operation/agentes/estado_agente&group_id=".$data['_id_'].'&status='.AGENT_STATUS_NORMAL."'>"; href='index.php?sec=view&sec2=operation/agentes/estado_agente&group_id=".$data['_id_'].'&status='.AGENT_STATUS_NORMAL."'>";
} }