#98, new option "initialized" which indicates if setup has been finished

This commit is contained in:
azivner
2018-07-24 08:12:36 +02:00
parent 1fe7c62f5a
commit 013714cb5c
11 changed files with 130 additions and 57 deletions

View File

@@ -1,7 +1,11 @@
import utils from "./services/utils.js";
function SetupModel() {
this.step = ko.observable("setup-type");
if (syncInProgress) {
setInterval(checkOutstandingSyncs, 1000);
}
this.step = ko.observable(syncInProgress ? "sync-in-progress" : "setup-type");
this.setupType = ko.observable();
this.setupNewDocument = ko.observable(false);
@@ -93,8 +97,6 @@ function SetupModel() {
if (resp.result === 'success') {
this.step('sync-in-progress');
checkOutstandingSyncs();
setInterval(checkOutstandingSyncs, 1000);
}
else {
@@ -105,7 +107,12 @@ function SetupModel() {
}
async function checkOutstandingSyncs() {
const stats = await $.get('/api/sync/stats');
const { stats, initialized } = await $.get('/api/sync/stats');
if (initialized) {
window.location.replace("/");
}
const totalOutstandingSyncs = stats.outstandingPushes + stats.outstandingPulls;
$("#outstanding-syncs").html(totalOutstandingSyncs);