fix(tui): correct delete confirm labels, normalize help text
Delete confirmation dialog used wrong magic numbers for entity kind mapping — maintenance windows showed as "alert", settings deletions showed as "monitor". Now uses tab/section constants to match correctly. Also: consistent [q/Esc] Back across all views (detail inline, logs, SLA, history headers), extract detailKeys(), remove dead maxSections variable, add nodes empty state hint, use models.Status constants in siteOrder, delete orphaned theme.png.
This commit was merged in pull request #160.
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 312 KiB |
@@ -49,13 +49,13 @@ func siteOrder(s models.Site) int {
|
|||||||
return 3
|
return 3
|
||||||
}
|
}
|
||||||
switch s.Status {
|
switch s.Status {
|
||||||
case "DOWN", "SSL EXP":
|
case models.StatusDown, models.StatusSSLExp:
|
||||||
return 0
|
return 0
|
||||||
case "STALE":
|
case models.StatusStale:
|
||||||
return 1
|
return 1
|
||||||
case "LATE":
|
case models.StatusLate:
|
||||||
return 1
|
return 1
|
||||||
case "PENDING":
|
case models.StatusPending:
|
||||||
return 3
|
return 3
|
||||||
default:
|
default:
|
||||||
return 2
|
return 2
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ func (m Model) viewLogsFullscreen() string {
|
|||||||
filterLabel = m.st.subtleStyle.Render("[f] Important only")
|
filterLabel = m.st.subtleStyle.Render("[f] Important only")
|
||||||
}
|
}
|
||||||
countLabel := m.st.subtleStyle.Render(fmt.Sprintf("%d/%d", m.logShown, m.logTotal))
|
countLabel := m.st.subtleStyle.Render(fmt.Sprintf("%d/%d", m.logShown, m.logTotal))
|
||||||
footer := m.divider() + "\n " + m.st.subtleStyle.Render("[Esc] Back") + " " + filterLabel + " " + countLabel
|
footer := m.divider() + "\n " + m.st.subtleStyle.Render("[q/Esc] Back") + " " + filterLabel + " " + countLabel
|
||||||
|
|
||||||
m.logViewport.Width = m.termWidth - chromePadH
|
m.logViewport.Width = m.termWidth - chromePadH
|
||||||
m.logViewport.Height = m.termHeight - 8
|
m.logViewport.Height = m.termHeight - 8
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (m Model) viewNodesTab() string {
|
func (m Model) viewNodesTab() string {
|
||||||
if len(m.nodes) == 0 {
|
if len(m.nodes) == 0 {
|
||||||
return m.emptyState("No probe nodes connected.", "")
|
return m.emptyState("No probe nodes connected.", "Probes auto-register on connection.")
|
||||||
}
|
}
|
||||||
|
|
||||||
var headers []string
|
var headers []string
|
||||||
|
|||||||
@@ -7,16 +7,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (m Model) viewSettingsTab() string {
|
func (m Model) viewSettingsTab() string {
|
||||||
maxSections := 2
|
|
||||||
if m.isAdmin {
|
|
||||||
maxSections = 3
|
|
||||||
}
|
|
||||||
|
|
||||||
sections := []string{"Alerts", "Nodes"}
|
sections := []string{"Alerts", "Nodes"}
|
||||||
if m.isAdmin {
|
if m.isAdmin {
|
||||||
sections = append(sections, "Users")
|
sections = append(sections, "Users")
|
||||||
}
|
}
|
||||||
_ = maxSections
|
|
||||||
|
|
||||||
var tabs []string
|
var tabs []string
|
||||||
for i, name := range sections {
|
for i, name := range sections {
|
||||||
|
|||||||
@@ -48,13 +48,16 @@ func (m Model) View() string {
|
|||||||
case stateConfirmDelete:
|
case stateConfirmDelete:
|
||||||
kind := "monitor"
|
kind := "monitor"
|
||||||
switch m.deleteTab {
|
switch m.deleteTab {
|
||||||
case 1:
|
case tabMaint:
|
||||||
kind = "alert"
|
|
||||||
case 4:
|
|
||||||
kind = "maintenance window"
|
kind = "maintenance window"
|
||||||
case 5:
|
case tabSettings:
|
||||||
|
switch m.settingsSection {
|
||||||
|
case sectionAlerts:
|
||||||
|
kind = "alert"
|
||||||
|
case sectionUsers:
|
||||||
kind = "user"
|
kind = "user"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
msg := m.st.dangerStyle.Render(fmt.Sprintf("Delete %s \"%s\"?", kind, m.deleteName))
|
msg := m.st.dangerStyle.Render(fmt.Sprintf("Delete %s \"%s\"?", kind, m.deleteName))
|
||||||
hint := m.st.subtleStyle.Render("[y] Confirm [n] Cancel")
|
hint := m.st.subtleStyle.Render("[y] Confirm [n] Cancel")
|
||||||
box := lipgloss.NewStyle().
|
box := lipgloss.NewStyle().
|
||||||
|
|||||||
@@ -57,8 +57,7 @@ func (m Model) viewDetailTwoCol(site models.Site, hist monitor.SiteHistory, widt
|
|||||||
b.WriteString(l + " " + divChar + " " + r + "\n")
|
b.WriteString(l + " " + divChar + " " + r + "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
keys := m.st.subtleStyle.Render("[h] History [s] SLA [e] Edit [esc] Close")
|
b.WriteString(" " + m.detailKeys() + "\n")
|
||||||
b.WriteString(" " + keys + "\n")
|
|
||||||
|
|
||||||
return lipgloss.NewStyle().Width(width).MaxWidth(width).Render(b.String())
|
return lipgloss.NewStyle().Width(width).MaxWidth(width).Render(b.String())
|
||||||
}
|
}
|
||||||
@@ -293,12 +292,15 @@ func (m Model) viewDetailSingleCol(site models.Site, hist monitor.SiteHistory, w
|
|||||||
b.WriteString(" " + m.st.subtleStyle.Render("30d") + " " + m.uptimeTimeline(m.detailDailyDays, timelineW) + "\n")
|
b.WriteString(" " + m.st.subtleStyle.Render("30d") + " " + m.uptimeTimeline(m.detailDailyDays, timelineW) + "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
keys := m.st.subtleStyle.Render("[h] History [s] SLA [e] Edit [esc] Close")
|
b.WriteString(" " + m.detailKeys() + "\n")
|
||||||
b.WriteString(" " + keys + "\n")
|
|
||||||
|
|
||||||
return lipgloss.NewStyle().Width(width).MaxWidth(width).Render(b.String())
|
return lipgloss.NewStyle().Width(width).MaxWidth(width).Render(b.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m Model) detailKeys() string {
|
||||||
|
return m.st.subtleStyle.Render("[h] History [s] SLA [e] Edit [q/Esc] Back")
|
||||||
|
}
|
||||||
|
|
||||||
func (m Model) fmtStatusWord(status string) string {
|
func (m Model) fmtStatusWord(status string) string {
|
||||||
switch status {
|
switch status {
|
||||||
case "DOWN":
|
case "DOWN":
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ func (m Model) viewHistoryPanel() string {
|
|||||||
var b strings.Builder
|
var b strings.Builder
|
||||||
|
|
||||||
header := " " + m.st.titleStyle.Render("STATE HISTORY: "+m.historySiteName)
|
header := " " + m.st.titleStyle.Render("STATE HISTORY: "+m.historySiteName)
|
||||||
header += " " + m.st.subtleStyle.Render("[q] Back")
|
header += " " + m.st.subtleStyle.Render("[q/Esc] Back")
|
||||||
b.WriteString(header + "\n")
|
b.WriteString(header + "\n")
|
||||||
|
|
||||||
divWidth := m.dividerWidth()
|
divWidth := m.dividerWidth()
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func (m Model) viewSLAPanel() string {
|
|||||||
var b strings.Builder
|
var b strings.Builder
|
||||||
|
|
||||||
header := " " + m.st.titleStyle.Render("SLA REPORT: "+m.slaSiteName)
|
header := " " + m.st.titleStyle.Render("SLA REPORT: "+m.slaSiteName)
|
||||||
header += " " + m.st.subtleStyle.Render("[q] Back")
|
header += " " + m.st.subtleStyle.Render("[q/Esc] Back")
|
||||||
b.WriteString(header + "\n")
|
b.WriteString(header + "\n")
|
||||||
b.WriteString(m.divider() + "\n")
|
b.WriteString(m.divider() + "\n")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user