Skip to content

Commit 8b232ac

Browse files
committed
show spinner when searching for tickets
1 parent f468e74 commit 8b232ac

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

tools/flakeguard/cmd/create_jira_tickets.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ import (
77
"os"
88
"path/filepath"
99
"strings"
10+
"time"
1011

1112
"github.com/andygrunwald/go-jira"
13+
"github.com/briandowns/spinner"
1214
tea "github.com/charmbracelet/bubbletea"
1315
"github.com/charmbracelet/lipgloss"
1416
"github.com/rs/zerolog/log"
@@ -26,8 +28,6 @@ var (
2628
flakyTestJSONDBPath string
2729
)
2830

29-
// CreateTicketsCmd is the Cobra command that runs a Bubble Tea TUI for CSV data,
30-
// creates (or references) tickets in Jira, and writes a new CSV omitting confirmed rows.
3131
var CreateTicketsCmd = &cobra.Command{
3232
Use: "create-tickets",
3333
Short: "Interactive TUI to confirm and create Jira tickets from CSV",
@@ -96,7 +96,6 @@ ticket in a text-based UI. Press 'y' to confirm creation, 'n' to skip,
9696
ft.RowIndex = i + 1
9797

9898
// Check local DB for known Jira ticket
99-
// Always check local DB for known Jira ticket (even for invalid tests)
10099
if ticketID, found := db.Get(ft.TestPackage, ft.TestName); found {
101100
ft.ExistingJiraKey = ticketID
102101
ft.ExistingTicketSource = "localdb"
@@ -117,6 +116,10 @@ ticket in a text-based UI. Press 'y' to confirm creation, 'n' to skip,
117116

118117
// 6) If we have a Jira client, do label-based search for existing tickets
119118
if client != nil {
119+
s := spinner.New(spinner.CharSets[14], 100*time.Millisecond)
120+
s.Suffix = " Searching for existing jira tickets..."
121+
s.Start()
122+
120123
for i := range tickets {
121124
t := &tickets[i]
122125
if t.ExistingJiraKey == "" {
@@ -130,6 +133,7 @@ ticket in a text-based UI. Press 'y' to confirm creation, 'n' to skip,
130133
}
131134
}
132135
}
136+
s.Stop()
133137
}
134138

135139
// 7) Create Bubble Tea model
@@ -153,7 +157,6 @@ ticket in a text-based UI. Press 'y' to confirm creation, 'n' to skip,
153157
if err := fm.LocalDB.Save(); err != nil {
154158
log.Error().Err(err).Msg("Failed to save local DB")
155159
} else {
156-
// Let the user know we updated it
157160
fmt.Printf("Local DB has been updated at: %s\n", fm.LocalDB.FilePath())
158161
}
159162

tools/flakeguard/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard
33
go 1.24.0
44

55
require (
6-
github.com/briandowns/spinner v1.23.1
6+
github.com/briandowns/spinner v1.23.2
77
github.com/charmbracelet/bubbletea v1.3.4
88
github.com/charmbracelet/lipgloss v1.1.0
99
github.com/go-resty/resty/v2 v2.16.2

tools/flakeguard/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiE
44
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
55
github.com/briandowns/spinner v1.23.1 h1:t5fDPmScwUjozhDj4FA46p5acZWIPXYE30qW2Ptu650=
66
github.com/briandowns/spinner v1.23.1/go.mod h1:LaZeM4wm2Ywy6vO571mvhQNRcWfRUnXOs0RcKV0wYKM=
7+
github.com/briandowns/spinner v1.23.2 h1:Zc6ecUnI+YzLmJniCfDNaMbW0Wid1d5+qcTq4L2FW8w=
8+
github.com/briandowns/spinner v1.23.2/go.mod h1:LaZeM4wm2Ywy6vO571mvhQNRcWfRUnXOs0RcKV0wYKM=
79
github.com/charmbracelet/bubbletea v1.3.4 h1:kCg7B+jSCFPLYRA52SDZjr51kG/fMUEoPoZrkaDHyoI=
810
github.com/charmbracelet/bubbletea v1.3.4/go.mod h1:dtcUCyCGEX3g9tosuYiut3MXgY/Jsv9nKVdibKKRRXo=
911
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs=

0 commit comments

Comments
 (0)