mirror of
https://github.com/Adembc/lazyssh.git
synced 2026-07-14 12:13:34 +02:00
add pin and sort feature
This commit is contained in:
@@ -45,6 +45,7 @@ type tui struct {
|
||||
left *tview.Flex
|
||||
content *tview.Flex
|
||||
|
||||
sortMode SortMode
|
||||
searchVisible bool
|
||||
}
|
||||
|
||||
@@ -97,6 +98,10 @@ func (t *tui) buildComponents() *tui {
|
||||
OnSelectionChange(t.handleServerSelectionChange)
|
||||
t.details = NewServerDetails()
|
||||
t.statusBar = NewStatusBar()
|
||||
|
||||
// default sort mode
|
||||
t.sortMode = SortByAliasAsc
|
||||
|
||||
return t
|
||||
}
|
||||
|
||||
@@ -126,11 +131,19 @@ func (t *tui) bindEvents() *tui {
|
||||
|
||||
func (t *tui) loadInitialData() *tui {
|
||||
servers, _ := t.serverService.ListServers("")
|
||||
sortServersForUI(servers, t.sortMode)
|
||||
t.updateListTitle()
|
||||
t.serverList.UpdateServers(servers)
|
||||
|
||||
return t
|
||||
}
|
||||
|
||||
func (t *tui) updateListTitle() {
|
||||
if t.serverList != nil {
|
||||
t.serverList.SetTitle("Servers — Sort: " + t.sortMode.String())
|
||||
}
|
||||
}
|
||||
|
||||
func (t *tui) loadSplashScreen() *tui {
|
||||
splash, stop := buildSplash(t.app)
|
||||
t.app.SetRoot(splash, true)
|
||||
|
||||
Reference in New Issue
Block a user