Fix Tree Browser
This commit is contained in:
@@ -112,6 +112,7 @@ func (s *ScreenHome) Init(a *App) {
|
||||
s.pdsListing.SetOnSelect(s.selectPdsListingEntry)
|
||||
s.pdsListing.SetOnChange(s.changePdsList)
|
||||
s.pdsListing.SetVimMode(viper.GetBool(data.KeyVimMode))
|
||||
s.pdsListing.SetLogger(s.Log)
|
||||
|
||||
s.jsonContent = wd.NewJsonContent("jsoncontent", s.style)
|
||||
km := s.jsonContent.GetKeyMap()
|
||||
@@ -151,6 +152,8 @@ func (s *ScreenHome) Init(a *App) {
|
||||
s.layout.AddAll(s.columns)
|
||||
s.layout.SetWeight(s.columns, 4)
|
||||
s.menuLayout.SetWidget(s.layout)
|
||||
s.layout.SetLogger(s.Log)
|
||||
s.columns.SetLogger(s.Log)
|
||||
}
|
||||
|
||||
func (s *ScreenHome) GetName() string { return "home" }
|
||||
@@ -182,7 +185,6 @@ func (s *ScreenHome) HandleKey(ev *tcell.EventKey) bool {
|
||||
}
|
||||
return s.openPdsEntry.HandleKey(ev)
|
||||
}
|
||||
|
||||
return s.menuLayout.HandleKey(ev)
|
||||
}
|
||||
func (s *ScreenHome) HandleTime(ev *tcell.EventTime) {
|
||||
@@ -330,6 +332,9 @@ func (s *ScreenHome) cliGetPds(args ...string) bool {
|
||||
if err == nil && n != nil {
|
||||
s.changePdsList(n)
|
||||
}
|
||||
|
||||
s.layout.ActivateWidget(s.columns)
|
||||
s.columns.ActivateWidget(s.pdsListing)
|
||||
s.isLoading = false
|
||||
}()
|
||||
return true
|
||||
@@ -372,6 +377,13 @@ func (s *ScreenHome) selectPdsListingEntry(tn *wd.TreeNode) bool {
|
||||
if !s.updateJsonView(tn) {
|
||||
return false
|
||||
}
|
||||
if tn.HasChildren() {
|
||||
tn.ToggleExpand()
|
||||
s.pdsListing.UpdateList()
|
||||
} else {
|
||||
s.columns.ActivateWidget(s.jsonContent)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -381,7 +393,11 @@ func (s *ScreenHome) changePdsList(tn *wd.TreeNode) bool {
|
||||
return upd
|
||||
}
|
||||
func (s *ScreenHome) updateStatusPathBlock(tn *wd.TreeNode) bool {
|
||||
// TODO: UpdateStatusPathBlock
|
||||
n, err := s.pdsListing.GetActiveNode()
|
||||
if err != nil || n == nil {
|
||||
return false
|
||||
}
|
||||
s.stPathBlock.SetParts(n.GetLabelPath())
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -414,25 +430,6 @@ func (s *ScreenHome) o_selectPdsListingEntry(idx int, nm string) bool {
|
||||
|
||||
return false
|
||||
}
|
||||
func (s *ScreenHome) o_changePdsList(idx int, nm string) bool {
|
||||
upd := s.o_updateJsonView(idx, nm)
|
||||
upd = s.o_updateStatusPathBlock(idx, nm)
|
||||
return upd
|
||||
}
|
||||
func (s *ScreenHome) o_updateStatusPathBlock(idx int, nm string) bool {
|
||||
if len(s.pdsListingTypes) < idx {
|
||||
s.Log("error finding pds listing type (idx: %d >= list length: %d", idx, len(s.pdsListingTypes))
|
||||
return false
|
||||
}
|
||||
switch s.pdsListingTypes[idx] {
|
||||
case models.TypeNSID:
|
||||
s.stPathBlock.SetParts([]string{s.activePds.AtId.String(), nm})
|
||||
case models.TypeRecord:
|
||||
nsidNm := s.activePds.GetNSIDForRecordId(nm).String()
|
||||
s.stPathBlock.SetParts([]string{s.activePds.AtId.String(), nsidNm, nm})
|
||||
}
|
||||
return true
|
||||
}
|
||||
func (s *ScreenHome) o_updateJsonView(idx int, nm string) bool {
|
||||
if len(s.pdsListingTypes) < idx {
|
||||
s.Log("error finding pds listing type (idx: %d >= list length: %d", idx, len(s.pdsListingTypes))
|
||||
|
||||
Reference in New Issue
Block a user