Merge remote-tracking branch 'origin/ent-3431-discovery-host-devices' into ent-3394-discovery-applications

Former-commit-id: 2d10f49e4eb2078eebd2f6164866fe2a8412d6a3
This commit is contained in:
fbsanchez 2019-02-20 14:38:14 +01:00
commit 414ff282e2
3 changed files with 60 additions and 6 deletions

View File

@ -672,6 +672,14 @@ class HostDevices extends Wizard
'action' => $this->url.'&mode=netscan&page='.($this->page + 1).$task_url,
];
// Default.
$interval = 600;
$unit = 60;
if (isset($this->task['interval_sweep']) === true) {
$interval = $this->task['interval_sweep'];
$unit = $this->getTimeUnit($interval);
}
$form['js'] = '
$("select#interval_manual_defined").change(function() {
if ($("#interval_manual_defined").val() == 1) {
@ -682,8 +690,8 @@ $("select#interval_manual_defined").change(function() {
else {
$("#interval_manual_container").show();
$("#text-interval_text").val(10);
$("#hidden-interval").val(600);
$("#interval_units").val(60);
$("#hidden-interval").val('.$interval.');
$("#interval_units").val('.$unit.');
}
}).change();';

View File

@ -104,6 +104,40 @@ class Wizard
}
/**
* Return units associated to target interval (in seconds).
*
* @param integer $interval Target interval.
*
* @return integer Unit.
*/
public function getTimeUnit($interval)
{
$units = [
1,
60,
3600,
86400,
604800,
2592000,
31104000,
];
$size = count($units);
for ($i = 0; $i < $size; $i++) {
if ($interval < $units[$i]) {
if (($i - 1) < 0) {
return 1;
}
return $units[($i - 1)];
}
}
return $units[-1];
}
/**
* Builder for breadcrum
*
@ -116,9 +150,15 @@ class Wizard
$bc = [];
$i = 0;
foreach ($urls as $url) {
if ($url['selected'] == 1) {
$class = 'selected';
} else {
$class = '';
}
$bc[$i] = '<a href="'.$url['link'].'" class="text_color">';
$bc[$i] .= '<div class="arrow_box">'.$url['label'].'</div>';
$bc[$i++] .= '</a>';
$bc[$i] .= '<div class="arrow_box '.$class.'">'.$url['label'];
$bc[$i++] .= '</div></a>';
}
$this->setBreadcrum($bc);

View File

@ -60,7 +60,7 @@ div.data_container:hover {
.arrow_box {
display: inline-block;
position: relative;
background: #82b92e;
background: #ccc;
padding: 14px;
margin-left: 20px;
margin-bottom: 10px;
@ -75,6 +75,9 @@ div.data_container:hover {
position: absolute;
pointer-events: none;
}
.arrow_box.selected {
background: #82b92e;
}
.arrow_box:after {
left: 0%;
@ -84,7 +87,10 @@ div.data_container:hover {
}
.arrow_box:before {
left: 100%;
border-left-color: #82b92e;
border-left-color: #ccc;
border-width: 20px;
margin-top: -20px;
}
.arrow_box.selected:before {
border-left-color: #82b92e;
}