Added defaultsToFullScreen flag for Live/Details view,logs (#2516)

* Added fullScreen flag for LiveView, updated readme.md

* Added fullScreenLView default value for tests

* Extended DefaultsToFullScreen to include logView and DetailsView
mine
Adam Sranko 2024-02-03 15:54:38 +01:00 committed by GitHub
parent a1e94856ba
commit 3c20f0d5a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 49 additions and 31 deletions

View File

@ -385,16 +385,27 @@ K9s uses aliases to navigate most K8s resources.
refreshRate: 2
# Number of retries once the connection to the api-server is lost. Default 15.
maxConnRetry: 5
# Enable mouse support. Default false
enableMouse: true
# Set to true to hide K9s header. Default false
headless: false
# Set to true to hide K9s crumbs. Default false
crumbsless: false
# Indicates whether modification commands like delete/kill/edit are disabled. Default is false
readOnly: false
# Toggles whether k9s should exit when CTRL-C is pressed. When set to true, you will need to exist k9s via the :quit command. Default is false.
noExitOnCtrlC: false
#UI settings
ui:
# Enable mouse support. Default false
enableMouse: false
# Set to true to hide K9s header. Default false
headless: false
# Set to true to hide the K9S logo Default false
logoless: false
# Set to true to hide K9s crumbs. Default false
crumbsless: false
noIcons: false
# Toggles reactive UI. This option provide for watching on disk artifacts changes and update the UI live Defaults to false.
reactive: false
# By default all contexts wil use the dracula skin unless explicitly overridden in the context config file.
skin: dracula # => assumes the file skins/dracula.yaml is present in the $XDG_DATA_HOME/k9s/skins directory
# Allows to set certain views default fullscreen mode. (yaml, helm history, describe, value_extender, details, logs) Default false
defaultsToFullScreen: false
# Toggles icons display as not all terminal support these chars.
noIcons: false
# Toggles whether k9s should check for the latest revision from the Github repository releases. Default is false.
@ -409,8 +420,6 @@ K9s uses aliases to navigate most K8s resources.
buffer: 500
# Represents how far to go back in the log timeline in seconds. Setting to -1 will tail logs. Default is -1.
sinceSeconds: 300 # => tail the last 5 mins.
# Go full screen while displaying logs. Default false
fullScreenLogs: false
# Toggles log line wrap. Default false
textWrap: false
# Toggles log line timestamp info. Default false
@ -912,6 +921,7 @@ k9s:
reactive: false
# By default all contexts wil use the dracula skin unless explicitly overridden in the context config file.
skin: dracula # => assumes the file skins/dracula.yaml is present in the $XDG_DATA_HOME/k9s/skins directory
defaultsToFullScreen: false
skipLatestRevCheck: false
disablePodCounting: false
shellPod:
@ -929,7 +939,6 @@ k9s:
tail: 100
buffer: 5000
sinceSeconds: -1
fullScreen: false
textWrap: false
showTime: false
thresholds:

View File

@ -25,7 +25,8 @@
"crumbsless": {"type": "boolean"},
"noIcons": {"type": "boolean"},
"reactive": {"type": "boolean"},
"skin": {"type": "string"}
"skin": {"type": "string"},
"defaultsToFullScreen": {"type": "boolean"}
}
},
"shellPod": {
@ -101,7 +102,6 @@
"tail": {"type": "integer"},
"buffer": {"type": "integer"},
"sinceSeconds": {"type": "integer"},
"fullScreen": {"type": "boolean"},
"textWrap": {"type": "boolean"},
"showTime": {"type": "boolean"}
}

View File

@ -28,7 +28,6 @@ k9s:
tail: 100
buffer: 5000
sinceSeconds: -1
fullScreen: false
textWrap: false
showTime: false
thresholds:

View File

@ -22,7 +22,6 @@ k9s:
tail: 100
buffer: 5000
sinceSeconds: -1
fullScreen: false
textWrap: false
showTime: false
thresholds:

View File

@ -19,7 +19,6 @@ type Logger struct {
TailCount int64 `json:"tail" yaml:"tail"`
BufferSize int `json:"buffer" yaml:"buffer"`
SinceSeconds int64 `json:"sinceSeconds" yaml:"sinceSeconds"`
FullScreen bool `json:"fullScreen" yaml:"fullScreen"`
TextWrap bool `json:"textWrap" yaml:"textWrap"`
ShowTime bool `json:"showTime" yaml:"showTime"`
}

View File

