Browse Source

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>
Arnaud Zheng 2 years ago
parent
commit
e0d0dfb845
2 changed files with 14 additions and 2 deletions
  1. 2 1
      plugins/jira/README.md
  2. 12 1
      plugins/jira/jira.plugin.zsh

+ 2 - 1
plugins/jira/README.md

@@ -18,8 +18,8 @@ This plugin supplies one command, `jira`, through which all its features are exp
 jira            # performs the default action
 
 jira new        # opens a new issue
+jira dashboard [rapid_view]  # opens your JIRA dashboard
 jira mine       # queries for your own issues
-jira dashboard  # opens your JIRA dashboard
 jira tempo      # opens your JIRA Tempo
 jira reported [username]  # queries for issues reported by a user
 jira assigned [username]  # queries for issues assigned to a user
@@ -67,6 +67,7 @@ echo "https://jira.atlassian.com" >> .jira-url
 * `$JIRA_NAME` - Your JIRA username; used as the default user for `assigned`/`reported` searches
 * `$JIRA_PREFIX` - Prefix added to issue ID arguments
 * `$JIRA_RAPID_BOARD` - Set to `true` if you use Rapid Board
+* `$JIRA_RAPID_VIEW` - Set the default rapid view; it doesn't work if `$JIRA_RAPID_BOARD` is set to false
 * `$JIRA_DEFAULT_ACTION` - Action to do when `jira` is called with no arguments; defaults to "new"
 * `$JIRA_TEMPO_PATH` - Your JIRA tempo url path; defaults to "/secure/Tempo.jspa"
 

+ 12 - 1
plugins/jira/jira.plugin.zsh

@@ -50,7 +50,7 @@ function jira() {
   elif [[ "$action" == "dashboard" ]]; then
     echo "Opening dashboard"
     if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then
-      open_command "${jira_url}/secure/RapidBoard.jspa"
+      _jira_rapid_board ${@}
     else
       open_command "${jira_url}/secure/Dashboard.jspa"
     fi
@@ -65,6 +65,7 @@ function jira() {
     echo "JIRA_URL=$jira_url"
     echo "JIRA_PREFIX=$jira_prefix"
     echo "JIRA_NAME=$JIRA_NAME"
+    echo "JIRA_RAPID_VIEW=$JIRA_RAPID_VIEW"
     echo "JIRA_RAPID_BOARD=$JIRA_RAPID_BOARD"
     echo "JIRA_DEFAULT_ACTION=$JIRA_DEFAULT_ACTION"
     echo "JIRA_TEMPO_PATH=$JIRA_TEMPO_PATH"
@@ -112,6 +113,16 @@ Valid options, in order of precedence:
 EOF
 }
 
+function _jira_rapid_board() {
+  rapid_view=${2:=$JIRA_RAPID_VIEW}
+
+  if [[ -z $rapid_view ]]; then
+    open_command "${jira_url}/secure/RapidBoard.jspa"
+  else
+    open_command "${jira_url}/secure/RapidBoard.jspa?rapidView=$rapid_view"
+  fi
+}
+
 function _jira_query() {
   emulate -L zsh
   local verb="$1"