Basic storage routine works, basic file handling.

This commit is contained in:
James Cole
2018-05-10 09:10:16 +02:00
parent 116f7ed613
commit cabcb9c6d0
16 changed files with 278 additions and 157 deletions

View File

@@ -28,6 +28,7 @@ var checkNextInterval = 500;
var maxLoops = 60;
var totalLoops = 0;
var startCount = 0;
var jobFailed = false;
$(function () {
"use strict";
@@ -39,7 +40,12 @@ $(function () {
*/
function checkJobJSONStatus() {
console.log('In checkJobJSONStatus()');
$.getJSON(jobStatusUri).done(reportJobJSONDone).fail(reportJobJSONFailure);
if(jobFailed === false) {
$.getJSON(jobStatusUri).done(reportJobJSONDone).fail(reportJobJSONFailure);
}
if(jobFailed === true) {
console.error('Job has failed, will not check.');
}
}
/**
@@ -115,12 +121,15 @@ function showJobResults(data) {
*/
function recheckJobJSONStatus() {
console.log('In recheckJobJSONStatus()');
if (maxLoops !== 0 && totalLoops < maxLoops) {
if (maxLoops !== 0 && totalLoops < maxLoops && jobFailed === false) {
timeOutId = setTimeout(checkJobJSONStatus, checkNextInterval);
}
if (maxLoops !== 0) {
console.log('max: ' + maxLoops + ' current: ' + totalLoops);
}
if(jobFailed === true) {
console.error('Job has failed, will not do recheck.');
}
totalLoops++;
}
@@ -133,6 +142,10 @@ function sendJobPOSTStart() {
console.log('Import job already started!');
return;
}
if(jobFailed === true) {
console.log('Job has failed, will not start again.');
return;
}
console.log('Job was started');
jobRunRoutineStarted = true;
$.post(jobStartUri, {_token: token}).fail(reportJobPOSTFailure).done(reportJobPOSTDone)
@@ -147,6 +160,10 @@ function sendJobPOSTStore() {
console.log('Store job already started!');
return;
}
if(jobFailed === true) {
console.log('Job has failed, will not start again.');
return;
}
console.log('Storage job has started!');
jobStorageRoutineStarted = true;
$.post(jobStorageStartUri, {_token: token}).fail(reportJobPOSTFailure).done(reportJobPOSTDone)
@@ -162,9 +179,11 @@ function sendJobPOSTStore() {
*/
function reportJobJSONFailure(xhr, status, error) {
console.log('In reportJobJSONFailure()');
jobFailed = true;
// cancel checking again for job status:
clearTimeout(timeOutId);
// hide status boxes:
$('.statusbox').hide();