mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Basic storage routine works, basic file handling.
This commit is contained in:
23
public/js/ff/import/status_v2.js
vendored
23
public/js/ff/import/status_v2.js
vendored
@@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user