Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions pkg/configtui/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,32 @@ func (m *Model) DisableAllInSection() {
}
}

// EnableAllModels enables all models in both external and transformation sections.
func (m *Model) EnableAllModels() {
for i := range m.externalModels {
m.externalModels[i].Enabled = true
}

for i := range m.transformationModels {
m.transformationModels[i].Enabled = true
}

m.dirty = true
}

// DisableAllModels disables all models in both external and transformation sections.
func (m *Model) DisableAllModels() {
for i := range m.externalModels {
m.externalModels[i].Enabled = false
}

for i := range m.transformationModels {
m.transformationModels[i].Enabled = false
}

m.dirty = true
}

// GetSectionLength returns the number of items in the current section.
func (m *Model) GetSectionLength() int {
switch m.activeSection {
Expand Down
8 changes: 4 additions & 4 deletions pkg/configtui/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,16 @@ func (m Model) handleKeyPress(msg tea.KeyMsg) (tea.Model, tea.Cmd) {

case "a":
if m.activeSection != sectionEnv {
m.EnableAllInSection()
m.statusMsg = "Enabled all models in section"
m.EnableAllModels()
m.statusMsg = "Enabled all models"

return m, nil
}

case "n":
if m.activeSection != sectionEnv {
m.DisableAllInSection()
m.statusMsg = "Disabled all models in section"
m.DisableAllModels()
m.statusMsg = "Disabled all models"

return m, nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/configtui/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func (m Model) renderHelp() string {
case sectionEnv:
help = "[←/→] Switch section [↑/↓] Navigate [0-9] Type value [Backspace] Delete [s] Save [q] Quit"
default:
help = "[←/→] Switch section [↑/↓] Navigate [Space] Toggle [a] All on [n] All off [d] Enable deps [s] Save [q] Quit"
help = "[←/→] Switch section [↑/↓] Navigate [Space] Toggle [a] Enable all [n] Disable all [d] Enable deps [s] Save [q] Quit"
}
}

Expand Down