feat(tui): mouse click for settings sections, column sort, logs panel
- Click Alerts/Nodes/Users sub-tabs in settings to switch sections - Click STATUS/NAME/LATENCY column headers to sort (click again to reverse direction) - Logs panel show/hide: [l] toggles sidebar visibility, click focused panel to hide. Monitors expand to full width when hidden. - Logs full-screen: Enter when focused on logs opens scrollable full-screen log view with severity tags, filter toggle [f], and live updates
This commit was merged in pull request #159.
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"gitea.lerkolabs.com/lerkolabs/uptop/internal/models"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
)
|
||||
|
||||
type logSeverity int
|
||||
@@ -72,6 +73,23 @@ func (m Model) renderLogLine(entry models.LogEntry) string {
|
||||
return fmt.Sprintf(" %s %s %s", ts, tag, entry.Message)
|
||||
}
|
||||
|
||||
func (m Model) viewLogsFullscreen() string {
|
||||
header := m.st.subtleStyle.Render(" Logs") + "\n" + m.divider()
|
||||
|
||||
filterLabel := m.st.subtleStyle.Render("[f] All")
|
||||
if m.logFilterImportant {
|
||||
filterLabel = m.st.subtleStyle.Render("[f] Important only")
|
||||
}
|
||||
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
|
||||
|
||||
m.logViewport.Width = m.termWidth - chromePadH
|
||||
m.logViewport.Height = m.termHeight - 8
|
||||
|
||||
return lipgloss.NewStyle().Padding(1, 2).Render(
|
||||
header + "\n" + m.logViewport.View() + "\n" + footer)
|
||||
}
|
||||
|
||||
func (m *Model) refreshLogContent() {
|
||||
var rendered []string
|
||||
total := 0
|
||||
|
||||
Reference in New Issue
Block a user