Skip to content

Commit

Permalink
feat: differentiate between worklog insert/update
Browse files Browse the repository at this point in the history
  • Loading branch information
dhth committed Apr 9, 2024
1 parent 458870d commit dc42fc2
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 46 deletions.
48 changes: 28 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,43 +84,51 @@ Screenshots
<p align="center">
<img src="https://tools.dhruvs.space/images/punchout/punchout-2.png" alt="Usage" />
</p>
<p align="center">
<img src="https://tools.dhruvs.space/images/punchout/punchout-3.png" alt="Usage" />
</p>

Reference Manual
---

```
punchout Reference Manual
punchout has 2 sections:
- Issues List View
- Worklog List View
punchout has 3 panes:
- Issues List View Shows you issues matching your JQL query
- Worklog List View Shows you your worklog entries; you sync these entries
to JIRA from here
- Worklog Entry View You enter/update a worklog entry from here
Keyboard Shortcuts:
General
1 Switch to Issues List View
2 Switch to Worklog List View
<tab> Go to next view
<shift+tab> Go to previous view
1 Switch to Issues List View
2 Switch to Worklog List View
<tab> Go to next view/form entry
<shift+tab> Go to previous view/form entry
General List Controls
h/<Up> Move cursor up
k/<Down> Move cursor down
h<Left> Go to previous page
l<Right> Go to next page
/ Start filtering
h/<Up> Move cursor up
k/<Down> Move cursor down
h<Left> Go to previous page
l<Right> Go to next page
/ Start filtering
Issue List View
s Toggle recording time on the currently selected issue,
will open up a form to record a comment on the second
"s" keypress
<ctrl+s> Add manual worklog entry
s Toggle recording time on the currently selected issue,
will open up a form to record a comment on the second
"s" keypress
<ctrl+s> Add manual worklog entry
Worklog List View
<ctrl+s> Update worklog entry
<ctrl+d> Delete worklog entry
s Sync all visible entries to JIRA
<ctrl+r> Refresh list
<ctrl+s> Update worklog entry
<ctrl+d> Delete worklog entry
s Sync all visible entries to JIRA
<ctrl+r> Refresh list
Worklog Entry View
enter Save worklog entry
```

Acknowledgements
Expand Down
45 changes: 25 additions & 20 deletions ui/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,40 @@ var (
HelpText = `
punchout Reference Manual
punchout has 2 sections:
- Issues List View
- Worklog List View
punchout has 3 panes:
- Issues List View Shows you issues matching your JQL query
- Worklog List View Shows you your worklog entries; you sync these entries
to JIRA from here
- Worklog Entry View You enter/update a worklog entry from here
Keyboard Shortcuts:
General
1 Switch to Issues List View
2 Switch to Worklog List View
<tab> Go to next view
<shift+tab> Go to previous view
1 Switch to Issues List View
2 Switch to Worklog List View
<tab> Go to next view/form entry
<shift+tab> Go to previous view/form entry
General List Controls
h/<Up> Move cursor up
k/<Down> Move cursor down
h<Left> Go to previous page
l<Right> Go to next page
/ Start filtering
h/<Up> Move cursor up
k/<Down> Move cursor down
h<Left> Go to previous page
l<Right> Go to next page
/ Start filtering
Issue List View
s Toggle recording time on the currently selected issue,
will open up a form to record a comment on the second
"s" keypress
<ctrl+s> Add manual worklog entry
s Toggle recording time on the currently selected issue,
will open up a form to record a comment on the second
"s" keypress
<ctrl+s> Add manual worklog entry
Worklog List View
<ctrl+s> Update worklog entry
<ctrl+d> Delete worklog entry
s Sync all visible entries to JIRA
<ctrl+r> Refresh list
<ctrl+s> Update worklog entry
<ctrl+d> Delete worklog entry
s Sync all visible entries to JIRA
<ctrl+r> Refresh list
Worklog Entry View
enter Save worklog entry
`
)
9 changes: 7 additions & 2 deletions ui/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.KeyMsg:
switch msg.String() {
case "ctrl+d":
case "enter":
switch m.activeView {
case AskForCommentView:
m.activeView = IssueListView
Expand Down Expand Up @@ -78,7 +78,12 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.activeView = IssueListView
m.trackingInputs[entryComment].SetValue("")
case ManualWorklogEntryView:
m.activeView = IssueListView
switch m.worklogSaveType {
case worklogInsert:
m.activeView = IssueListView
case worklogUpdate:
m.activeView = WorklogView
}
for i := range m.trackingInputs {
m.trackingInputs[i].SetValue("")
}
Expand Down
15 changes: 11 additions & 4 deletions ui/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,19 @@ func (m model) View() string {
`,
formFieldNameStyle.Render(RightPadTrim("Comment:", 16)),
m.trackingInputs[entryComment].View(),
formContextStyle.Render("Press ctrl+d to submit"),
formContextStyle.Render("Press enter to submit"),
)
for i := 0; i < m.terminalHeight-20+10; i++ {
content += "\n"
}
case ManualWorklogEntryView:
var formHeadingText string
switch m.worklogSaveType {
case worklogInsert:
formHeadingText = "Adding a manual entry. Enter the following details:"
case worklogUpdate:
formHeadingText = "Updating worklog entry. Enter the following details:"
}

content = fmt.Sprintf(
`
Expand All @@ -70,14 +77,14 @@ func (m model) View() string {
%s
`,
formContextStyle.Render("Adding a manual entry. Entry the following details:"),
formContextStyle.Render(formHeadingText),
formFieldNameStyle.Render("Begin Time (format: 2006/01/02 15:04)"),
m.trackingInputs[entryBeginTS].View(),
formFieldNameStyle.Render("End Time (format: 2006/01/02 15:04)"),
m.trackingInputs[entryEndTS].View(),
formFieldNameStyle.Render(RightPadTrim("Comment:", 16)),
m.trackingInputs[entryComment].View(),
formContextStyle.Render("Press ctrl+d to submit"),
formContextStyle.Render("Press enter to submit"),
)
for i := 0; i < m.terminalHeight-20; i++ {
content += "\n"
Expand All @@ -86,7 +93,7 @@ func (m model) View() string {
if !m.helpVPReady {
content = "\n Initializing..."
} else {
content = viewPortStyle.Render(fmt.Sprintf(" %s\n\n%s\n", helpTitleStyle.Render("Help"), m.helpVP.View()))
content = viewPortStyle.Render(fmt.Sprintf("%s\n\n%s\n", helpTitleStyle.Render("Help"), m.helpVP.View()))
}
}

Expand Down

0 comments on commit dc42fc2

Please sign in to comment.