fix: show correct sync status

This commit is contained in:
Baptiste Grob
2020-09-17 14:27:53 +02:00
parent 6f8543b6e5
commit 19a9f57bed
4 changed files with 29 additions and 26 deletions

View File

@@ -118,7 +118,7 @@ class ApplicationViewCtrl extends PureViewCtrl {
if (!this.completedInitialSync) {
this.syncStatus = this.application!.getStatusService().replaceStatusWithString(
this.syncStatus,
"Syncing..."
"Syncing"
);
}
} else if (eventName === ApplicationEvent.CompletedFullSync) {
@@ -203,9 +203,18 @@ class ApplicationViewCtrl extends PureViewCtrl {
this.syncStatus = this.application!.getStatusService().removeStatus(this.syncStatus);
}, 2000);
} else if (stats.uploadTotalCount > 20) {
const completionPercentage = stats.uploadCompletionCount === 0
? 0
: stats.uploadCompletionCount / stats.uploadTotalCount;
const stringPercentage = completionPercentage.toLocaleString(
undefined,
{ style: 'percent' }
);
this.uploadSyncStatus = this.application!.getStatusService().replaceStatusWithString(
this.uploadSyncStatus,
`Syncing ${stats.uploadCompletionCount}/${stats.uploadTotalCount} items...`
`Syncing ${stats.uploadTotalCount} items (${stringPercentage} complete)`,
);
} else {
if (this.syncStatus) {