discovery task status overview

Former-commit-id: 329d03c109b9e09788302212752f372647b19c56
This commit is contained in:
fbsanchez 2019-03-25 19:58:01 +01:00
parent 1238f15190
commit 6cc6f6f125
2 changed files with 99 additions and 33 deletions

View File

@ -34,30 +34,63 @@ $showmap = (bool) get_parameter('showmap', 0);
if ($progress_task_discovery) {
$id_task = get_parameter('id', 0);
if ($id_task !== 0) {
$result = '';
$result .= '<ul class="progress_task_discovery">';
$result .= '<li><h1>'._('Overall Progress').'</h1></li>';
$result .= '<li>';
$result .= d3_progress_bar(
$id_task,
90,
460,
30,
'#EA5434',
'%',
'',
'#FFFFFF',
0,
0
);
if ($id_task <= 0) {
echo json_encode(['error' => true]);
return;
}
$task = db_get_row('trecon_task', 'id_rt', $id_task);
$global_progress = $task['status'];
$summary = json_decode($task['summary'], true);
$result = '';
$result .= '<ul class="progress_task_discovery">';
$result .= '<li><h1>'._('Overall Progress').'</h1></li>';
$result .= '<li>';
$result .= d3_progress_bar(
$id_task,
($global_progress < 0) ? 100 : $global_progress,
460,
30,
'#EA5434',
'%',
'',
'#FFFFFF',
0,
0
);
if ($global_progress > 0) {
switch ($summary['step']) {
case STEP_SCANNING:
$str = __('Scanning the network');
break;
case STEP_AFT:
$str = __('Finding AFT connectivity');
break;
case STEP_TRACEROUTE:
$str = __('Finding traceroute connectivity');
break;
case STEP_GATEWAY:
$str = __('Finding gateway connectivity');
break;
default:
$str = __('Searching for devices...');
break;
}
$result .= '</li>';
$result .= '<li><h1>'.__('Searching devices in').' red a scanear</h1></li>';
$result .= '<li><h1>'.$str.' ';
$result .= $summary['c_network_name'];
$result .= '</h1></li>';
$result .= '<li>';
$result .= d3_progress_bar(
$id_task.'_2',
30,
$id_task.'_detail',
$summary['c_network_percent'],
460,
30,
'#2751E1',
@ -67,22 +100,49 @@ if ($progress_task_discovery) {
0,
0
);
$result .= '</li>';
$result .= '<li><h1>'.__('Summary').'</h1></li>';
$result .= '<li><span><b>'.__('Estimated').'</b>: total de host</span></li>';
$result .= '<li><span><b>'.__('Discovered').'</b>: total de agentes</span></li>';
$result .= '<li><span><b>'.__('Not alive/Not found').'</b>: total de agentes 1-2</span></li>';
$result .= '</ul>';
echo $result;
} else {
// Error.
ui_print_error_message(
__('Please, select task')
);
}
$result .= '</ul>';
$i = 0;
$table = new StdClasS();
$table->class = 'databox data';
$table->width = '75%';
$table->styleTable = 'margin: 2em auto;border: 1px solid #ddd;background: white;';
$table->rowid = [];
$table->data = [];
// Content.
$table->data[$i][0] = '<b>'.__('Hosts discovered').'</b>';
$table->data[$i][1] = '<span id="discovered">';
$table->data[$i][1] .= $summary['summary']['discovered'];
$table->data[$i++][1] .= '</span>';
$table->data[$i][0] = '<b>'.__('Alive').'</b>';
$table->data[$i][1] = '<span id="alive">';
$table->data[$i][1] .= $summary['summary']['alive'];
$table->data[$i++][1] .= '</span>';
$table->data[$i][0] = '<b>'.__('Not alive').'</b>';
$table->data[$i][1] = '<span id="not_alive">';
$table->data[$i][1] .= $summary['summary']['not_alive'];
$table->data[$i++][1] .= '</span>';
$table->data[$i][0] = '<b>'.__('Responding SNMP').'</b>';
$table->data[$i][1] = '<span id="SNMP">';
$table->data[$i][1] .= $summary['summary']['SNMP'];
$table->data[$i++][1] .= '</span>';
$table->data[$i][0] = '<b>'.__('Responding WMI').'</b>';
$table->data[$i][1] = '<span id="WMI">';
$table->data[$i][1] .= $summary['summary']['WMI'];
$table->data[$i++][1] .= '</span>';
$result .= html_print_table($table, true);
echo $result;
return;
}

View File

@ -514,6 +514,12 @@ define('OPTION_COLOR_PICKER', 11);
define('NODE_TYPE', 0);
define('ARROW_TYPE', 1);
// Discovery task steps.
define('STEP_SCANNING', 1);
define('STEP_AFT', 2);
define('STEP_TRACEROUTE', 3);
define('STEP_GATEWAY', 4);
// Networkmap node types.
define('NODE_AGENT', 0);
define('NODE_MODULE', 1);