mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
🎨 Attribute View data synchronization https://github.com/siyuan-note/siyuan/issues/7552
This commit is contained in:
parent
2d190bf708
commit
e8e645f02b
3 changed files with 19 additions and 2 deletions
|
|
@ -35,5 +35,11 @@ func renderAttributeView(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
id := arg["id"].(string)
|
id := arg["id"].(string)
|
||||||
ret.Data = model.RenderAttributeView(id)
|
data, err := model.RenderAttributeView(id)
|
||||||
|
if nil != err {
|
||||||
|
ret.Code = -1
|
||||||
|
ret.Msg = err.Error()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ret.Data = data
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,9 @@ import (
|
||||||
"github.com/siyuan-note/siyuan/kernel/treenode"
|
"github.com/siyuan-note/siyuan/kernel/treenode"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RenderAttributeView(avID string) (dom string) {
|
func RenderAttributeView(avID string) (dom string, err error) {
|
||||||
|
waitForSyncingStorages()
|
||||||
|
|
||||||
attrView, err := av.ParseAttributeView(avID)
|
attrView, err := av.ParseAttributeView(avID)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
logging.LogErrorf("parse attribute view [%s] failed: %s", avID, err)
|
logging.LogErrorf("parse attribute view [%s] failed: %s", avID, err)
|
||||||
|
|
|
||||||
|
|
@ -771,6 +771,15 @@ func IndexRepo(memo string) (err error) {
|
||||||
var syncingFiles = sync.Map{}
|
var syncingFiles = sync.Map{}
|
||||||
var syncingStorages = false
|
var syncingStorages = false
|
||||||
|
|
||||||
|
func waitForSyncingStorages() {
|
||||||
|
for i := 0; i < 30; i++ {
|
||||||
|
if syncingStorages {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
time.Sleep(time.Second)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func IsSyncingFile(rootID string) (ret bool) {
|
func IsSyncingFile(rootID string) (ret bool) {
|
||||||
_, ret = syncingFiles.Load(rootID)
|
_, ret = syncingFiles.Load(rootID)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue