From 94d26a6b3a1da3abd4c23da21bc8c2e5b8e9c3d6 Mon Sep 17 00:00:00 2001 From: derailed Date: Mon, 23 Mar 2020 18:09:44 -0600 Subject: [PATCH] cleaning up --- change_logs/release_v0.18.0.md | 8 +++++--- internal/config/config_test.go | 6 +++--- internal/config/k9s.go | 1 - internal/config/k9s_test.go | 4 ++-- internal/config/logger.go | 7 ++++--- internal/config/logger_test.go | 4 ++-- internal/view/log.go | 13 ------------- internal/view/log_indicator.go | 2 +- internal/view/log_int_test.go | 2 +- 9 files changed, 18 insertions(+), 29 deletions(-) diff --git a/change_logs/release_v0.18.0.md b/change_logs/release_v0.18.0.md index b33f954d..652f0f10 100644 --- a/change_logs/release_v0.18.0.md +++ b/change_logs/release_v0.18.0.md @@ -23,14 +23,16 @@ Thank you for your gesture of kindness and for supporting K9s!! If you've contributed $25 or more please reach out to me on slack with your earth coordinates so I can send you your K9s swags! - - + + + +NOTE: I am one not to pressure folks into giving. However, it does make me sad to see postings out there with clear indications that K9s is being used and yet zero mentions of the web site nor this repo. K9s marketing budget relies entirely on word of mouth and is not pimped out by big corps. So if you publish your work and leverage K9s, please give us a shoutout or at the very least reference this repo or website! --- ## AutoSuggestions -K9s command mode now provides for autocomplete. Suggestions are pulled from available kubernetes resources and custom aliases. The command mode supports the following commands: +K9s command mode now provides for auto complete. Suggestions are pulled from available kubernetes resources and custom aliases. The command mode supports the following keyboard triggers: | Key | Description | |---------------------|------------------------------------------| diff --git a/internal/config/config_test.go b/internal/config/config_test.go index da9bef8d..1891f5f1 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -267,9 +267,9 @@ var expectedConfig = `k9s: tail: 500 buffer: 800 sinceSeconds: 300 + fullScreenLogs: false currentContext: blee currentCluster: blee - fullScreenLogs: false clusters: blee: namespace: @@ -315,11 +315,11 @@ var resetConfig = `k9s: readOnly: false logger: tail: 200 - buffer: 1000 + buffer: 2000 sinceSeconds: 300 + fullScreenLogs: false currentContext: blee currentCluster: blee - fullScreenLogs: false clusters: blee: namespace: diff --git a/internal/config/k9s.go b/internal/config/k9s.go index 43f4a12a..d9ad2aa8 100644 --- a/internal/config/k9s.go +++ b/internal/config/k9s.go @@ -15,7 +15,6 @@ type K9s struct { Logger *Logger `yaml:"logger"` CurrentContext string `yaml:"currentContext"` CurrentCluster string `yaml:"currentCluster"` - FullScreenLogs bool `yaml:"fullScreenLogs"` Clusters map[string]*Cluster `yaml:"clusters,omitempty"` Thresholds Threshold `yaml:"thresholds"` manualRefreshRate int diff --git a/internal/config/k9s_test.go b/internal/config/k9s_test.go index 2fe643ff..d6665a5a 100644 --- a/internal/config/k9s_test.go +++ b/internal/config/k9s_test.go @@ -23,7 +23,7 @@ func TestK9sValidate(t *testing.T) { assert.Equal(t, 2, c.RefreshRate) assert.Equal(t, int64(100), c.Logger.TailCount) - assert.Equal(t, 1_000, c.Logger.BufferSize) + assert.Equal(t, 5_000, c.Logger.BufferSize) assert.Equal(t, "ctx1", c.CurrentContext) assert.Equal(t, "c1", c.CurrentCluster) assert.Equal(t, 1, len(c.Clusters)) @@ -46,7 +46,7 @@ func TestK9sValidateBlank(t *testing.T) { assert.Equal(t, 2, c.RefreshRate) assert.Equal(t, int64(100), c.Logger.TailCount) - assert.Equal(t, 1_000, c.Logger.BufferSize) + assert.Equal(t, 5_000, c.Logger.BufferSize) assert.Equal(t, "ctx1", c.CurrentContext) assert.Equal(t, "c1", c.CurrentCluster) assert.Equal(t, 1, len(c.Clusters)) diff --git a/internal/config/logger.go b/internal/config/logger.go index e045c9ae..23b898ad 100644 --- a/internal/config/logger.go +++ b/internal/config/logger.go @@ -15,9 +15,10 @@ const ( // Logger tracks logger options type Logger struct { - TailCount int64 `yaml:"tail"` - BufferSize int `yaml:"buffer"` - SinceSeconds int64 `yaml:"sinceSeconds"` + TailCount int64 `yaml:"tail"` + BufferSize int `yaml:"buffer"` + SinceSeconds int64 `yaml:"sinceSeconds"` + FullScreenLogs bool `yaml:"fullScreenLogs"` } // NewLogger returns a new instance. diff --git a/internal/config/logger_test.go b/internal/config/logger_test.go index 427ee341..66202d10 100644 --- a/internal/config/logger_test.go +++ b/internal/config/logger_test.go @@ -12,7 +12,7 @@ func TestNewLogger(t *testing.T) { l.Validate(nil, nil) assert.Equal(t, int64(100), l.TailCount) - assert.Equal(t, 1_000, l.BufferSize) + assert.Equal(t, 5_000, l.BufferSize) } func TestLoggerValidate(t *testing.T) { @@ -20,5 +20,5 @@ func TestLoggerValidate(t *testing.T) { l.Validate(nil, nil) assert.Equal(t, int64(100), l.TailCount) - assert.Equal(t, 1_000, l.BufferSize) + assert.Equal(t, 5_000, l.BufferSize) } diff --git a/internal/view/log.go b/internal/view/log.go index f6e55158..4330c854 100644 --- a/internal/view/log.go +++ b/internal/view/log.go @@ -181,7 +181,6 @@ func (l *Log) bindKeys() { ui.Key4: ui.NewKeyAction("30m", l.sinceCmd(30*60), true), ui.Key5: ui.NewKeyAction("1h", l.sinceCmd(60*60), true), tcell.KeyEnter: ui.NewSharedKeyAction("Filter", l.filterCmd, false), - ui.KeyA: ui.NewKeyAction("Apply", l.applyCmd, true), ui.KeyC: ui.NewKeyAction("Clear", l.clearCmd, true), ui.KeyS: ui.NewKeyAction("Toggle AutoScroll", l.toggleAutoScrollCmd, true), ui.KeyF: ui.NewKeyAction("FullScreen", l.toggleFullScreenCmd, true), @@ -267,18 +266,6 @@ func (l *Log) sinceCmd(a int) func(evt *tcell.EventKey) *tcell.EventKey { l.updateTitle() return nil } - -} - -func (l *Log) applyCmd(evt *tcell.EventKey) *tcell.EventKey { - if l.app.InCmdMode() { - return evt - } - ShowLogs(l.app, "blee", l.filterLogs) - return nil -} - -func (l *Log) filterLogs(path string, opts dao.LogOptions) { } func (l *Log) filterCmd(evt *tcell.EventKey) *tcell.EventKey { diff --git a/internal/view/log_indicator.go b/internal/view/log_indicator.go index 005d2851..93e01d8f 100644 --- a/internal/view/log_indicator.go +++ b/internal/view/log_indicator.go @@ -25,7 +25,7 @@ func NewLogIndicator(cfg *config.Config, styles *config.Styles) *LogIndicator { styles: styles, TextView: tview.NewTextView(), scrollStatus: 1, - fullScreen: cfg.K9s.FullScreenLogs, + fullScreen: cfg.K9s.Logger.FullScreenLogs, } l.StylesChanged(styles) styles.AddListener(&l) diff --git a/internal/view/log_int_test.go b/internal/view/log_int_test.go index 4c3bb9c1..79f662b3 100644 --- a/internal/view/log_int_test.go +++ b/internal/view/log_int_test.go @@ -16,7 +16,7 @@ func TestLogAutoScroll(t *testing.T) { v.GetModel().Set(dao.LogItems{dao.NewLogItemFromString("blee"), dao.NewLogItemFromString("bozo")}) v.GetModel().Notify(true) - assert.Equal(t, 14, len(v.Hints())) + assert.Equal(t, 13, len(v.Hints())) v.toggleAutoScrollCmd(nil) assert.Equal(t, "Autoscroll: Off FullScreen: Off Timestamps: Off Wrap: Off ", v.Indicator().GetText(true))