Cancel from the board; office creates the session and builds the panes; handover rewritten
This commit is contained in:
54
tui/board.go
54
tui/board.go
@@ -49,12 +49,13 @@ type boardModel struct {
|
||||
activity []paperclip.Activity
|
||||
needsTab int
|
||||
|
||||
tools bool
|
||||
toolAt int
|
||||
zones *zone.Manager
|
||||
filter string
|
||||
typing bool
|
||||
showHelp bool
|
||||
tools bool
|
||||
toolAt int
|
||||
confirmCancel bool
|
||||
zones *zone.Manager
|
||||
filter string
|
||||
typing bool
|
||||
showHelp bool
|
||||
|
||||
width, height int
|
||||
}
|
||||
@@ -159,6 +160,28 @@ func (m boardModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
return m, nil
|
||||
|
||||
case tea.KeyMsg:
|
||||
if m.confirmCancel {
|
||||
switch msg.String() {
|
||||
case "y":
|
||||
m.confirmCancel = false
|
||||
if r := m.selectedTask(); r != nil {
|
||||
c, id := m.client, r.Issue.ID
|
||||
return m, func() tea.Msg {
|
||||
if _, err := c.SetStatus(id, "cancelled", "Cancelled from the board."); err != nil {
|
||||
return errMsg{err}
|
||||
}
|
||||
rows, err := loadRows(c, m.project)
|
||||
if err != nil {
|
||||
return errMsg{err}
|
||||
}
|
||||
return rowsMsg(rows)
|
||||
}
|
||||
}
|
||||
case "esc", "n", "q":
|
||||
m.confirmCancel = false
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
if m.tools {
|
||||
switch msg.String() {
|
||||
case "esc", "q", "t":
|
||||
@@ -227,6 +250,11 @@ func (m boardModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
case "/":
|
||||
m.typing = true
|
||||
return m, nil
|
||||
case "c":
|
||||
if m.selectedTask() != nil {
|
||||
m.confirmCancel = true
|
||||
}
|
||||
return m, nil
|
||||
case "u":
|
||||
// A task whose blocker finished but which still says blocked is the
|
||||
// one thing a person unblocks without reading anything else.
|
||||
@@ -361,6 +389,19 @@ func (m boardModel) View() string {
|
||||
m.width, m.height))
|
||||
}
|
||||
|
||||
if m.confirmCancel {
|
||||
r := m.selectedTask()
|
||||
name := ""
|
||||
if r != nil {
|
||||
name = r.Issue.Identifier + " " + r.Issue.Title
|
||||
}
|
||||
return helpOverlay("cancel "+name+"?", [][2]string{
|
||||
{"what happens", "the task's status becomes cancelled and it stops being work"},
|
||||
{"", "its thread, runs and cost stay; nothing is deleted"},
|
||||
{"y", "cancel it"},
|
||||
{"esc or n", "leave it alone"},
|
||||
}, m.width, m.height)
|
||||
}
|
||||
if m.tools {
|
||||
entries := make([][2]string, 0, len(tools))
|
||||
for i, t := range tools {
|
||||
@@ -473,6 +514,7 @@ func (m boardModel) footerLine() string {
|
||||
keyHint("enter", "open"),
|
||||
keyHint("a", "assign"),
|
||||
keyHint("u", "unblock"),
|
||||
keyHint("c", "cancel"),
|
||||
keyHint("t", "tools"),
|
||||
keyHint("/", "filter"),
|
||||
keyHint("?", "keys"),
|
||||
|
||||
Reference in New Issue
Block a user