Compare commits

...

1 Commits

Author SHA1 Message Date
d6de4b16cb wip: feat: tabbed view
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
See #613
2025-10-31 22:11:26 +01:00

View File

@ -41,6 +41,12 @@ type ServiceMeta struct {
ID string
}
const (
statusMode = iota
logsMode = iota
errorsMode = iota
)
type Model struct {
appName string
cl *dockerClient.Client
@ -49,6 +55,7 @@ type Model struct {
timeout time.Duration
width int
filters filters.Args
mode int
Streams *[]stream
Logs *[]string
@ -244,6 +251,12 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case "ctrl+c", "q":
m.Quit = true
return m, tea.Quit
case "s":
m.mode = statusMode
case "l":
m.mode = logsMode
case "e":
m.mode = errorsMode
}
case tea.WindowSizeMsg:
@ -324,6 +337,35 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
func (m Model) View() string {
body := strings.Builder{}
var res string
switch {
case m.mode == statusMode:
res = statusView(m)
case m.mode == logsMode:
res = logsView(m)
}
body.WriteString("[s]tatus [l]ogs [e]rrors")
return res + "\n" + body.String()
}
func logsView(m Model) string {
body := strings.Builder{}
body.WriteString("LOGS COMING SOON")
return body.String()
}
func errorsView(m Model) string {
body := strings.Builder{}
body.WriteString("ERRORS COMING SOON")
return body.String()
}
func statusView(m Model) string {
body := strings.Builder{}
for _, stream := range *m.Streams {
split := strings.Split(stream.Name, "_")
short := split[len(split)-1]