Merge branch 'ent-12097-operacion-view-summary-en-discovery-tasks-no-funciona' into 'develop'

Ent 12097 operacion view summary en discovery tasks no funciona

See merge request artica/pandorafms!6479
This commit is contained in:
Rafael Ameijeiras 2023-09-21 15:40:57 +00:00
commit 902317fa70
1 changed files with 20 additions and 8 deletions

View File

@ -25,7 +25,15 @@ function progress_task_list(id, title) {
draggable: true, draggable: true,
closeOnEscape: true, closeOnEscape: true,
width: 800, width: 800,
height: 600, height: "auto",
buttons: [
{
text: "OK",
click: function() {
$(this).dialog("close");
}
}
],
close: function() { close: function() {
if (xhr != null) xhr.abort(); if (xhr != null) xhr.abort();
if (timeoutRef != null) clearTimeout(timeoutRef); if (timeoutRef != null) clearTimeout(timeoutRef);
@ -35,13 +43,17 @@ function progress_task_list(id, title) {
// Function var. // Function var.
var handleFetchTaskList = function(err, data) { var handleFetchTaskList = function(err, data) {
if (err) { if (err) {
console.error(err); let err_text = err.toString();
err_text = err_text.replace("Error: ", "");
err_text =
"<b>Error</b><br/>" + err_text[0].toUpperCase() + err_text.substring(1);
$elem.html(err_text);
} }
if (data.error) { if (data) {
// TODO: Show info about the problem. let split_data = data.split('{"html":');
$elem.html(data.error); data = '{"html":' + split_data[1];
} else { data = JSON.parse(data);
$elem.html(data.html); $elem.html(data.html + " " + split_data[0]);
} }
if (!$elem.dialog("isOpen")) $elem.dialog("open"); if (!$elem.dialog("isOpen")) $elem.dialog("open");
@ -71,7 +83,7 @@ function fetchTaskList(id, callback) {
}, },
type: "POST", type: "POST",
url: $("#ajax-url").val(), url: $("#ajax-url").val(),
dataType: "json", dataType: "text",
success: function(data) { success: function(data) {
callback(null, data); callback(null, data);
}, },