mirror of
https://github.com/mrusme/neonmodem.git
synced 2024-09-22 04:35:55 -04:00
Fixed system selection
This commit is contained in:
parent
8af4f3469e
commit
df99e56ee2
@ -74,7 +74,7 @@ func (m Model) View() string {
|
|||||||
curSysIdx := m.ctx.GetCurrentSystem()
|
curSysIdx := m.ctx.GetCurrentSystem()
|
||||||
var currentSystem string = "All"
|
var currentSystem string = "All"
|
||||||
if curSysIdx >= 0 {
|
if curSysIdx >= 0 {
|
||||||
currentSystem = string((*m.ctx.Systems[curSysIdx]).GetID())
|
currentSystem = (*m.ctx.Systems[curSysIdx]).Title()
|
||||||
}
|
}
|
||||||
|
|
||||||
systemSelector := selector.Render(fmt.Sprintf("⏷ %s", currentSystem))
|
systemSelector := selector.Render(fmt.Sprintf("⏷ %s", currentSystem))
|
||||||
|
11
ui/ui.go
11
ui/ui.go
@ -103,6 +103,11 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
return m, tea.Batch(ccmds...)
|
return m, tea.Batch(ccmds...)
|
||||||
case key.Matches(msg, m.keymap.SystemSelect):
|
case key.Matches(msg, m.keymap.SystemSelect):
|
||||||
var listItems []list.Item
|
var listItems []list.Item
|
||||||
|
|
||||||
|
all, _ := system.New("all", nil, m.ctx.Logger)
|
||||||
|
all.SetID(-1)
|
||||||
|
listItems = append(listItems, all)
|
||||||
|
|
||||||
for _, sys := range m.ctx.Systems {
|
for _, sys := range m.ctx.Systems {
|
||||||
listItems = append(listItems, *sys)
|
listItems = append(listItems, *sys)
|
||||||
}
|
}
|
||||||
@ -185,7 +190,11 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
case postcreate.WIN_ID:
|
case postcreate.WIN_ID:
|
||||||
m.ctx.Logger.Debugln("received WinClose")
|
m.ctx.Logger.Debugln("received WinClose")
|
||||||
case popuplist.WIN_ID:
|
case popuplist.WIN_ID:
|
||||||
switch msg.GetArg("selectionID").(string) {
|
selectionIDIf := msg.GetArg("selectionID")
|
||||||
|
if selectionIDIf == nil {
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
switch selectionIDIf.(string) {
|
||||||
case "system":
|
case "system":
|
||||||
selected := msg.GetArg("selected").(system.System)
|
selected := msg.GetArg("selected").(system.System)
|
||||||
m.ctx.SetCurrentSystem(selected.GetID())
|
m.ctx.SetCurrentSystem(selected.GetID())
|
||||||
|
Loading…
Reference in New Issue
Block a user