🎨 校验索引发现文件系统相关问题并修复后自动刷新界面

This commit is contained in:
Liang Ding 2023-02-14 09:27:20 +08:00
parent fe63530325
commit 675318dbbc
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
6 changed files with 21 additions and 5 deletions

View file

@ -1087,6 +1087,7 @@
"186": "Locking cloud sync directory",
"187": "Unlocking cloud sync directory",
"188": "Failed to lock the cloud sync directory, please try again later",
"189": "Cloud sync directory is still locked by other devices, please try again later"
"189": "Cloud sync directory is still locked by other devices, please try again later",
"190": "A problem was found while validating the index, which has been automatically fixed"
}
}

View file

@ -1087,6 +1087,7 @@
"186": "Bloqueando el directorio de sincronización de la nube",
"187": "Desbloqueando el directorio de sincronización en la nube",
"188": "Error al bloquear el directorio de sincronizaci\u00f3n en la nube, int\u00e1ntelo de nuevo m\u00e1s tarde",
"189": "El directorio de sincronización en la nube todavía está bloqueado por otros dispositivos, inténtalo de nuevo más tarde"
"189": "El directorio de sincronización en la nube todavía está bloqueado por otros dispositivos, inténtalo de nuevo más tarde",
"190": "Se encontro un problema al validar el indice, el cual se soluciono automaticamente"
}
}

View file

@ -1087,6 +1087,7 @@
"186": "Verrouillage du répertoire de synchronisation cloud",
"187": "Déverrouillage du répertoire de synchronisation cloud",
"188": "Échec du verrouillage du répertoire de synchronisation cloud, veuillez réessayer plus tard",
"189": "Le répertoire de synchronisation cloud est toujours verrouillé par d'autres appareils, veuillez réessayer plus tard"
"189": "Le répertoire de synchronisation cloud est toujours verrouillé par d'autres appareils, veuillez réessayer plus tard",
"190": "Un problème a été trouvé lors de la validation de l'index, qui a été automatiquement corrigé"
}
}

View file

@ -1087,6 +1087,7 @@
"186": "正在鎖定雲端同步目錄",
"187": "正在解鎖雲端同步目錄",
"188": "鎖定雲端同步目錄失敗,請稍後再試",
"189": "雲端同步目錄還在被其他設備鎖定,請稍後再試"
"189": "雲端同步目錄還在被其他設備鎖定,請稍後再試",
"190": "校驗索引時發現一個問題,已經自動修復"
}
}

View file

@ -1087,6 +1087,7 @@
"186": "正在锁定云端同步目录",
"187": "正在解锁云端同步目录",
"188": "锁定云端同步目录失败,请稍后再试",
"189": "云端同步目录还在被其他设备锁定,请稍后再试"
"189": "云端同步目录还在被其他设备锁定,请稍后再试",
"190": "校验索引时发现一个问题,已经自动修复"
}
}

View file

@ -113,6 +113,7 @@ func resetDuplicateBlocksOnFileSys() {
boxes := Conf.GetBoxes()
luteEngine := lute.New()
blockIDs := map[string]bool{}
needRefreshUI := false
for _, box := range boxes {
boxPath := filepath.Join(util.DataDir, box.ID)
filepath.Walk(boxPath, func(path string, info os.FileInfo, err error) error {
@ -158,6 +159,7 @@ func resetDuplicateBlocksOnFileSys() {
// 如果是文档根节点,则直接重置这颗树
logging.LogWarnf("exist more than one tree with the same id [%s], reset it", box.ID+p)
recreateTree(tree, path)
needRefreshUI = true
return ast.WalkStop
}
@ -165,6 +167,7 @@ func resetDuplicateBlocksOnFileSys() {
needOverwrite = true
n.ID = ast.NewNodeID()
n.SetIALAttr("id", n.ID)
needRefreshUI = true
return ast.WalkContinue
})
@ -177,6 +180,14 @@ func resetDuplicateBlocksOnFileSys() {
return nil
})
}
if needRefreshUI {
util.ReloadUI()
go func() {
time.Sleep(time.Second * 3)
util.PushMsg(Conf.Language(190), 5000)
}()
}
}
func recreateTree(tree *parse.Tree, absPath string) {