mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-11 15:16:27 +00:00
Progress for Spectre import.
This commit is contained in:
15
public/js/ff/import/status.js
vendored
15
public/js/ff/import/status.js
vendored
@@ -34,10 +34,12 @@ var knownErrors = 0;
|
||||
|
||||
$(function () {
|
||||
"use strict";
|
||||
console.log('in start');
|
||||
timeOutId = setTimeout(checkJobStatus, startInterval);
|
||||
|
||||
$('.start-job').click(startJob);
|
||||
if (job.configuration['auto-start']) {
|
||||
console.log('Called startJob()!');
|
||||
startJob();
|
||||
}
|
||||
});
|
||||
@@ -46,6 +48,7 @@ $(function () {
|
||||
* Downloads some JSON and responds to its content to see what the status is of the current import.
|
||||
*/
|
||||
function checkJobStatus() {
|
||||
console.log('in checkJobStatus');
|
||||
$.getJSON(jobStatusUri).done(reportOnJobStatus).fail(reportFailedJob);
|
||||
}
|
||||
|
||||
@@ -53,6 +56,7 @@ function checkJobStatus() {
|
||||
* This method is called when the JSON query returns an error. If possible, this error is relayed to the user.
|
||||
*/
|
||||
function reportFailedJob(jqxhr, textStatus, error) {
|
||||
console.log('in reportFailedJob');
|
||||
// hide all possible boxes:
|
||||
$('.statusbox').hide();
|
||||
|
||||
@@ -72,6 +76,7 @@ function reportFailedJob(jqxhr, textStatus, error) {
|
||||
* @param data
|
||||
*/
|
||||
function reportOnJobStatus(data) {
|
||||
console.log('in reportOnJobStatus: ' + data.status);
|
||||
|
||||
switch (data.status) {
|
||||
case "configured":
|
||||
@@ -80,6 +85,10 @@ function reportOnJobStatus(data) {
|
||||
$('.statusbox').hide();
|
||||
$('.status_configured').show();
|
||||
}
|
||||
if (job.configuration['auto-start']) {
|
||||
console.log('Job is auto start. Check status again in 500ms.');
|
||||
timeOutId = setTimeout(checkJobStatus, interval);
|
||||
}
|
||||
break;
|
||||
case "running":
|
||||
// job is running! Show the running box:
|
||||
@@ -122,7 +131,13 @@ function reportOnJobStatus(data) {
|
||||
// show the fatal error box:
|
||||
$('.fatal_error').show();
|
||||
break;
|
||||
case "configuring":
|
||||
// redirect back to configure screen.
|
||||
console.log('Will now redirect to ' + jobConfigureUri);
|
||||
window.location = jobConfigureUri;
|
||||
break;
|
||||
default:
|
||||
console.error('Cannot handle job status ' + data.status);
|
||||
break;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user