Files
nix/hosts/common/configs/user/console/kubernetes/remove-splash.patch
Nikolaos Karaolidis 67e7549452 Add k9s
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2025-01-17 14:27:27 +00:00

124 lines
3.2 KiB
Diff

diff --git a/internal/ui/splash.go b/internal/ui/splash.go
index bfe58e46..21683c53 100644
--- a/internal/ui/splash.go
+++ b/internal/ui/splash.go
@@ -3,14 +3,6 @@
package ui
-import (
- "fmt"
- "strings"
-
- "github.com/derailed/k9s/internal/config"
- "github.com/derailed/tview"
-)
-
// LogoSmall K9s small log.
var LogoSmall = []string{
` ____ __.________ `,
@@ -30,42 +22,3 @@ var LogoBig = []string{
`|____|__ \ /____//____ >\______ /_______ \___|`,
` \/ \/ \/ \/ `,
}
-
-// Splash represents a splash screen.
-type Splash struct {
- *tview.Flex
-}
-
-// NewSplash instantiates a new splash screen with product and company info.
-func NewSplash(styles *config.Styles, version string) *Splash {
- s := Splash{Flex: tview.NewFlex()}
- s.SetBackgroundColor(styles.BgColor())
-
- logo := tview.NewTextView()
- logo.SetDynamicColors(true)
- logo.SetTextAlign(tview.AlignCenter)
- s.layoutLogo(logo, styles)
-
- vers := tview.NewTextView()
- vers.SetDynamicColors(true)
- vers.SetTextAlign(tview.AlignCenter)
- s.layoutRev(vers, version, styles)
-
- s.SetDirection(tview.FlexRow)
- s.AddItem(logo, 10, 1, false)
- s.AddItem(vers, 1, 1, false)
-
- return &s
-}
-
-func (s *Splash) layoutLogo(t *tview.TextView, styles *config.Styles) {
- logo := strings.Join(LogoBig, fmt.Sprintf("\n[%s::b]", styles.Body().LogoColor))
- fmt.Fprintf(t, "%s[%s::b]%s\n",
- strings.Repeat("\n", 2),
- styles.Body().LogoColor,
- logo)
-}
-
-func (s *Splash) layoutRev(t *tview.TextView, rev string, styles *config.Styles) {
- fmt.Fprintf(t, "[%s::b]Revision [red::b]%s", styles.Body().FgColor, rev)
-}
diff --git a/internal/ui/splash_test.go b/internal/ui/splash_test.go
deleted file mode 100644
index 69b4b50d..00000000
--- a/internal/ui/splash_test.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-// Copyright Authors of K9s
-
-package ui_test
-
-import (
- "testing"
-
- "github.com/derailed/k9s/internal/config"
- "github.com/derailed/k9s/internal/ui"
- "github.com/stretchr/testify/assert"
-)
-
-func TestNewSplash(t *testing.T) {
- s := ui.NewSplash(config.NewStyles(), "bozo")
-
- x, y, w, h := s.GetRect()
- assert.Equal(t, 0, x)
- assert.Equal(t, 0, y)
- assert.Equal(t, 15, w)
- assert.Equal(t, 10, h)
-}
diff --git a/internal/view/app.go b/internal/view/app.go
index 4ac7e7c2..2b3a3fc5 100644
--- a/internal/view/app.go
+++ b/internal/view/app.go
@@ -35,7 +35,6 @@ import (
var ExitStatus = ""
const (
- splashDelay = 1 * time.Second
clusterRefresh = 15 * time.Second
clusterInfoWidth = 50
clusterInfoPad = 15
@@ -165,8 +164,7 @@ func (a *App) layout(ctx context.Context) {
}
main.AddItem(flash, 1, 1, false)
- a.Main.AddPage("main", main, true, false)
- a.Main.AddPage("splash", ui.NewSplash(a.Styles, a.version), true, true)
+ a.Main.AddPage("main", main, true, true)
a.toggleHeader(!a.Config.K9s.IsHeadless(), !a.Config.K9s.IsLogoless())
}
@@ -520,10 +518,7 @@ func (a *App) Run() error {
a.Resume()
go func() {
- <-time.After(splashDelay)
a.QueueUpdateDraw(func() {
- a.Main.SwitchToPage("main")
- // if command bar is already active, focus it
if a.CmdBuff().IsActive() {
a.SetFocus(a.Prompt())
}