mirror of
https://github.com/lukaszraczylo/kportal.git
synced 2026-10-20 05:32:50 +00:00
Allow configuring forwards-table columns, order, and width (#82)
* Allow configuring forwards-table columns, order, and width Adds an optional tui.columns section to .kportal.yaml so the visible columns, their order, and their widths can be customized instead of always rendering the hardcoded 8-column layout. Omitting the section keeps the existing default columns/order/widths. Closes #81 * fix(ui): keep the plain table layout and check column widths The plain verbose table must look the same when no tui section is set. It had narrower columns and shorter port headers than before. The default layout is now identical to the old one, and a golden test guards it. A status column that is not last now pads by visible width. Table rules follow the column widths. The UI applies new columns only after a reload succeeds, including the SIGHUP path of the verbose table. The validator rejects a column width above 200. The README describes the tui.columns setting. Refs #81 * fix(httplog): replace the deprecated ReverseProxy Director with Rewrite Staticcheck reports SA1019 because Go 1.26 deprecates Director. The proxy now sets the target in a Rewrite function. Rewrite drops the X-Forwarded-For header that Director sent, so the function calls SetXForwarded to keep that header. A new test checks the target port, the path and the header. * fix(release): drop the deprecated cask url verified key Homebrew warns about the verified parameter of the cask url stanza. The setting is not needed. GoReleaser check now passes without a deprecation warning. The postflight warning remains. GoReleaser generates it from the post install hook, and the upstream fix is not released yet. Refs #79 --------- Co-authored-by: Lukasz Raczylo <[email protected]>
This commit is contained in:
@@ -60,9 +60,29 @@ type Config struct {
|
||||
HealthCheck *HealthCheckSpec `yaml:"healthCheck,omitempty"`
|
||||
Reliability *ReliabilitySpec `yaml:"reliability,omitempty"`
|
||||
MDNS *MDNSSpec `yaml:"mdns,omitempty"`
|
||||
TUI *TUISpec `yaml:"tui,omitempty"`
|
||||
Contexts []Context `yaml:"contexts"`
|
||||
}
|
||||
|
||||
// TUISpec configures the terminal UI table display
|
||||
type TUISpec struct {
|
||||
// Columns lists the forwards-table columns to display, in the order they
|
||||
// should appear. Omitting this field (or leaving it empty) keeps the
|
||||
// built-in default column set and order. Any column not listed here is
|
||||
// hidden.
|
||||
Columns []TableColumn `yaml:"columns,omitempty"`
|
||||
}
|
||||
|
||||
// TableColumn configures a single column of the forwards table.
|
||||
type TableColumn struct {
|
||||
// Name is the column identifier: context, namespace, alias, type,
|
||||
// resource, remote, local, or status.
|
||||
Name string `yaml:"name"`
|
||||
// Width is the maximum display width for the column, in characters.
|
||||
// If zero or omitted, the column's built-in default width is used.
|
||||
Width int `yaml:"width,omitempty"`
|
||||
}
|
||||
|
||||
// MDNSSpec configures mDNS (multicast DNS) hostname publishing
|
||||
// When enabled, forwards with aliases can be accessed via <alias>.local hostnames
|
||||
type MDNSSpec struct {
|
||||
@@ -174,6 +194,15 @@ func (c *Config) IsMDNSEnabled() bool {
|
||||
return c.MDNS != nil && c.MDNS.Enabled
|
||||
}
|
||||
|
||||
// GetTableColumns returns the configured TUI table columns, or nil if the
|
||||
// built-in default column set and order should be used.
|
||||
func (c *Config) GetTableColumns() []TableColumn {
|
||||
if c == nil || c.TUI == nil || len(c.TUI.Columns) == 0 {
|
||||
return nil
|
||||
}
|
||||
return c.TUI.Columns
|
||||
}
|
||||
|
||||
// Context represents a Kubernetes context with its namespaces
|
||||
type Context struct {
|
||||
Name string `yaml:"name"`
|
||||
|
||||
Reference in New Issue
Block a user