Skip to content

Commit

Permalink
fix: better handling of filtering mode
Browse files Browse the repository at this point in the history
Cleanup of unused files.
  • Loading branch information
dhth committed Mar 12, 2024
1 parent 486cb38 commit d55733a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 133 deletions.
File renamed without changes.
115 changes: 0 additions & 115 deletions db/db.go

This file was deleted.

2 changes: 1 addition & 1 deletion ui/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (issue Issue) Description() string {
issueType := getIssueTypeStyle(issue.IssueType).Render(Trim(issue.IssueType, 20))
return fmt.Sprintf("%s%s", RightPadTrim(issue.IssueKey, listWidth-40), issueType)
}
func (issue Issue) FilterValue() string { return issue.IssueKey }
func (issue Issue) FilterValue() string { return issue.IssueKey + " : " + issue.Summary }

type WorklogEntry struct {
Id int
Expand Down
37 changes: 20 additions & 17 deletions ui/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,25 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case "s":
switch m.activeView {
case IssueListView:
if m.changesLocked {
message := "Changes locked momentarily"
m.message = message
m.messages = append(m.messages, message)
return m, tea.Batch(cmds...)
}
issue, ok := m.issueList.SelectedItem().(Issue)
if !ok {
message := "Something went horribly wrong"
m.message = message
m.messages = append(m.messages, message)
} else {
if m.lastChange == UpdateChange {
m.changesLocked = true
cmds = append(cmds, toggleTracking(m.db, issue.IssueKey, ""))
} else if m.lastChange == InsertChange {
m.activeView = AskForCommentView
if m.issueList.FilterState() != list.Filtering {
if m.changesLocked {
message := "Changes locked momentarily"
m.message = message
m.messages = append(m.messages, message)
return m, tea.Batch(cmds...)
}
issue, ok := m.issueList.SelectedItem().(Issue)
if !ok {
message := "Something went horribly wrong"
m.message = message
m.messages = append(m.messages, message)
} else {
if m.lastChange == UpdateChange {
m.changesLocked = true
cmds = append(cmds, toggleTracking(m.db, issue.IssueKey, ""))
} else if m.lastChange == InsertChange {
m.activeView = AskForCommentView
}
}
}
case WorklogView:
Expand Down Expand Up @@ -214,6 +216,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case WLAddedOnJIRA:
if msg.err != nil {
msg.entry.Error = msg.err
m.worklogList.SetItem(msg.index, msg.entry)
m.messages = append(m.messages, msg.err.Error())
} else {
msg.entry.Synced = true
Expand Down

0 comments on commit d55733a

Please sign in to comment.