🎨 Database table view breadcrumb

This commit is contained in:
Daniel 2023-10-14 10:51:46 +08:00
parent 6b1a2925c9
commit d78a0205f5
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 23 additions and 0 deletions

View file

@ -304,6 +304,8 @@ func buildBlockBreadcrumb(node *ast.Node, excludeTypes []string) (ret []*BlockPa
name := util.EscapeHTML(parent.IALAttr("name"))
if ast.NodeDocument == parent.Type {
name = util.EscapeHTML(box.Name) + util.EscapeHTML(hPath)
} else if ast.NodeAttributeView == parent.Type {
name = treenode.GetAttributeViewName(parent.AttributeViewID)
} else {
if "" == name {
if ast.NodeListItem == parent.Type {

View file

@ -475,6 +475,27 @@ func IsChartCodeBlockCode(code *ast.Node) bool {
return render.NoHighlight(language)
}
func GetAttributeViewName(avID string) (name string) {
if "" == avID {
return
}
attrView, err := av.ParseAttributeView(avID)
if nil != err {
logging.LogErrorf("parse attribute view [%s] failed: %s", avID, err)
return
}
buf := bytes.Buffer{}
for _, v := range attrView.Views {
buf.WriteString(v.Name)
buf.WriteByte(' ')
}
name = strings.TrimSpace(buf.String())
return
}
func getAttributeViewContent(avID string) (content string) {
if "" == avID {
return