Several changes for Wiz.App support

Former-commit-id: 7c86d2e601771686a69d3f1b846638a427a25d6e
This commit is contained in:
fbsanchez 2019-02-19 20:27:05 +01:00
parent ea70c0846c
commit fa3f548cdd
3 changed files with 74 additions and 2 deletions

View File

@ -292,8 +292,13 @@ class DiscoveryTaskList extends Wizard
$data[7] = ui_print_timestamp($task['utimestamp'], true);
if (check_acl($config['id_user'], $task['id_group'], 'PM')) {
// Check if is a H&D, Cloud or Application.
$data[8] = '<a href="'.ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd&mode=netscan&page=0&task='.$task['id_rt']
sprintf(
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&page=0&task=%d',
$this->getTargetWiz($task),
$task['id_rt']
)
).'">'.html_print_image(
'images/wrench_orange.png',
true
@ -348,4 +353,24 @@ class DiscoveryTaskList extends Wizard
}
/**
* Return target url sub-string to edit target task.
*
* @param array $task With all data.
*
* @return string
*/
public function getTargetWiz($task)
{
// TODO: Do not use description. Use recon_script ID instead.
switch ($task['description']) {
case 'Discovery.Application.VMware':
return 'wiz=app&mode=vmware';
default:
return 'wiz=hd&mode=netscan';
}
}
}

View File

@ -80,6 +80,52 @@ class Wizard
}
/**
* Setter for label
*
* @param string $str Label.
*
* @return void
*/
public function setLabel(string $str)
{
$this->label = $str;
}
/**
* Getter for label
*
* @return array Breadcrum.
*/
public function getLabel()
{
return $this->label;
}
/**
* Builder for breadcrum
*
* @param array $urls Array of urls to be stored in breadcrum.
*
* @return void
*/
public function prepareBreadcrum(array $urls)
{
$bc = [];
$i = 0;
foreach ($urls as $url) {
$bc[$i] = '<a href="'.$url['link'].'" class="text_color">';
$bc[$i] .= '<div class="arrow_box">'.$url['label'].'</div>';
$bc[$i++] .= '</a>';
}
$this->setBreadcrum($bc);
}
/**
* To be overwritten.
*

View File

@ -2101,7 +2101,7 @@ class ConsoleSupervisor
$message_conf_cron = __('DiscoveryConsoleTasks is not running properly');
if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
$message_conf_cron .= __('Discovery relies on a proper setup of cron, the time-based scheduling service');
$message_conf_cron .= ' '.__('Please, add the following line to your crontab file:');
$message_conf_cron .= '. '.__('Please, add the following line to your crontab file:');
$message_conf_cron .= '<pre>* * * * * &lt;user&gt; wget -q -O - --no-check-certificate ';
$message_conf_cron .= str_replace(
ENTERPRISE_DIR.'/meta/',
@ -2116,6 +2116,7 @@ class ConsoleSupervisor
if (isset($config['cron_last_run']) === true) {
$message_conf_cron .= __('Last execution').': ';
$message_conf_cron .= date('Y/m/d H:i:s', $config['cron_last_run']);
$message_conf_cron .= __('Please check process is no locked.');
}
$this->notify(