Browse Source

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

Daniel 2 years ago
parent
commit
52e8834da0

+ 1 - 1
app/appearance/langs/en_US.json

@@ -1124,7 +1124,7 @@
     "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/%v",
-    "160": "Indexing data repo, inserting file %v",
+    "160": "Indexing data repo, inserting file %v/%v",
     "161": "Checking out of data repo, walking data %s",
     "162": "Checking out data repo, inserting file %v/%v",
     "163": "Checking out data repo, deleting file %v/%v",

+ 1 - 1
app/appearance/langs/es_ES.json

@@ -1124,7 +1124,7 @@
     "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/%v",
-    "160": "Indexando repositorio de datos, insertando archivo %v",
+    "160": "Indexando repositorio de datos, insertando archivo %v/%v",
     "161": "Revisando el repositorio de datos, recorriendo datos %s",
     "162": "Revisando el repositorio de datos, insertando el archivo %v/%v",
     "163": "Revisando el repositorio de datos, eliminando el archivo %v/%v",

+ 1 - 1
app/appearance/langs/fr_FR.json

@@ -1124,7 +1124,7 @@
     "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/%v",
-    "160": "Indexation du référentiel de données, insertion du fichier %v",
+    "160": "Indexation du référentiel de données, insertion du fichier %v/%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",
     "163": "Vérification du référentiel de données, suppression du fichier %v/%v",

+ 1 - 1
app/appearance/langs/zh_CHT.json

@@ -1124,7 +1124,7 @@
     "157": "無法識別密鑰,請確認複製的密鑰字串是否正確",
     "158": "正在索引數據倉庫,遍歷數據 %s",
     "159": "正在索引數據倉庫,獲取最新文件 %v/%v",
-    "160": "正在索引數據倉庫,插入文件 %v",
+    "160": "正在索引數據倉庫,插入文件 %v/%v",
     "161": "正在遷出數據倉庫,遍歷數據 %s",
     "162": "正在遷出數據倉庫,插入文件 %v/%v",
     "163": "正在遷出數據倉庫,刪除文件 %v/%v",

+ 1 - 1
app/appearance/langs/zh_CN.json

@@ -1126,7 +1126,7 @@
     "157": "无法识别密钥,请确认复制的密钥字符串是否正确",
     "158": "正在索引数据仓库,遍历数据 %s",
     "159": "正在索引数据仓库,获取最新文件 %v/%v",
-    "160": "正在索引数据仓库,插入文件 %v",
+    "160": "正在索引数据仓库,插入文件 %v/%v",
     "161": "正在迁出数据仓库,遍历数据 %s",
     "162": "正在迁出数据仓库,插入文件 %v/%v",
     "163": "正在迁出数据仓库,删除文件 %v/%v",

+ 5 - 7
kernel/model/repository.go

@@ -1505,19 +1505,17 @@ func subscribeRepoEvents() {
 			util.ContextPushMsg(context, msg)
 		}
 	})
-	eventbus.Subscribe(eventbus.EvtIndexUpsertFiles, func(context map[string]interface{}, files []*entity.File) {
-		msg := fmt.Sprintf(Conf.Language(160), len(files))
+	eventbus.Subscribe(eventbus.EvtIndexUpsertFiles, func(context map[string]interface{}, total int) {
+		msg := fmt.Sprintf(Conf.Language(160), 0, total)
 		util.SetBootDetails(msg)
 		util.ContextPushMsg(context, msg)
 	})
-	indexUpsertFileCount := 0
-	eventbus.Subscribe(eventbus.EvtIndexUpsertFile, func(context map[string]interface{}, path string) {
-		msg := fmt.Sprintf(Conf.Language(160), filepath.Base(path))
-		if 0 == indexUpsertFileCount%64 {
+	eventbus.Subscribe(eventbus.EvtIndexUpsertFile, func(context map[string]interface{}, count int, total int) {
+		msg := fmt.Sprintf(Conf.Language(160), count, total)
+		if 0 == count%64 {
 			util.SetBootDetails(msg)
 			util.ContextPushMsg(context, msg)
 		}
-		indexUpsertFileCount++
 	})
 
 	eventbus.Subscribe(eventbus.EvtCheckoutBeforeWalkData, func(context map[string]interface{}, path string) {