feat(tui): responsive table layout for all tabs
Extract shared computeTableLayout() into table_helpers.go — takes column definitions with short/full headers, min/max widths, and a flex column that absorbs surplus space. All tabs now use it: - Alerts: CONFIG column is flex, NAME/TYPE/SENT expand with width - Maint: TITLE column is flex, TYPE/MONITORS/STATUS/dates expand - Nodes: NAME column is flex, REGION/LAST SEEN/VERSION expand - Users: PUBLIC KEY column is flex, USERNAME expands - Sites: uses same colDef type (keeps special dual-flex for NAME+HISTORY) Headers auto-switch short/full based on available width across all tabs.
This commit is contained in:
@@ -341,23 +341,16 @@ type tableLayout struct {
|
||||
}
|
||||
|
||||
func (m Model) computeLayout() tableLayout {
|
||||
type colDef struct {
|
||||
short string
|
||||
full string
|
||||
minWidth int
|
||||
maxWidth int
|
||||
}
|
||||
|
||||
cols := []colDef{
|
||||
{"#", "#", 4, 4},
|
||||
{"", "", 0, 0}, // NAME (dynamic)
|
||||
{"TYPE", "TYPE", 8, 10},
|
||||
{"STATUS", "STATUS", 8, 10},
|
||||
{"LAT", "LATENCY", 7, 10},
|
||||
{"UP%", "UPTIME", 8, 8},
|
||||
{"", "", 0, 0}, // HISTORY (dynamic)
|
||||
{"SSL", "SSL", 5, 5},
|
||||
{"RT", "RETRIES", 5, 9},
|
||||
{"#", "#", 4, 4, false},
|
||||
{"", "", 0, 0, false}, // NAME (special)
|
||||
{"TYPE", "TYPE", 8, 10, false},
|
||||
{"STATUS", "STATUS", 8, 10, false},
|
||||
{"LAT", "LATENCY", 7, 10, false},
|
||||
{"UP%", "UPTIME", 8, 8, false},
|
||||
{"", "", 0, 0, false}, // HISTORY (special)
|
||||
{"SSL", "SSL", 5, 5, false},
|
||||
{"RT", "RETRIES", 5, 9, false},
|
||||
}
|
||||
|
||||
numCols := len(cols)
|
||||
|
||||
Reference in New Issue
Block a user