Restore some comments for easier debugging

This commit is contained in:
James Cole 2019-10-13 11:50:28 +02:00
parent 05a5782d5d
commit 49933dae17
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E

View File

@ -24,7 +24,7 @@ var timeOutId;
var jobRunRoutineStarted = false; var jobRunRoutineStarted = false;
var jobStorageRoutineStarted = false; var jobStorageRoutineStarted = false;
var checkInitialInterval = 1000; var checkInitialInterval = 1000;
var checkNextInterval = 800; var checkNextInterval = 500;
var maxLoops = 65536; var maxLoops = 65536;
var totalLoops = 0; var totalLoops = 0;
var startCount = 0; var startCount = 0;
@ -43,7 +43,7 @@ $(function () {
* Downloads some JSON and responds to its content to see what the status is of the current import job. * Downloads some JSON and responds to its content to see what the status is of the current import job.
*/ */
function checkJobJSONStatus() { function checkJobJSONStatus() {
console.log('In checkJobJSONStatus()'); //console.log('In checkJobJSONStatus()');
if (jobFailed === false) { if (jobFailed === false) {
$.getJSON(jobStatusUri).done(reportJobJSONDone).fail(reportJobJSONFailure); $.getJSON(jobStatusUri).done(reportJobJSONDone).fail(reportJobJSONFailure);
} }
@ -58,7 +58,8 @@ function checkJobJSONStatus() {
* @param data * @param data
*/ */
function reportJobJSONDone(data) { function reportJobJSONDone(data) {
console.log('In reportJobJSONDone() with status "' + data.status + '"'); //console.log('In reportJobJSONDone() with status "' + data.status + '"');
//console.log(data);
switch (data.status) { switch (data.status) {
case "ready_to_run": case "ready_to_run":
if (startCount > 0) { if (startCount > 0) {
@ -86,8 +87,10 @@ function reportJobJSONDone(data) {
showJobResults(data); showJobResults(data);
break; break;
default: default:
//console.warn('No specific action for status ' + data.status);
showProgressBox(data.status); showProgressBox(data.status);
recheckJobJSONStatus(); recheckJobJSONStatus();
} }
} }
@ -96,7 +99,7 @@ function reportJobJSONDone(data) {
* @param data * @param data
*/ */
function showJobResults(data) { function showJobResults(data) {
console.log('In showJobResults()'); //console.log('In showJobResults()');
// hide all boxes. // hide all boxes.
$('.statusbox').hide(); $('.statusbox').hide();
@ -117,13 +120,14 @@ function showJobResults(data) {
// show success box. // show success box.
$('.status_finished').show(); $('.status_finished').show();
} }
/** /**
* Will refresh and get job status. * Will refresh and get job status.
*/ */
function recheckJobJSONStatus() { function recheckJobJSONStatus() {
console.log('In recheckJobJSONStatus()'); //console.log('In recheckJobJSONStatus()');
if (maxLoops !== 0 && totalLoops < maxLoops && jobFailed === false) { if (maxLoops !== 0 && totalLoops < maxLoops && jobFailed === false) {
timeOutId = setTimeout(checkJobJSONStatus, checkNextInterval); timeOutId = setTimeout(checkJobJSONStatus, checkNextInterval);
} }
@ -202,7 +206,7 @@ function reportJobJSONFailure(xhr, status, error) {
* *
*/ */
function showProgressBox(status) { function showProgressBox(status) {
console.log('In showProgressBox()'); //console.log('In showProgressBox()');
// hide fatal error box: // hide fatal error box:
$('.fatal_error').hide(); $('.fatal_error').hide();
@ -226,6 +230,8 @@ function showProgressBox(status) {
} }
$('#import-status-txt').text('Job status: ' + status); $('#import-status-txt').text('Job status: ' + status);
} }
/** /**
@ -236,7 +242,7 @@ function showProgressBox(status) {
* @param error * @param error
*/ */
function reportJobPOSTFailure(xhr, status, error) { function reportJobPOSTFailure(xhr, status, error) {
console.log('In reportJobPOSTFailure()'); //console.log('In reportJobPOSTFailure()');
// cancel checking again for job status: // cancel checking again for job status:
clearTimeout(timeOutId); clearTimeout(timeOutId);
if (reportedError === false) { if (reportedError === false) {
@ -284,5 +290,7 @@ function reportJobPOSTDone(data) {
$('.fatal_error').show(); $('.fatal_error').show();
console.error(data.message); console.error(data.message);
$('.fatal_error_txt').text('Job could not be started or crashed: ' + data.message); $('.fatal_error_txt').text('Job could not be started or crashed: ' + data.message);
} }
} }