fix: properly aligned TUI layout with consistent spacing
This commit is contained in:
@ -4,8 +4,8 @@ This directory contains pre-compiled binaries for the DB Backup Tool across mult
|
|||||||
|
|
||||||
## Build Information
|
## Build Information
|
||||||
- **Version**: 1.1.0
|
- **Version**: 1.1.0
|
||||||
- **Build Time**: 2025-11-05_13:29:48_UTC
|
- **Build Time**: 2025-11-05_13:33:17_UTC
|
||||||
- **Git Commit**: b6d56da
|
- **Git Commit**: b44ee26
|
||||||
|
|
||||||
## Recent Updates (v1.1.0)
|
## Recent Updates (v1.1.0)
|
||||||
- ✅ Fixed TUI progress display with line-by-line output
|
- ✅ Fixed TUI progress display with line-by-line output
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -192,42 +192,44 @@ func (m BackupExecutionModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
func (m BackupExecutionModel) View() string {
|
func (m BackupExecutionModel) View() string {
|
||||||
var s strings.Builder
|
var s strings.Builder
|
||||||
|
|
||||||
|
// Clear screen with newlines and render header
|
||||||
|
s.WriteString("\n\n")
|
||||||
header := titleStyle.Render("🔄 Backup Execution")
|
header := titleStyle.Render("🔄 Backup Execution")
|
||||||
s.WriteString(fmt.Sprintf("\n%s\n\n", header))
|
s.WriteString(header)
|
||||||
|
s.WriteString("\n\n")
|
||||||
|
|
||||||
// Backup details
|
// Backup details - properly aligned
|
||||||
s.WriteString(fmt.Sprintf("%-12s %s\n", "Type:", m.backupType))
|
s.WriteString(fmt.Sprintf(" %-10s %s\n", "Type:", m.backupType))
|
||||||
if m.databaseName != "" {
|
if m.databaseName != "" {
|
||||||
s.WriteString(fmt.Sprintf("%-12s %s\n", "Database:", m.databaseName))
|
s.WriteString(fmt.Sprintf(" %-10s %s\n", "Database:", m.databaseName))
|
||||||
}
|
}
|
||||||
if m.ratio > 0 {
|
if m.ratio > 0 {
|
||||||
s.WriteString(fmt.Sprintf("%-12s %d\n", "Sample Ratio:", m.ratio))
|
s.WriteString(fmt.Sprintf(" %-10s %d\n", "Sample:", m.ratio))
|
||||||
}
|
}
|
||||||
s.WriteString(fmt.Sprintf("%-12s %s\n", "Duration:", time.Since(m.startTime).Round(time.Second)))
|
s.WriteString(fmt.Sprintf(" %-10s %s\n", "Duration:", time.Since(m.startTime).Round(time.Second)))
|
||||||
s.WriteString("\n")
|
s.WriteString("\n")
|
||||||
|
|
||||||
// Status with spinner
|
// Status with spinner
|
||||||
if !m.done {
|
if !m.done {
|
||||||
spinner := []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}
|
spinner := []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}
|
||||||
frame := int(time.Since(m.startTime).Milliseconds()/100) % len(spinner)
|
frame := int(time.Since(m.startTime).Milliseconds()/100) % len(spinner)
|
||||||
s.WriteString(fmt.Sprintf("%-12s %s %s\n", "Status:", spinner[frame], m.status))
|
s.WriteString(fmt.Sprintf(" %s %s\n", spinner[frame], m.status))
|
||||||
} else {
|
} else {
|
||||||
s.WriteString(fmt.Sprintf("%-12s %s\n", "Status:", m.status))
|
s.WriteString(fmt.Sprintf(" %s\n\n", m.status))
|
||||||
s.WriteString("\n")
|
|
||||||
|
|
||||||
if m.err != nil {
|
if m.err != nil {
|
||||||
s.WriteString(fmt.Sprintf("❌ Error: %v\n", m.err))
|
s.WriteString(fmt.Sprintf(" ❌ Error: %v\n", m.err))
|
||||||
} else if m.result != "" {
|
} else if m.result != "" {
|
||||||
// Parse and display result cleanly
|
// Parse and display result cleanly
|
||||||
lines := strings.Split(m.result, "\n")
|
lines := strings.Split(m.result, "\n")
|
||||||
for _, line := range lines {
|
for _, line := range lines {
|
||||||
line = strings.TrimSpace(line)
|
line = strings.TrimSpace(line)
|
||||||
if line != "" {
|
if line != "" {
|
||||||
s.WriteString(line + "\n")
|
s.WriteString(" " + line + "\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.WriteString("\n⌨️ Press Enter or ESC to return to menu\n")
|
s.WriteString("\n ⌨️ Press Enter or ESC to return to menu\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
return s.String()
|
return s.String()
|
||||||
|
|||||||
Reference in New Issue
Block a user