Skip to content

Commit ce881f2

Browse files
committed
show ticket id after creation
1 parent e090943 commit ce881f2

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

tools/flakeguard/cmd/create_jira_tickets.go

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,12 @@ func (m model) Init() tea.Cmd {
331331
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
332332
switch msg := msg.(type) {
333333
case tea.KeyMsg:
334-
// If we have a sub-mode for manual ticket entry
335334
if m.mode == "promptExisting" {
336335
return updatePromptExisting(m, msg)
337336
}
338-
// Otherwise normal mode
337+
if m.mode == "ticketCreated" {
338+
return updateTicketCreated(m, msg)
339+
}
339340
return updateNormalMode(m, msg)
340341
default:
341342
return m, nil
@@ -426,12 +427,30 @@ func updateConfirm(m model) (tea.Model, tea.Cmd) {
426427
log.Info().Msgf("[Dry Run] Would create Jira issue: %q", t.Summary)
427428
t.Confirmed = true
428429
}
429-
430430
m.tickets[i] = t
431431
m.confirmed++
432-
m.index++
433-
if m.index >= len(m.tickets) {
434-
m.quitting = true
432+
// Instead of incrementing the index immediately, set mode to "ticketCreated"
433+
m.mode = "ticketCreated"
434+
return m, nil
435+
}
436+
437+
func updateTicketCreated(m model, msg tea.KeyMsg) (tea.Model, tea.Cmd) {
438+
switch msg.String() {
439+
case "n":
440+
// Advance to the next ticket and reset mode
441+
m.mode = "normal"
442+
m.index++
443+
if m.index >= len(m.tickets) {
444+
m.quitting = true
445+
}
446+
return m, nil
447+
case "e":
448+
// Switch to the promptExisting mode for manual ticket id update
449+
m.mode = "promptExisting"
450+
m.inputValue = ""
451+
return m, nil
452+
case "q", "esc", "ctrl+c":
453+
return updateQuit(m)
435454
}
436455
return m, nil
437456
}

tools/flakeguard/jirautils/jira.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func CreateTicketInJira(
4141
Summary: summary,
4242
Description: description,
4343
Type: jira.IssueType{Name: issueType},
44-
Labels: []string{"flaky_test"},
44+
// Labels: []string{"flaky_test"}, TODO: enable
4545
},
4646
}
4747
newIssue, resp, err := client.Issue.CreateWithContext(context.Background(), issue)

0 commit comments

Comments
 (0)