mirror of
https://github.com/lukaszraczylo/kportal.git
synced 2026-06-09 23:59:45 +00:00
96ae1d45e0
- [x] Add golangci-lint configuration with gocritic ifElseChain disabled
- [x] Rename error variables to avoid shadowing (createErr, watcherErr, watchErr, etc.)
- [x] Replace `interface{}` with `any` type alias throughout codebase
- [x] Add package-level documentation comments to all internal packages
- [x] Reorder struct fields alphabetically for consistency
- [x] Extract UI constants (terminal dimensions, column widths, colors) to constants.go
- [x] Refactor BubbleTeaUI main view rendering into smaller helper functions
- [x] Simplify nested conditionals and improve code clarity
- [x] Add `isForwardDisabled()` helper method to BubbleTeaUI
- [x] Update file permissions from 0644 to 0600 in config tests
- [x] Add `#nosec` comments and error suppression where appropriate
- [x] Improve test table struct field ordering for readability
- [x] Fix resource parsing in AddForward using strings.SplitN
- [x] Add comprehensive tests for new UI helper functions and constants
46 lines
1000 B
Go
46 lines
1000 B
Go
package ui
|
|
|
|
// Terminal dimension constants
|
|
const (
|
|
// DefaultTermWidth is the fallback terminal width when not detected
|
|
DefaultTermWidth = 120
|
|
|
|
// DefaultTermHeight is the fallback terminal height when not detected
|
|
DefaultTermHeight = 40
|
|
)
|
|
|
|
// Table column constants
|
|
const (
|
|
// Column indices in the forwards table
|
|
ColumnContext = 0
|
|
ColumnNamespace = 1
|
|
ColumnAlias = 2
|
|
ColumnType = 3
|
|
ColumnResource = 4
|
|
ColumnRemote = 5
|
|
ColumnLocal = 6
|
|
ColumnStatus = 7
|
|
|
|
// Column widths for truncation
|
|
ColumnWidthContext = 14
|
|
ColumnWidthNamespace = 16
|
|
ColumnWidthAlias = 18
|
|
ColumnWidthType = 8
|
|
ColumnWidthResource = 20
|
|
|
|
// Error display widths
|
|
ErrorDisplayWidth = 118 // Slightly less than table width (120) for padding
|
|
)
|
|
|
|
// Viewport constants
|
|
const (
|
|
// ViewportHeight is the number of items visible in list views
|
|
ViewportHeight = 20
|
|
)
|
|
|
|
// Path display constants
|
|
const (
|
|
// MaxPathWidth is the maximum width for displaying file paths
|
|
MaxPathWidth = 48
|
|
)
|