Better statuses for migrations, beta2
This commit is contained in:
@@ -47,6 +47,10 @@ angular.module('app')
|
||||
setTimeout(() => {
|
||||
this.syncStatus = statusManager.removeStatus(this.syncStatus);
|
||||
}, 2000);
|
||||
} else if(status.total > 20) {
|
||||
this.uploadSyncStatus = statusManager.replaceStatusWithString(this.uploadSyncStatus, `Syncing ${status.current}/${status.total} items...`)
|
||||
} else if(this.uploadSyncStatus) {
|
||||
this.uploadSyncStatus = statusManager.removeStatus(this.uploadSyncStatus);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -300,7 +304,7 @@ angular.module('app')
|
||||
}, false)
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
Handle Auto Sign In From URL
|
||||
*/
|
||||
|
||||
|
||||
@@ -28,6 +28,10 @@ class DesktopManager {
|
||||
})
|
||||
}
|
||||
|
||||
saveBackup() {
|
||||
this.majorDataChangeHandler && this.majorDataChangeHandler();
|
||||
}
|
||||
|
||||
getApplicationDataPath() {
|
||||
console.assert(this.applicationDataPath, "applicationDataPath is null");
|
||||
return this.applicationDataPath;
|
||||
|
||||
@@ -103,7 +103,8 @@ class MigrationManager extends SFMigrationManager {
|
||||
handler: async (notes) => {
|
||||
|
||||
let needsSync = false;
|
||||
let status = this.statusManager.addStatusFromString("Running migration...");
|
||||
let status = this.statusManager.addStatusFromString("Optimizing data...");
|
||||
let dirtyCount = 0;
|
||||
|
||||
for(let note of notes) {
|
||||
if(!note.content) {
|
||||
@@ -125,22 +126,31 @@ class MigrationManager extends SFMigrationManager {
|
||||
if(tag && !tag.hasRelationshipWithItem(note)) {
|
||||
tag.addItemAsRelationship(note);
|
||||
tag.setDirty(true, true);
|
||||
needsSync = true;
|
||||
dirtyCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if(newReferences.length != references.length) {
|
||||
note.content.references = newReferences;
|
||||
note.setDirty(true, true);
|
||||
needsSync = true;
|
||||
dirtyCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if(needsSync) {
|
||||
if(dirtyCount > 0) {
|
||||
if(isDesktopApplication()) {
|
||||
this.desktopManager.saveBackup();
|
||||
}
|
||||
|
||||
status = this.statusManager.replaceStatusWithString(status, `${dirtyCount} items optimized.`);
|
||||
await this.syncManager.sync();
|
||||
}
|
||||
|
||||
this.statusManager.removeStatus(status);
|
||||
status = this.statusManager.replaceStatusWithString(status, `Optimization complete.`);
|
||||
setTimeout(() => {
|
||||
this.statusManager.removeStatus(status);
|
||||
}, 2000);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user