Skip to content

Commit 0e2787c

Browse files
committed
feat(browser_lb): fixed naviagiton in 7rules detail and health monitor
Signed-off-by: olivier dubo <olivier.dubo@ovhcloud.com>
1 parent 8b98af2 commit 0e2787c

2 files changed

Lines changed: 241 additions & 77 deletions

File tree

internal/services/browser/lb_health_monitor_wizard.go

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -63,30 +63,40 @@ func (m Model) renderLBHealthMonitorView(width int) string {
6363
labelSt := lipgloss.NewStyle().Foreground(lipgloss.Color("#888888")).Width(22)
6464
valueSt := lipgloss.NewStyle().Foreground(lipgloss.Color("#FFFFFF"))
6565

66-
// Actions bar
67-
var actionsContent string
68-
if hm != nil {
69-
editBtn := lipgloss.NewStyle().
70-
Background(lipgloss.Color("#7B68EE")).Foreground(lipgloss.Color("#FFFFFF")).
71-
Bold(true).Padding(0, 1).Render("✏ Edit [e]")
72-
var deleteBtnContent string
73-
if m.lbHMConfirm {
74-
deleteBtnContent = lipgloss.NewStyle().
75-
Background(lipgloss.Color("#FF4444")).Foreground(lipgloss.Color("#FFFFFF")).
76-
Bold(true).Padding(0, 1).Render("⚠ Confirm delete? Press [d] again • Esc to cancel")
77-
} else {
78-
deleteBtnContent = lipgloss.NewStyle().
79-
Background(lipgloss.Color("#CC3333")).Foreground(lipgloss.Color("#FFFFFF")).
80-
Bold(true).Padding(0, 1).Render("🗑 Delete [d]")
81-
}
82-
actionsContent = lipgloss.JoinHorizontal(lipgloss.Top, editBtn, " ", deleteBtnContent)
83-
} else {
84-
createBtn := lipgloss.NewStyle().
85-
Background(lipgloss.Color("#00AA55")).Foreground(lipgloss.Color("#FFFFFF")).
86-
Bold(true).Padding(0, 1).Render("+ Create [Enter]")
87-
actionsContent = createBtn
88-
}
89-
actionsBox := renderBox("Actions", actionsContent, width-4)
66+
// Actions bar — navigate with ←/→, execute with Enter
67+
var actionsContent string
68+
if hm != nil {
69+
actions := []string{"✏ Edit", "🗑 Delete"}
70+
actionIdx := m.lbHMActionIdx
71+
if actionIdx >= len(actions) {
72+
actionIdx = 0
73+
}
74+
var actionParts []string
75+
for i, act := range actions {
76+
if i == actionIdx {
77+
bg := lipgloss.Color("#7B68EE")
78+
if i == 1 {
79+
bg = lipgloss.Color("#FF4444")
80+
}
81+
actionParts = append(actionParts, lipgloss.NewStyle().
82+
Background(bg).Foreground(lipgloss.Color("#FFFFFF")).Bold(true).Padding(0, 1).Render(act))
83+
} else {
84+
actionParts = append(actionParts, lipgloss.NewStyle().
85+
Foreground(lipgloss.Color("#888888")).Padding(0, 1).Render("["+act+"]"))
86+
}
87+
}
88+
actionsContent = strings.Join(actionParts, " ")
89+
if m.lbHMConfirm {
90+
actionsContent += "\n\n" + lipgloss.NewStyle().
91+
Foreground(lipgloss.Color("#FFD700")).Bold(true).
92+
Render("⚠️ Press Enter to confirm delete, Esc to cancel")
93+
}
94+
} else {
95+
// No HM yet — only Create
96+
createSt := lipgloss.NewStyle().Background(lipgloss.Color("#00AA55")).Foreground(lipgloss.Color("#FFFFFF")).Bold(true).Padding(0, 1)
97+
actionsContent = createSt.Render("+ Create")
98+
}
99+
actionsBox := renderBox("Actions (←/→ to navigate, Enter to execute)", actionsContent, width-4)
90100
content.WriteString(actionsBox + "\n\n")
91101

92102
titleLine := fmt.Sprintf("Health Monitor — Pool: %s", poolName)

0 commit comments

Comments
 (0)