Skip to content

Commit

Permalink
Merge pull request #305 from overmindtech/formatting
Browse files Browse the repository at this point in the history
Rework the visuals and how we store colours
  • Loading branch information
DavidS-ovm authored May 16, 2024
2 parents deaf53d + 78d74c2 commit 2550702
Show file tree
Hide file tree
Showing 9 changed files with 362 additions and 355 deletions.
101 changes: 0 additions & 101 deletions cmd/overmind-theme-dark.json

This file was deleted.

101 changes: 0 additions & 101 deletions cmd/overmind-theme.json

This file was deleted.

2 changes: 1 addition & 1 deletion cmd/tea_revlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (m revlinkWarmupModel) revlinkWarmupCmd() tea.Msg {
ctx := m.ctx

if viper.GetString("ovm-test-fake") != "" {
for i := 0; i < 10; i++ {
for i := 0; i < 20; i++ {
m.status <- &sdp.RevlinkWarmupResponse{
Status: "running (test mode)",
Items: int32(i * 10),
Expand Down
25 changes: 10 additions & 15 deletions cmd/tea_taskmodel.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ import (
"os"
"os/signal"
"syscall"
"time"

"github.com/charmbracelet/bubbles/spinner"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/muesli/ansi"
)

// waitForCancellation returns a tea.Cmd that will wait for SIGINT and SIGTERM and run the provided cancel on receipt.
Expand Down Expand Up @@ -69,11 +67,8 @@ func NewTaskModel(title string) taskModel {
status: taskStatusPending,
title: title,
spinner: spinner.New(
spinner.WithSpinner(spinner.Spinner{
Frames: []string{"∙∙∙∙∙∙∙", "●∙∙∙∙∙∙", "∙●∙∙∙∙∙", "∙∙●∙∙∙∙", "∙∙∙●∙∙∙", "∙∙∙∙●∙∙", "∙∙∙∙∙●∙", "∙∙∙∙∙∙●"},
FPS: time.Second / 7, //nolint:gomnd
}),
spinner.WithStyle(lipgloss.NewStyle().Foreground(lipgloss.Color(ColorPalette.Light.BgMain))),
spinner.WithSpinner(DotsSpinner),
spinner.WithStyle(lipgloss.NewStyle().Foreground(ColorPalette.BgMain)),
),
}
}
Expand Down Expand Up @@ -110,21 +105,21 @@ func (m taskModel) View() string {
label := ""
switch m.status {
case taskStatusPending:
label = m.spinner.Style.Render("pending:")
label = lipgloss.NewStyle().Foreground(ColorPalette.LabelFaint).Render("+")
case taskStatusRunning:
label = m.spinner.View()
// all other lables are 7 cells wide
for ansi.PrintableRuneWidth(label) <= 7 {
label += " "
}
// for ansi.PrintableRuneWidth(label) <= 7 {
// label += " "
// }
case taskStatusDone:
label = m.spinner.Style.Render("done: ")
label = lipgloss.NewStyle().Foreground(ColorPalette.BgSuccess).Render("✔︎")
case taskStatusError:
label = m.spinner.Style.Render("errored:")
label = lipgloss.NewStyle().Foreground(ColorPalette.BgDanger).Render("x")
case taskStatusSkipped:
label = m.spinner.Style.Render("skipped:")
label = lipgloss.NewStyle().Foreground(ColorPalette.LabelFaint).Render("-")
default:
label = m.spinner.Style.Render("unknown:")
label = lipgloss.NewStyle().Render("?")
}

return fmt.Sprintf("%v %v", label, m.title)
Expand Down
3 changes: 1 addition & 2 deletions cmd/tea_terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (m cmdModel) Init() tea.Cmd {
m.tasks["01_token"].Init(),
// m.tasks["02_config"].Init(),
func() tea.Msg {
time.Sleep(time.Second)
time.Sleep(3 * time.Second)
return sourcesInitialisedMsg{}
},
m.tasks["03_revlink"].Init(),
Expand Down Expand Up @@ -232,7 +232,6 @@ func (m cmdModel) View() string {
if t.TaskModel().status == taskStatusPending {
continue
}

}
tasks = append(tasks, m.tasks[k].View())
}
Expand Down
Loading

0 comments on commit 2550702

Please sign in to comment.