🎨 Display data sync progress in the status bar https://github.com/siyuan-note/siyuan/issues/8552

This commit is contained in:
Daniel 2023-06-16 09:25:59 +08:00
parent 200499aad4
commit 7f9d6ecd29
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
7 changed files with 19 additions and 28 deletions

View file

@ -1123,7 +1123,7 @@
"156": "Access authentication failed, please refresh the page",
"157": "The key is not recognized, please confirm that the copied key string is correct",
"158": "Indexing data repo, walking data %s",
"159": "Indexing data repo, getting the latest file %v",
"159": "Indexing data repo, getting the latest file %v/%v",
"160": "Indexing data repo, inserting file %v",
"161": "Checking out of data repo, walking data %s",
"162": "Checking out data repo, inserting file %v/%v",

View file

@ -1123,7 +1123,7 @@
"156": "Error en la autenticación de acceso, actualice la página",
"157": "No se reconoce la clave, confirme que la cadena de clave copiada es correcta",
"158": "Indexando repositorio de datos, datos para caminar %s",
"159": "Indexando repositorio de datos, obteniendo el último archivo %v",
"159": "Indexando repositorio de datos, obteniendo el último archivo %v/%v",
"160": "Indexando repositorio de datos, insertando archivo %v",
"161": "Revisando el repositorio de datos, recorriendo datos %s",
"162": "Revisando el repositorio de datos, insertando el archivo %v/%v",

View file

@ -1123,7 +1123,7 @@
"156": "Échec de l'authentification d'accès, veuillez actualiser la page",
"157": "La clé n'est pas reconnue, veuillez confirmer que la chaîne de clé copiée est correcte",
"158": "Indexation du référentiel de données, données de marche %s",
"159": "Indexation du référentiel de données, obtention du dernier fichier %v",
"159": "Indexation du référentiel de données, obtention du dernier fichier %v/%v",
"160": "Indexation du référentiel de données, insertion du fichier %v",
"161": "Vérification du référentiel de données, données piétonnes %s",
"162": "Vérification du référentiel de données, insertion du fichier %v/%v",

View file

@ -1123,7 +1123,7 @@
"156": "訪問鑑權失敗,請刷新頁面",
"157": "無法識別密鑰,請確認複製的密鑰字串是否正確",
"158": "正在索引數據倉庫,遍歷數據 %s",
"159": "正在索引數據倉庫,獲取最新文件 %v",
"159": "正在索引數據倉庫,獲取最新文件 %v/%v",
"160": "正在索引數據倉庫,插入文件 %v",
"161": "正在遷出數據倉庫,遍歷數據 %s",
"162": "正在遷出數據倉庫,插入文件 %v/%v",

View file

@ -1125,7 +1125,7 @@
"156": "访问鉴权失败,请刷新页面",
"157": "无法识别密钥,请确认复制的密钥字符串是否正确",
"158": "正在索引数据仓库,遍历数据 %s",
"159": "正在索引数据仓库,获取最新文件 %v",
"159": "正在索引数据仓库,获取最新文件 %v/%v",
"160": "正在索引数据仓库,插入文件 %v",
"161": "正在迁出数据仓库,遍历数据 %s",
"162": "正在迁出数据仓库,插入文件 %v/%v",

View file

