Skip to content

Commit 3ed08ec

Browse files
committed
Housekeeping
1 parent 954b252 commit 3ed08ec

3 files changed

Lines changed: 12 additions & 35 deletions

File tree

client/testui/client.go

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,15 @@ func (c *Client) writeAuditLog(action string, details string) error {
5252

5353
c.auditLogIdCounter++
5454
c.auditLogs = append(c.auditLogs, client.AuditLog{
55-
c.auditLogIdCounter,
56-
time.Now(),
57-
58-
client.AuditLogMetadata{
59-
hostname,
60-
osuser.Username,
61-
"testui",
55+
Id: c.auditLogIdCounter,
56+
Timestamp: time.Now(),
57+
Metadata: client.AuditLogMetadata{
58+
Hostname: hostname,
59+
Hostuser: osuser.Username,
60+
Referer: "testui",
6261
},
63-
64-
action,
65-
details,
62+
Action: action,
63+
Details: details,
6664
})
6765

6866
return nil
@@ -449,7 +447,7 @@ func (c *Client) DeployAccounts(ctx context.Context, accountIds ...client.Accoun
449447
if !ok {
450448
deployProgress.Accounts[account.Id].Status = "error"
451449
deployProgress.Accounts[account.Id].Progress = 1
452-
deployProgress.Accounts[account.Id].Err = fmt.Errorf("Some weird error on account with id %v", account.Id)
450+
deployProgress.Accounts[account.Id].Err = fmt.Errorf("some weird error on account with id %v", account.Id)
453451
deployProgressChan <- deployProgress
454452
continue
455453
}
@@ -564,7 +562,7 @@ func (c *Client) VerifyAccounts(ctx context.Context, accountIds ...client.Accoun
564562
if !ok {
565563
verifyProgress.Accounts[account.Id].Status = "error"
566564
verifyProgress.Accounts[account.Id].Progress = 1
567-
verifyProgress.Accounts[account.Id].Err = fmt.Errorf("Some weird error on account with id %v", account.Id)
565+
verifyProgress.Accounts[account.Id].Err = fmt.Errorf("some weird error on account with id %v", account.Id)
568566
verifyProgressChan <- verifyProgress
569567
continue
570568
}

ui/i18n/i18n.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ package i18n
99

1010
import (
1111
"fmt"
12-
"path" // Use the 'path' package for consistent forward slashes
1312
"strings"
1413

1514
"github.com/nicksnyder/go-i18n/v2/i18n"
@@ -40,7 +39,7 @@ func Init(defaultLang string) {
4039
availableLocales = make(map[string]string)
4140

4241
// Discover and load all locale files from the embedded filesystem.
43-
files, err := locales.LocaleFS.ReadDir("locales")
42+
files, err := locales.LocaleFS.ReadDir(".")
4443
if err != nil {
4544
// This should not happen with a valid embed.
4645
panic(fmt.Sprintf("failed to read embedded locales directory: %v", err))
@@ -69,8 +68,7 @@ func Init(defaultLang string) {
6968
availableLocales[langCode] = displayName
7069

7170
// Load the file into the bundle
72-
filePath := path.Join("locales", fileName)
73-
_, err := bundle.LoadMessageFileFS(locales.LocaleFS, filePath)
71+
_, err := bundle.LoadMessageFileFS(locales.LocaleFS, fileName)
7472
if err != nil {
7573
panic(fmt.Sprintf("failed to load locale file %s: %v", fileName, err))
7674
}

ui/tui/views/dashboard/model.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"fmt"
99
"slices"
1010
"strings"
11-
"time"
1211

1312
"github.com/charmbracelet/bubbles/help"
1413
"github.com/charmbracelet/bubbles/table"
@@ -224,24 +223,6 @@ func splitLabelValue(line string) (string, string) {
224223
return parts[0] + ":", strings.TrimSpace(parts[1])
225224
}
226225

227-
// TODO decide if this function handles date, time or datetime
228-
func parseTimestamp(raw string) string {
229-
raw = strings.TrimSpace(raw)
230-
if raw == "" {
231-
return i18n.T("dashboard.no_timestamp")
232-
}
233-
layouts := []string{time.RFC3339, "2006-01-02 15:04:05", "2006-01-02T15:04:05Z07:00"}
234-
for _, layout := range layouts {
235-
if t, err := time.Parse(layout, raw); err == nil {
236-
return t.Format("Jan 02 15:04")
237-
}
238-
}
239-
if len(raw) > 12 {
240-
return raw[:12]
241-
}
242-
return raw
243-
}
244-
245226
// TODO use lipgloss
246227
func titleFromUnderscore(action string) string {
247228
if action == "" {

0 commit comments

Comments
 (0)