Files
dbbackup/internal/tui/operations.go
Alexander Renz 3e41d88445
All checks were successful
CI/CD / Test (push) Successful in 1m13s
CI/CD / Lint (push) Successful in 1m20s
CI/CD / Build & Release (push) Successful in 3m10s
v3.42.11: Replace all Unicode emojis with ASCII text
- Replace all emoji characters with ASCII equivalents throughout codebase
- Replace Unicode box-drawing characters (═║╔╗╚╝━─) with ASCII (+|-=)
- Replace checkmarks (✓✗) with [OK]/[FAIL] markers
- 59 files updated, 741 lines changed
- Improves terminal compatibility and reduces visual noise
2026-01-08 09:42:01 +01:00

63 lines
1.2 KiB
Go
Executable File

package tui
import (
"fmt"
"strings"
tea "github.com/charmbracelet/bubbletea"
"dbbackup/internal/config"
"dbbackup/internal/logger"
)
// OperationsViewModel shows active operations
type OperationsViewModel struct {
config *config.Config
logger logger.Logger
parent tea.Model
}
func NewOperationsView(cfg *config.Config, log logger.Logger, parent tea.Model) OperationsViewModel {
return OperationsViewModel{
config: cfg,
logger: log,
parent: parent,
}
}
func (m OperationsViewModel) Init() tea.Cmd {
return nil
}
func (m OperationsViewModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
// Auto-forward in auto-confirm mode
if m.config.TUIAutoConfirm {
return m.parent, tea.Quit
}
switch msg := msg.(type) {
case tea.KeyMsg:
switch msg.String() {
case "ctrl+c", "q", "esc", "enter":
return m.parent, nil
}
}
return m, nil
}
func (m OperationsViewModel) View() string {
var s strings.Builder
header := titleStyle.Render("[STATS] Active Operations")
s.WriteString(fmt.Sprintf("\n%s\n\n", header))
s.WriteString("Currently running operations:\n\n")
s.WriteString(infoStyle.Render("[NONE] No active operations"))
s.WriteString("\n\n")
s.WriteString("[KEYS] Press any key to return to menu\n")
return s.String()
}