e0d0dfb845a8f1eb35bce8ca5afcd76cb2ffbb35

Author
Arnaud Zheng <arnaud-zg@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(jira): support rapid view on rapid board mode (#9459)

* feat(jira): support rapid view on rapid board mode

* Update README to clarify how the rapid board/view works

Co-authored-by: Robby Russell <robby@planetargon.com>

Diff

 1diff --git a/plugins/jira/README.md b/plugins/jira/README.md
 2index 3d6d323a4a573ece85e76885fab7330f858f2fa4..5dc5bfc9697c412928cc7fed9258b2a402ea8c9b 100644
 3--- a/plugins/jira/README.md
 4+++ b/plugins/jira/README.md
 5@@ -18,8 +18,8 @@ This plugin supplies one command, `jira`, through which all its features are exp
 6 jira            # performs the default action
 7 
 8 jira new        # opens a new issue
 9+jira dashboard [rapid_view]  # opens your JIRA dashboard
10 jira mine       # queries for your own issues
11-jira dashboard  # opens your JIRA dashboard
12 jira tempo      # opens your JIRA Tempo
13 jira reported [username]  # queries for issues reported by a user
14 jira assigned [username]  # queries for issues assigned to a user
15@@ -67,6 +67,7 @@ echo "https://jira.atlassian.com" >> .jira-url
16 * `$JIRA_NAME` - Your JIRA username; used as the default user for `assigned`/`reported` searches
17 * `$JIRA_PREFIX` - Prefix added to issue ID arguments
18 * `$JIRA_RAPID_BOARD` - Set to `true` if you use Rapid Board
19+* `$JIRA_RAPID_VIEW` - Set the default rapid view; it doesn't work if `$JIRA_RAPID_BOARD` is set to false
20 * `$JIRA_DEFAULT_ACTION` - Action to do when `jira` is called with no arguments; defaults to "new"
21 * `$JIRA_TEMPO_PATH` - Your JIRA tempo url path; defaults to "/secure/Tempo.jspa"
22 
23diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh
24index 71224bdfbd466f3472982690d1188af732c9433d..e789fce928b11ef3e467b3cb87462e4d9224387c 100644
25--- a/plugins/jira/jira.plugin.zsh
26+++ b/plugins/jira/jira.plugin.zsh
27@@ -50,7 +50,7 @@ function jira() {
28   elif [[ "$action" == "dashboard" ]]; then
29     echo "Opening dashboard"
30     if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then
31-      open_command "${jira_url}/secure/RapidBoard.jspa"
32+      _jira_rapid_board ${@}
33     else
34       open_command "${jira_url}/secure/Dashboard.jspa"
35     fi
36@@ -65,6 +65,7 @@ function jira() {
37     echo "JIRA_URL=$jira_url"
38     echo "JIRA_PREFIX=$jira_prefix"
39     echo "JIRA_NAME=$JIRA_NAME"
40+    echo "JIRA_RAPID_VIEW=$JIRA_RAPID_VIEW"
41     echo "JIRA_RAPID_BOARD=$JIRA_RAPID_BOARD"
42     echo "JIRA_DEFAULT_ACTION=$JIRA_DEFAULT_ACTION"
43     echo "JIRA_TEMPO_PATH=$JIRA_TEMPO_PATH"
44@@ -112,6 +113,16 @@ Valid options, in order of precedence:
45 EOF
46 }
47 
48+function _jira_rapid_board() {
49+  rapid_view=${2:=$JIRA_RAPID_VIEW}
50+
51+  if [[ -z $rapid_view ]]; then
52+    open_command "${jira_url}/secure/RapidBoard.jspa"
53+  else
54+    open_command "${jira_url}/secure/RapidBoard.jspa?rapidView=$rapid_view"
55+  fi
56+}
57+
58 function _jira_query() {
59   emulate -L zsh
60   local verb="$1"