Skip to content

Commit

Permalink
🎨 Database table view breadcrumb
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Oct 14, 2023
1 parent 6b1a292 commit d78a020
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kernel/model/blockinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
21 changes: 21 additions & 0 deletions kernel/treenode/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d78a020

Please sign in to comment.