@ -144,7 +144,7 @@ require (
replace github.com/mattn/go-sqlite3 => github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5
//replace github.com/siyuan-note/dejavu => D:\88250\dejavu
replace github.com/siyuan-note/dejavu => D:\88250\dejavu
//replace github.com/siyuan-note/riff => D:\88250\riff
//replace github.com/siyuan-note/httpclient => D:\88250\httpclient
//replace github.com/siyuan-note/filelock => D:\88250\filelock

View file

@ -1492,19 +1492,18 @@ func subscribeRepoEvents() {
}
indexWalkDataCount++
})
eventbus.Subscribe(eventbus.EvtIndexBeforeGetLatestFiles, func(context map[string]interface{}, files []string) {
msg := fmt.Sprintf(Conf.Language(159), len(files))
eventbus.Subscribe(eventbus.EvtIndexBeforeGetLatestFiles, func(context map[string]interface{}, total int) {
msg := fmt.Sprintf(Conf.Language(159), 0, total)
util.SetBootDetails(msg)
util.ContextPushMsg(context, msg)
})
getLatestFileCount := 0
eventbus.Subscribe(eventbus.EvtIndexGetLatestFile, func(context map[string]interface{}, id string) {
msg := fmt.Sprintf(Conf.Language(159), id[:7])
if 0 == getLatestFileCount%1024 {
eventbus.Subscribe(eventbus.EvtIndexGetLatestFile, func(context map[string]interface{}, count int, total int) {
msg := fmt.Sprintf(Conf.Language(159), count, total)
if 0 == count%64 {
util.SetBootDetails(msg)
util.ContextPushMsg(context, msg)
}
getLatestFileCount++
})
eventbus.Subscribe(eventbus.EvtIndexUpsertFiles, func(context map[string]interface{}, files []*entity.File) {
msg := fmt.Sprintf(Conf.Language(160), len(files))
@ -1557,14 +1556,13 @@ func subscribeRepoEvents() {
bootProgressPart = 10 / float64(total)
util.ContextPushMsg(context, msg)
})
coRemoveFileCount := 0
eventbus.Subscribe(eventbus.EvtCheckoutRemoveFile, func(context map[string]interface{}, count, total int) {
msg := fmt.Sprintf(Conf.Language(163), count, total)
util.IncBootProgress(bootProgressPart, msg)
if 0 == coRemoveFileCount%1024 {
if 0 == count%64 {
util.ContextPushMsg(context, msg)
}
coRemoveFileCount++
})
eventbus.Subscribe(eventbus.EvtCloudBeforeDownloadIndex, func(context map[string]interface{}, id string) {
@ -1579,14 +1577,13 @@ func subscribeRepoEvents() {
bootProgressPart = 10 / float64(total)
util.ContextPushMsg(context, msg)
})
downloadFileCount := 0
eventbus.Subscribe(eventbus.EvtCloudBeforeDownloadFile, func(context map[string]interface{}, count, total int) {
msg := fmt.Sprintf(Conf.Language(165), count, total)
util.IncBootProgress(bootProgressPart, msg)
if 0 == downloadFileCount%8 {
if 0 == count%8 {
util.ContextPushMsg(context, msg)
}
downloadFileCount++
})
eventbus.Subscribe(eventbus.EvtCloudBeforeDownloadChunks, func(context map[string]interface{}, total int) {
msg := fmt.Sprintf(Conf.Language(166), 0, total)
@ -1594,14 +1591,12 @@ func subscribeRepoEvents() {
bootProgressPart = 10 / float64(total)
util.ContextPushMsg(context, msg)
})
downloadChunkCount := 0
eventbus.Subscribe(eventbus.EvtCloudBeforeDownloadChunk, func(context map[string]interface{}, count, total int) {
msg := fmt.Sprintf(Conf.Language(166), count, total)
util.IncBootProgress(bootProgressPart, msg)
if 0 == downloadChunkCount%8 {
if 0 == count%8 {
util.ContextPushMsg(context, msg)
}
downloadChunkCount++
})
eventbus.Subscribe(eventbus.EvtCloudBeforeDownloadRef, func(context map[string]interface{}, ref string) {
msg := fmt.Sprintf(Conf.Language(167), ref)
@ -1618,28 +1613,24 @@ func subscribeRepoEvents() {
util.SetBootDetails(msg)
util.ContextPushMsg(context, msg)
})
uploadFileCount := 0
eventbus.Subscribe(eventbus.EvtCloudBeforeUploadFile, func(context map[string]interface{}, count, total int) {
msg := fmt.Sprintf(Conf.Language(169), count, total)
if 0 == uploadFileCount%8 {
if 0 == count%8 {
util.SetBootDetails(msg)
util.ContextPushMsg(context, msg)
}
uploadFileCount++
})
eventbus.Subscribe(eventbus.EvtCloudBeforeUploadChunks, func(context map[string]interface{}, total int) {
msg := fmt.Sprintf(Conf.Language(170), 0, total)
util.SetBootDetails(msg)
util.ContextPushMsg(context, msg)
})
uploadChunkCount := 0
eventbus.Subscribe(eventbus.EvtCloudBeforeUploadChunk, func(context map[string]interface{}, count, total int) {
msg := fmt.Sprintf(Conf.Language(170), count, total)
if 0 == uploadChunkCount%8 {
if 0 == count%8 {
util.SetBootDetails(msg)
util.ContextPushMsg(context, msg)
}
uploadChunkCount++
})
eventbus.Subscribe(eventbus.EvtCloudBeforeUploadRef, func(context map[string]interface{}, ref string) {
msg := fmt.Sprintf(Conf.Language(171), ref)