mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-03 11:08:28 +00:00
Update javascript code.
This commit is contained in:
@@ -28,20 +28,17 @@ $(function () {
|
||||
|
||||
function checkImportStatus() {
|
||||
"use strict";
|
||||
console.log('checkImportStatus()');
|
||||
$.getJSON(jobImportUrl).done(reportOnJobImport).fail(failedJobImport);
|
||||
}
|
||||
|
||||
function importComplete(data) {
|
||||
"use strict";
|
||||
console.log('importComplete()');
|
||||
var bar = $('#import-status-bar');
|
||||
bar.removeClass('active');
|
||||
}
|
||||
|
||||
function updateBar(data) {
|
||||
"use strict";
|
||||
console.log('updateBar()');
|
||||
var bar = $('#import-status-bar');
|
||||
if (data.showPercentage) {
|
||||
bar.addClass('progress-bar-success').removeClass('progress-bar-info');
|
||||
@@ -63,7 +60,6 @@ function updateBar(data) {
|
||||
|
||||
function reportErrors(data) {
|
||||
"use strict";
|
||||
console.log('reportErrors()');
|
||||
if (data.errors.length == 1) {
|
||||
$('#import-status-error-intro').text(langImportSingleError);
|
||||
//'An error has occured during the import. The import can continue, however.'
|
||||
@@ -83,21 +79,18 @@ function reportErrors(data) {
|
||||
|
||||
function reportStatus(data) {
|
||||
"use strict";
|
||||
console.log('reportStatus()');
|
||||
$('#import-status-txt').removeClass('text-danger').text(data.statusText);
|
||||
}
|
||||
|
||||
function kickStartJob() {
|
||||
"use strict";
|
||||
console.log('kickStartJob()');
|
||||
$.post(jobStartUrl, {_token: token});
|
||||
$.post(jobStartUrl);
|
||||
startedTheImport();
|
||||
startedImport = true;
|
||||
}
|
||||
|
||||
function updateTimeout(data) {
|
||||
"use strict";
|
||||
console.log('updateTimeout()');
|
||||
if (data.stepsDone != stepCount) {
|
||||
stepCount = data.stepsDone;
|
||||
currentLimit = 0;
|
||||
@@ -105,12 +98,10 @@ function updateTimeout(data) {
|
||||
}
|
||||
|
||||
currentLimit = currentLimit + interval;
|
||||
// console.log("stepCount: " + stepCount + ", stepsDone: " + data.stepsDone + ", currentLimit: " + currentLimit);
|
||||
}
|
||||
|
||||
function timeoutError() {
|
||||
"use strict";
|
||||
console.log('timeoutError()');
|
||||
// set status
|
||||
$('#import-status-txt').addClass('text-danger').text(langImportTimeOutError);
|
||||
|
||||
@@ -121,13 +112,11 @@ function timeoutError() {
|
||||
|
||||
function importJobFinished(data) {
|
||||
"use strict";
|
||||
console.log('importJobFinished() = ' + data.finished);
|
||||
return data.finished;
|
||||
}
|
||||
|
||||
function finishedJob(data) {
|
||||
"use strict";
|
||||
console.log('finishedJob()');
|
||||
// "There was an error during the import routine. Please check the log files. The error seems to be: '"
|
||||
$('#import-status-txt').removeClass('text-danger').addClass('text-success').text(langImportFinished);
|
||||
|
||||
@@ -142,7 +131,6 @@ function finishedJob(data) {
|
||||
|
||||
function reportOnJobImport(data) {
|
||||
"use strict";
|
||||
console.log('reportOnJobImport()');
|
||||
updateBar(data);
|
||||
reportErrors(data);
|
||||
reportStatus(data);
|
||||
@@ -173,13 +161,11 @@ function reportOnJobImport(data) {
|
||||
|
||||
function startedTheImport() {
|
||||
"use strict";
|
||||
console.log('startedTheImport()');
|
||||
setTimeout(checkImportStatus, interval);
|
||||
}
|
||||
|
||||
function failedJobImport(jqxhr, textStatus, error) {
|
||||
"use strict";
|
||||
console.log('failedJobImport()');
|
||||
// set status
|
||||
// "There was an error during the import routine. Please check the log files. The error seems to be: '"
|
||||
$('#import-status-txt').addClass('text-danger').text(langImportFatalError + ' ' + textStatus + ' ' + error);
|
||||
|
Reference in New Issue
Block a user