fix sync status

This commit is contained in:
zadam
2021-05-15 22:00:53 +02:00
parent 623200b92b
commit f6dd1110e8
4 changed files with 19 additions and 12 deletions

View File

@@ -126,27 +126,29 @@ export default class SyncStatusWidget extends BasicWidget {
});
this.syncState = 'in-progress';
this.allChangesPushed = false;
this.lastSyncedPush = message.lastSyncedPush;
}
else if (message.type === 'sync-push-in-progress') {
this.syncState = 'in-progress';
this.allChangesPushed = false;
this.lastSyncedPush = message.lastSyncedPush;
}
else if (message.type === 'sync-finished') {
// this gives user a chance to see the toast in case of fast sync finish
setTimeout(() => toastService.closePersistent('sync'), 1000);
this.syncState = 'connected';
this.lastSyncedPush = message.lastSyncedPush;
}
else if (message.type === 'sync-failed') {
this.syncState = 'disconnected';
this.lastSyncedPush = message.lastSyncedPush;
}
else if (message.type === 'frontend-update') {
const {lastSyncedPush} = message.data;
this.allChangesPushed = lastSyncedPush === ws.getMaxKnownEntityChangeSyncId();
this.lastSyncedPush = message.data.lastSyncedPush;
}
this.allChangesPushed = this.lastSyncedPush === ws.getMaxKnownEntityChangeSyncId();
if (['unknown', 'in-progress'].includes(this.syncState)) {
this.showIcon(this.syncState);
} else {