@ -12,6 +12,7 @@ k9s:
crumbsless: false
reactive: false
noIcons: false
defaultsToFullScreen: false
skipLatestRevCheck: false
disablePodCounting: false
shellPod:
@ -29,7 +30,6 @@ k9s:
tail: 100
buffer: 5000
sinceSeconds: -1
fullScreen: false
textWrap: false
showTime: false
thresholds:

View File

@ -12,6 +12,7 @@ k9s:
crumbsless: false
reactive: false
noIcons: false
defaultsToFullScreen: false
skipLatestRevCheck: false
disablePodCounting: false
shellPod:
@ -29,7 +30,6 @@ k9s:
tail: 500
buffer: 800
sinceSeconds: -1
fullScreen: false
textWrap: false
showTime: false
thresholds:

View File

@ -12,6 +12,7 @@ k9s:
crumbsless: false
reactive: false
noIcons: false
defaultsToFullScreen: false
skipLatestRevCheck: false
disablePodCounting: false
shellPod:
@ -29,7 +30,6 @@ k9s:
tail: 200
buffer: 2000
sinceSeconds: -1
fullScreen: false
textWrap: false
showTime: false
thresholds:

View File

@ -28,7 +28,6 @@ k9s:
tail: 200
buffer: 2000
sinceSeconds: -1
fullScreen: false
textWrap: false
showTime: false
thresholds:

View File

@ -31,4 +31,7 @@ type UI struct {
// Skin reference the general k9s skin name.
// Can be overridden per context.
Skin string `json:"skin" yaml:"skin,omitempty"`
// DefaultsToFullScreen toggles fullscreen on views like logs, yaml, details.
DefaultsToFullScreen bool `json:"defaultsToFullScreen" yaml:"defaultsToFullScreen"`
}

View File

@ -76,6 +76,7 @@ func (d *Details) Init(_ context.Context) error {
d.app.Styles.AddListener(d)
d.StylesChanged(d.app.Styles)
d.setFullScreen(d.app.Config.K9s.UI.DefaultsToFullScreen)
d.app.Prompt().SetModel(d.cmdBuff)
d.cmdBuff.AddListener(d)
@ -226,16 +227,20 @@ func (d *Details) toggleFullScreenCmd(evt *tcell.EventKey) *tcell.EventKey {
return evt
}
d.fullScreen = !d.fullScreen
d.SetFullScreen(d.fullScreen)
d.Box.SetBorder(!d.fullScreen)
if d.fullScreen {
d.setFullScreen(!d.fullScreen)
return nil
}
func (d *Details) setFullScreen(isFullScreen bool) {
d.fullScreen = isFullScreen
d.SetFullScreen(isFullScreen)
d.Box.SetBorder(!isFullScreen)
if isFullScreen {
d.Box.SetBorderPadding(0, 0, 0, 0)
} else {
d.Box.SetBorderPadding(0, 0, 1, 1)
}
return nil
}
func (d *Details) prevCmd(evt *tcell.EventKey) *tcell.EventKey {

View File

@ -78,6 +78,7 @@ func (v *LiveView) Init(_ context.Context) error {
v.app.Styles.AddListener(v)
v.StylesChanged(v.app.Styles)
v.setFullScreen(v.app.Config.K9s.UI.DefaultsToFullScreen)
v.app.Prompt().SetModel(v.cmdBuff)
v.cmdBuff.AddListener(v)
@ -286,16 +287,20 @@ func (v *LiveView) toggleFullScreenCmd(evt *tcell.EventKey) *tcell.EventKey {
return evt
}
v.fullScreen = !v.fullScreen
v.SetFullScreen(v.fullScreen)
v.Box.SetBorder(!v.fullScreen)
if v.fullScreen {
v.setFullScreen(!v.fullScreen)
return nil
}
func (v *LiveView) setFullScreen(isFullScreen bool) {
v.fullScreen = isFullScreen
v.SetFullScreen(isFullScreen)
v.Box.SetBorder(!isFullScreen)
if isFullScreen {
v.Box.SetBorderPadding(0, 0, 0, 0)
} else {
v.Box.SetBorderPadding(0, 0, 1, 1)
}
return nil
}
func (v *LiveView) nextCmd(evt *tcell.EventKey) *tcell.EventKey {

View File

@ -34,7 +34,7 @@ func NewLogIndicator(cfg *config.Config, styles *config.Styles, allContainers bo
TextView: tview.NewTextView(),
indicator: make([]byte, 0, 100),
scrollStatus: 1,
fullScreen: cfg.K9s.Logger.FullScreen,
fullScreen: cfg.K9s.UI.DefaultsToFullScreen,
textWrap: cfg.K9s.Logger.TextWrap,
showTime: cfg.K9s.Logger.ShowTime,
shouldDisplayAllContainers: allContainers,