fix: add E:edit to footer, generate UUID+timestamps in TUI forms

This commit is contained in:
swanadiva
2026-06-23 18:15:36 +07:00
parent 9b27388455
commit 512cf5ce1f
4 changed files with 17 additions and 2 deletions
+6 -1
View File
@@ -4,10 +4,12 @@ import (
"fmt"
"strconv"
"strings"
"time"
"github.com/charmbracelet/bubbles/textinput"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/google/uuid"
"git.tukangketik.id/swanadiva/hostkeeper/internal/models"
)
@@ -265,6 +267,7 @@ func (t *HostFormTab) submit() (Tab, tea.Cmd) {
host.Notes = t.inputs[fieldNotes].Value()
} else {
host = &models.Host{
ID: uuid.New().String(),
Name: name,
Hostname: hostname,
Port: port,
@@ -273,9 +276,11 @@ func (t *HostFormTab) submit() (Tab, tea.Cmd) {
Type: authType,
Password: t.inputs[fieldPassword].Value(),
},
Group: t.inputs[fieldGroup].Value(),
Group: t.inputs[fieldGroup].Value(),
Tags: tags,
Notes: t.inputs[fieldNotes].Value(),
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
}
}