mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
🎨 Support doc/snapshot history for database table view https://github.com/siyuan-note/siyuan/issues/9567
This commit is contained in:
parent
27b370133d
commit
faeaec707d
1 changed files with 26 additions and 23 deletions
|
|
@ -209,9 +209,8 @@ func RenderRepoSnapshotAttributeView(indexID, avID string) (viewable av.Viewable
|
||||||
}
|
}
|
||||||
|
|
||||||
if nil == avFile {
|
if nil == avFile {
|
||||||
return
|
attrView = av.NewAttributeView(avID)
|
||||||
}
|
} else {
|
||||||
|
|
||||||
data, readErr := repo.OpenFile(avFile)
|
data, readErr := repo.OpenFile(avFile)
|
||||||
if nil != readErr {
|
if nil != readErr {
|
||||||
logging.LogErrorf("read attribute view [%s] failed: %s", avID, readErr)
|
logging.LogErrorf("read attribute view [%s] failed: %s", avID, readErr)
|
||||||
|
|
@ -223,6 +222,7 @@ func RenderRepoSnapshotAttributeView(indexID, avID string) (viewable av.Viewable
|
||||||
logging.LogErrorf("unmarshal attribute view [%s] failed: %s", avID, err)
|
logging.LogErrorf("unmarshal attribute view [%s] failed: %s", avID, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
viewable, err = renderAttributeView(attrView)
|
viewable, err = renderAttributeView(attrView)
|
||||||
return
|
return
|
||||||
|
|
@ -249,9 +249,11 @@ func RenderHistoryAttributeView(avID, created string) (viewable av.Viewable, att
|
||||||
historyDir := matches[0]
|
historyDir := matches[0]
|
||||||
avJSONPath := filepath.Join(historyDir, "storage", "av", avID+".json")
|
avJSONPath := filepath.Join(historyDir, "storage", "av", avID+".json")
|
||||||
if !gulu.File.IsExist(avJSONPath) {
|
if !gulu.File.IsExist(avJSONPath) {
|
||||||
return
|
avJSONPath = filepath.Join(util.DataDir, "storage", "av", avID+".json")
|
||||||
}
|
}
|
||||||
|
if !gulu.File.IsExist(avJSONPath) {
|
||||||
|
attrView = av.NewAttributeView(avID)
|
||||||
|
} else {
|
||||||
data, readErr := os.ReadFile(avJSONPath)
|
data, readErr := os.ReadFile(avJSONPath)
|
||||||
if nil != readErr {
|
if nil != readErr {
|
||||||
logging.LogErrorf("read attribute view [%s] failed: %s", avID, readErr)
|
logging.LogErrorf("read attribute view [%s] failed: %s", avID, readErr)
|
||||||
|
|
@ -263,6 +265,7 @@ func RenderHistoryAttributeView(avID, created string) (viewable av.Viewable, att
|
||||||
logging.LogErrorf("unmarshal attribute view [%s] failed: %s", avID, err)
|
logging.LogErrorf("unmarshal attribute view [%s] failed: %s", avID, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
viewable, err = renderAttributeView(attrView)
|
viewable, err = renderAttributeView(attrView)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue