hide sync status on extra window until the sync status is known

This commit is contained in:
zadam 2021-03-30 22:59:25 +02:00
parent e569ae1a0d
commit 8644c38abc

View file

@ -3,6 +3,7 @@ import toastService from "../services/toast.js";
import ws from "../services/ws.js"; import ws from "../services/ws.js";
import options from "../services/options.js"; import options from "../services/options.js";
import syncService from "../services/sync.js"; import syncService from "../services/sync.js";
import appContext from "../services/app_context.js";
const TPL = ` const TPL = `
<div class="sync-status-widget"> <div class="sync-status-widget">
@ -82,7 +83,8 @@ export default class SyncStatusWidget extends BasicWidget {
ws.subscribeToMessages(message => this.processMessage(message)); ws.subscribeToMessages(message => this.processMessage(message));
this.syncState = 'disconnected'; // extra window doesn't know the status of the sync so it's better to hide it
this.syncState = appContext.isMainWindow ? 'disconnected' : 'unknown';
this.allChangesPushed = false; this.allChangesPushed = false;
} }
@ -144,7 +146,7 @@ export default class SyncStatusWidget extends BasicWidget {
if (this.syncState === 'in-progress') { if (this.syncState === 'in-progress') {
this.showIcon('in-progress'); this.showIcon('in-progress');
} else { } else if (this.syncState !== 'unknown') {
this.showIcon(this.syncState + '-' + (this.allChangesPushed ? 'no-changes' : 'with-changes')); this.showIcon(this.syncState + '-' + (this.allChangesPushed ? 'no-changes' : 'with-changes'));
} }
} }