mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 改进桌面端底部状态栏通知 Fix https://github.com/siyuan-note/siyuan/issues/5294
This commit is contained in:
parent
cdeda3f076
commit
5ca22dc691
5 changed files with 39 additions and 12 deletions
|
|
@ -896,6 +896,9 @@
|
||||||
"143": "Creating data snapshot...",
|
"143": "Creating data snapshot...",
|
||||||
"144": "Resetting data repository...",
|
"144": "Resetting data repository...",
|
||||||
"145": "Data repository reset completed",
|
"145": "Data repository reset completed",
|
||||||
"146": "Failed to reset data repository: %s"
|
"146": "Failed to reset data repository: %s",
|
||||||
|
"147": "Created a new data snapshot, took %.2fs",
|
||||||
|
"148": "Checked the data snapshot and found no changes",
|
||||||
|
"149": "Data snapshot has been synchronized, took %.2fs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -896,6 +896,9 @@
|
||||||
"143": "Création d'un instantané de données...",
|
"143": "Création d'un instantané de données...",
|
||||||
"144": "Réinitialisation du référentiel de données...",
|
"144": "Réinitialisation du référentiel de données...",
|
||||||
"145": "Réinitialisation du référentiel de données terminée",
|
"145": "Réinitialisation du référentiel de données terminée",
|
||||||
"146": "Échec de la réinitialisation du référentiel de données : %s"
|
"146": "Échec de la réinitialisation du référentiel de données : %s",
|
||||||
|
"147": "Créé un nouvel instantané de données, a pris %.2fs",
|
||||||
|
"148": "Vérifié l'instantané des données et n'a trouvé aucun changement",
|
||||||
|
"149": "L'instantané des données a été synchronisé, a pris %.2fs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -895,6 +895,9 @@
|
||||||
"143": "正在創建數據快照...",
|
"143": "正在創建數據快照...",
|
||||||
"144": "正在重置數據倉庫...",
|
"144": "正在重置數據倉庫...",
|
||||||
"145": "數據倉庫重置完畢",
|
"145": "數據倉庫重置完畢",
|
||||||
"146": "重置數據倉庫失敗:%s"
|
"146": "重置數據倉庫失敗:%s",
|
||||||
|
"147": "創建了一個新的數據快照,耗時 %.2fs",
|
||||||
|
"148": "檢查數據快照,沒有發現任何變化",
|
||||||
|
"149": "已經同步數據快照,耗時 %.2fs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -897,6 +897,9 @@
|
||||||
"143": "正在创建数据快照...",
|
"143": "正在创建数据快照...",
|
||||||
"144": "正在重置数据仓库...",
|
"144": "正在重置数据仓库...",
|
||||||
"145": "数据仓库重置完毕",
|
"145": "数据仓库重置完毕",
|
||||||
"146": "重置数据仓库失败:%s"
|
"146": "重置数据仓库失败:%s",
|
||||||
|
"147": "创建了一个新的数据快照,耗时 %.2fs",
|
||||||
|
"148": "检查数据快照,没有发现任何变化",
|
||||||
|
"149": "已经同步数据快照,耗时 %.2fs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -360,15 +360,27 @@ func IndexRepo(memo string) (err error) {
|
||||||
defer writingDataLock.Unlock()
|
defer writingDataLock.Unlock()
|
||||||
|
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
|
latest, _ := repo.Latest()
|
||||||
WaitForWritingFiles()
|
WaitForWritingFiles()
|
||||||
sql.WaitForWritingDatabase()
|
|
||||||
filelock.ReleaseAllFileLocks()
|
filelock.ReleaseAllFileLocks()
|
||||||
_, err = repo.Index(memo, map[string]interface{}{
|
index, err := repo.Index(memo, map[string]interface{}{
|
||||||
CtxPushMsg: CtxPushMsgToStatusBarAndProgress,
|
CtxPushMsg: CtxPushMsgToStatusBarAndProgress,
|
||||||
})
|
})
|
||||||
|
if nil != err {
|
||||||
|
util.PushStatusBar("Create data snapshot failed")
|
||||||
|
return
|
||||||
|
}
|
||||||
elapsed := time.Since(start)
|
elapsed := time.Since(start)
|
||||||
util.LogInfof("index data repo elapsed [%.2fs]", elapsed.Seconds())
|
|
||||||
util.PushStatusBar(fmt.Sprintf("Indexed data repo in %.2fs", elapsed.Seconds()))
|
if nil != latest {
|
||||||
|
if latest.ID != index.ID {
|
||||||
|
util.PushStatusBar(fmt.Sprintf(Conf.Language(147), elapsed.Seconds()))
|
||||||
|
} else {
|
||||||
|
util.PushStatusBar(Conf.Language(148))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
util.PushStatusBar(fmt.Sprintf(Conf.Language(147), elapsed.Seconds()))
|
||||||
|
}
|
||||||
util.PushClearProgress()
|
util.PushClearProgress()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -393,11 +405,12 @@ func indexRepoBeforeCloudSync() {
|
||||||
}
|
}
|
||||||
|
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
latest, err := repo.Latest()
|
latest, _ := repo.Latest()
|
||||||
index, err := repo.Index("[Auto] Cloud sync", map[string]interface{}{
|
index, err := repo.Index("[Auto] Cloud sync", map[string]interface{}{
|
||||||
CtxPushMsg: CtxPushMsgToStatusBar,
|
CtxPushMsg: CtxPushMsgToStatusBar,
|
||||||
})
|
})
|
||||||
if nil != err {
|
if nil != err {
|
||||||
|
util.PushStatusBar("Create data snapshot for cloud sync failed")
|
||||||
util.LogErrorf("index data repo before cloud sync failed: %s", err)
|
util.LogErrorf("index data repo before cloud sync failed: %s", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -412,10 +425,12 @@ func indexRepoBeforeCloudSync() {
|
||||||
util.LogErrorf("put index into data repo before cloud sync failed: %s", err)
|
util.LogErrorf("put index into data repo before cloud sync failed: %s", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
util.PushStatusBar("Made a new data snapshot for cloud sync")
|
util.PushStatusBar(fmt.Sprintf(Conf.Language(147), elapsed.Seconds()))
|
||||||
} else {
|
} else {
|
||||||
util.PushStatusBar("Checked data snapshot and found no changes ")
|
util.PushStatusBar(Conf.Language(148))
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
util.PushStatusBar(fmt.Sprintf(Conf.Language(147), elapsed.Seconds()))
|
||||||
}
|
}
|
||||||
if 7000 < elapsed.Milliseconds() {
|
if 7000 < elapsed.Milliseconds() {
|
||||||
util.LogWarnf("index data repo before cloud sync elapsed [%dms]", elapsed.Milliseconds())
|
util.LogWarnf("index data repo before cloud sync elapsed [%dms]", elapsed.Milliseconds())
|
||||||
|
|
@ -439,6 +454,6 @@ func syncRepo() (err error) {
|
||||||
})
|
})
|
||||||
elapsed := time.Since(start)
|
elapsed := time.Since(start)
|
||||||
util.LogInfof("sync data repo elapsed [%.2fs]", elapsed.Seconds())
|
util.LogInfof("sync data repo elapsed [%.2fs]", elapsed.Seconds())
|
||||||
util.PushStatusBar(fmt.Sprintf("Synced data repo in %.2fs", elapsed.Seconds()))
|
util.PushStatusBar(fmt.Sprintf(Conf.Language(149), elapsed.Seconds()))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue