MCPcopy Create free account
hub / github.com/Macmod/godap / renderPartialTree

Function renderPartialTree

tui/tree.go:942–986  ·  view source on GitHub ↗
(rootDN string, searchFilter string)

Source from the content-addressed store, hash-verified

940}
941
942func renderPartialTree(rootDN string, searchFilter string) *tview.TreeNode {
943 rootEntry, err := lc.QueryWithAttrs(rootDN, "(objectClass=*)", ldap.ScopeBaseObject, Deleted, parseAttrsList(explorerAttrsList))
944 if err != nil {
945 handleLDAPError(err)
946 return nil
947 }
948
949 if len(rootEntry) != 1 {
950 updateLog("Root entry not found.", "red")
951 return nil
952 }
953
954 explorerCache.Add(rootDN, rootEntry[0])
955
956 rootNodeName := getNodeName(rootEntry[0])
957
958 rootNode = tview.NewTreeNode(rootNodeName).
959 SetReference(rootDN).
960 SetSelectable(true)
961
962 if rootDN == "" {
963 return rootNode
964 }
965
966 var rootEntries []*ldap.Entry
967 rootEntries, err = lc.QueryWithAttrs(rootDN, searchFilter, ldap.ScopeSingleLevel, Deleted, parseAttrsList(explorerAttrsList))
968 if err != nil {
969 handleLDAPError(err)
970 return nil
971 }
972
973 // Sort results to guarantee stable view
974 sort.Slice(rootEntries, func(i int, j int) bool {
975 return getName(rootEntries[i]) < getName(rootEntries[j])
976 })
977
978 for _, entry := range rootEntries {
979 node := createTreeNodeFromEntry(entry)
980 if node != nil {
981 rootNode.AddChild(node)
982 }
983 }
984
985 return rootNode
986}
987
988func reloadExplorerPage() {
989 explorerAttrsPanel.Clear()

Callers 2

reloadExplorerPageFunction · 0.85
initExplorerPageFunction · 0.85

Calls 8

parseAttrsListFunction · 0.85
handleLDAPErrorFunction · 0.85
updateLogFunction · 0.85
getNodeNameFunction · 0.85
getNameFunction · 0.85
createTreeNodeFromEntryFunction · 0.85
QueryWithAttrsMethod · 0.80
AddMethod · 0.80

Tested by

no test coverage detected