Merge branch 'ent-3595-discovery-fase-2' of https://brutus.artica.lan:8081/artica/pandorafms into ent-3595-discovery-fase-2
Former-commit-id: a9ac8888641116a4e98fbe7ac2d99901e771f275
This commit is contained in:
commit
0d8322aeda
|
@ -433,7 +433,7 @@ class DiscoveryTaskList extends Wizard
|
|||
// Name task.
|
||||
$data[1] = '';
|
||||
if ($task['disabled'] != 2) {
|
||||
$data[1] .= '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\',\''.$url_ajax.'\')">';
|
||||
$data[1] .= '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
|
||||
}
|
||||
|
||||
$data[1] .= '<b>'.$task['name'].'</b>';
|
||||
|
@ -504,7 +504,7 @@ class DiscoveryTaskList extends Wizard
|
|||
}
|
||||
|
||||
if ($task['disabled'] != 2) {
|
||||
$data[9] = '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\',\''.$url_ajax.'\')">';
|
||||
$data[9] = '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
|
||||
$data[9] .= html_print_image(
|
||||
'images/eye.png',
|
||||
true
|
||||
|
@ -513,7 +513,7 @@ class DiscoveryTaskList extends Wizard
|
|||
}
|
||||
|
||||
if ($task['disabled'] != 2 && $task['utimestamp'] > 0) {
|
||||
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\',\''.$url_ajax.'\')">';
|
||||
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
|
||||
$data[9] .= html_print_image(
|
||||
'images/dynamic_network_icon.png',
|
||||
true
|
||||
|
@ -566,6 +566,9 @@ class DiscoveryTaskList extends Wizard
|
|||
$data[9] = '';
|
||||
}
|
||||
|
||||
// Div neccesary for modal progress task.
|
||||
echo '<div id="progress_task_'.$task['id_rt'].'" style="display:none"></div>';
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
|
@ -577,8 +580,8 @@ class DiscoveryTaskList extends Wizard
|
|||
html_print_table($table);
|
||||
}
|
||||
|
||||
// Div neccesary for modal progress task.
|
||||
echo '<div id="progress_task" style="display:none"></div>';
|
||||
// Div neccesary for modal map task.
|
||||
echo '<div id="map_task" style="display:none"></div>';
|
||||
|
||||
unset($table);
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ if ($progress_task_discovery) {
|
|||
$global_progress = $task['status'];
|
||||
$summary = json_decode($task['summary'], true);
|
||||
|
||||
$result = '';
|
||||
$result = '<div id = progress_task_'.$id_task.'>';
|
||||
$result .= '<ul class="progress_task_discovery">';
|
||||
$result .= '<li><h1>'._('Overall Progress').'</h1></li>';
|
||||
$result .= '<li>';
|
||||
|
@ -57,6 +57,7 @@ if ($progress_task_discovery) {
|
|||
'',
|
||||
'#FFFFFF',
|
||||
0,
|
||||
0,
|
||||
0
|
||||
);
|
||||
|
||||
|
@ -98,6 +99,7 @@ if ($progress_task_discovery) {
|
|||
'',
|
||||
'#FFFFFF',
|
||||
0,
|
||||
0,
|
||||
0
|
||||
);
|
||||
$result .= '</li>';
|
||||
|
@ -139,10 +141,12 @@ if ($progress_task_discovery) {
|
|||
$table->data[$i][1] .= $summary['summary']['WMI'];
|
||||
$table->data[$i++][1] .= '</span>';
|
||||
|
||||
$result .= html_print_table($table, true);
|
||||
$result .= html_print_table($table, true).'</div>';
|
||||
|
||||
echo $result;
|
||||
$result_array['status'] = $global_progress;
|
||||
$result_array['html'] = $result;
|
||||
|
||||
echo json_encode($result_array);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -364,7 +364,8 @@ function d3_progress_bar(
|
|||
$text='',
|
||||
$fill_color='#FFFFFF',
|
||||
$radiusx=10,
|
||||
$radiusy=10
|
||||
$radiusy=10,
|
||||
$transition=1
|
||||
) {
|
||||
global $config;
|
||||
|
||||
|
@ -387,6 +388,7 @@ function d3_progress_bar(
|
|||
'".$fill_color."',
|
||||
".(int) $radiusx.',
|
||||
'.(int) $radiusy.',
|
||||
'.(int) $transition.'
|
||||
);
|
||||
</script>';
|
||||
|
||||
|
|
|
@ -1784,7 +1784,8 @@ function progress_bar_d3(
|
|||
label,
|
||||
label_color,
|
||||
radiusx,
|
||||
radiusy
|
||||
radiusy,
|
||||
transition
|
||||
) {
|
||||
var startPercent = 0;
|
||||
var endPercent = parseInt(percentile) / 100;
|
||||
|
@ -1844,17 +1845,21 @@ function progress_bar_d3(
|
|||
progress_front.attr("width", width * bar_progress);
|
||||
}
|
||||
|
||||
var bar_progress = startPercent;
|
||||
|
||||
(function loops() {
|
||||
if (transition == 0) {
|
||||
var bar_progress = endPercent;
|
||||
updateProgress(bar_progress);
|
||||
} else {
|
||||
var bar_progress = startPercent;
|
||||
(function loops() {
|
||||
updateProgress(bar_progress);
|
||||
|
||||
if (count > 0) {
|
||||
count--;
|
||||
bar_progress += step;
|
||||
setTimeout(loops, 30);
|
||||
}
|
||||
})();
|
||||
if (count > 0) {
|
||||
count--;
|
||||
bar_progress += step;
|
||||
setTimeout(loops, 30);
|
||||
}
|
||||
})();
|
||||
}
|
||||
}
|
||||
|
||||
function progress_bubble_d3(
|
||||
|
|
|
@ -1,44 +1,82 @@
|
|||
/**
|
||||
*
|
||||
* @param {*} id
|
||||
* @param {*} name
|
||||
*/
|
||||
function progress_task_list(id, name, url) {
|
||||
var params = [];
|
||||
params.push("page=include/ajax/task_list.ajax");
|
||||
params.push("progress_task_discovery=1");
|
||||
params.push("id=" + id);
|
||||
/*
|
||||
global $
|
||||
global jQuery
|
||||
*/
|
||||
|
||||
jQuery.ajax({
|
||||
data: params.join("&"),
|
||||
/**
|
||||
* Function for create modal with progress task
|
||||
* and recalculate 3 second.
|
||||
* @param {int} id
|
||||
* @param {string} name
|
||||
*/
|
||||
function progress_task_list(id, title) {
|
||||
var timeoutRef = null;
|
||||
var xhr = null;
|
||||
var $elem = $("#progress_task_" + id);
|
||||
|
||||
$elem
|
||||
.hide()
|
||||
.empty()
|
||||
.dialog({
|
||||
title: title,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
width: 600,
|
||||
height: 420,
|
||||
close: function() {
|
||||
if (xhr != null) xhr.abort();
|
||||
if (timeoutRef != null) clearTimeout(timeoutRef);
|
||||
}
|
||||
});
|
||||
|
||||
// Function var.
|
||||
var handleFetchTaskList = function(err, data) {
|
||||
if (err) {
|
||||
// TODO: Show info about the problem.
|
||||
}
|
||||
|
||||
if (data.status > 0) {
|
||||
$elem.html(data.html);
|
||||
if (!$elem.dialog("isOpen")) $elem.dialog("open");
|
||||
}
|
||||
|
||||
if (data.status != -1) {
|
||||
timeoutRef = setTimeout(function() {
|
||||
xhr = fetchTaskList(id, handleFetchTaskList);
|
||||
}, 3000);
|
||||
}
|
||||
};
|
||||
|
||||
xhr = fetchTaskList(id, handleFetchTaskList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that performs ajax request to return
|
||||
* the progress of the task.
|
||||
* @param {int} id Id task.
|
||||
* @param {function} callback Function callback.
|
||||
*/
|
||||
function fetchTaskList(id, callback) {
|
||||
return jQuery.ajax({
|
||||
data: {
|
||||
page: "include/ajax/task_list.ajax",
|
||||
progress_task_discovery: 1,
|
||||
id: id
|
||||
},
|
||||
type: "POST",
|
||||
url: (action = url),
|
||||
dataType: "html",
|
||||
url: "ajax.php",
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
$("#progress_task")
|
||||
.hide()
|
||||
.empty()
|
||||
.append(data)
|
||||
.dialog({
|
||||
title: "Task: " + name,
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: false,
|
||||
width: 600,
|
||||
height: 400
|
||||
})
|
||||
.show();
|
||||
callback(null, data);
|
||||
},
|
||||
error: function() {
|
||||
callback(new Error("cannot fetch the list"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function show_map(id, name, url) {
|
||||
var params = [];
|
||||
params.push("page=include/ajax/task_list.ajax");
|
||||
params.push("showmap=1");
|
||||
params.push("id=" + id);
|
||||
|
||||
$("#progress_task")
|
||||
function show_map(id, name) {
|
||||
$("#map_task")
|
||||
.empty()
|
||||
.hide()
|
||||
.append("<p>Loading map</p>")
|
||||
|
@ -53,12 +91,16 @@ function show_map(id, name, url) {
|
|||
.show();
|
||||
|
||||
jQuery.ajax({
|
||||
data: params.join("&"),
|
||||
data: {
|
||||
page: "include/ajax/task_list.ajax",
|
||||
showmap: 1,
|
||||
id: id
|
||||
},
|
||||
type: "POST",
|
||||
url: (action = url),
|
||||
url: "ajax.php",
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$("#progress_task")
|
||||
$("#map_task")
|
||||
.empty()
|
||||
.append(data);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue