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

Function initExplorerPage

tui/explorer.go:25–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23)
24
25func initExplorerPage() {
26 explorerCache = EntryCache{
27 entries: make(map[string]*ldap.Entry),
28 }
29
30 explorerBaseDN = lc.DefaultRootDN
31
32 treePanel = tview.NewTreeView()
33
34 rootNode = renderPartialTree(explorerBaseDN, SearchFilter)
35 treePanel.SetRoot(rootNode).SetCurrentNode(rootNode)
36
37 explorerAttrsPanel = tview.NewTable().SetSelectable(true, true)
38
39 explorerAttrsPanel.
40 SetEvaluateAllRows(true).
41 SetTitle("Attributes").
42 SetBorder(true)
43
44 // Event Handlers
45 treeFlex = tview.NewFlex().SetDirection(tview.FlexRow).
46 AddItem(treePanel, 0, 1, false)
47
48 treeFlex.SetBorder(true)
49 treeFlex.SetTitle("Tree View")
50 explorerPage = tview.NewFlex().SetDirection(tview.FlexRow).
51 AddItem(
52 tview.NewFlex().
53 AddItem(treeFlex, 0, 1, false).
54 AddItem(explorerAttrsPanel, 0, 1, false), 0, 1, false,
55 )
56
57 explorerPage.SetInputCapture(explorerPageKeyHandler)
58
59 explorerAttrsPanel.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
60 currentNode := treePanel.GetCurrentNode()
61 if currentNode == nil || currentNode.GetReference() == nil {
62 return event
63 }
64 return attrsPanelKeyHandler(event, currentNode, &explorerCache, explorerAttrsPanel)
65 })
66
67 explorerAttrsPanel.SetSelectionChangedFunc(storeAnchoredAttribute(explorerAttrsPanel))
68
69 treePanel.SetInputCapture(treePanelKeyHandler)
70
71 treePanel.SetChangedFunc(treePanelChangeHandler)
72}
73
74func expandTreeNode(node *tview.TreeNode) {
75 if !node.IsExpanded() {

Callers 1

SetupAppFunction · 0.85

Calls 3

renderPartialTreeFunction · 0.85
attrsPanelKeyHandlerFunction · 0.85
storeAnchoredAttributeFunction · 0.85

Tested by

no test coverage detected