From e0d0dfb845a8f1eb35bce8ca5afcd76cb2ffbb35 Mon Sep 17 00:00:00 2001 From: Arnaud Zheng Date: Mon, 9 Jan 2023 20:53:32 +0100 Subject: [PATCH] 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 --- plugins/jira/README.md | 3 ++- plugins/jira/jira.plugin.zsh | 13 ++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/plugins/jira/README.md b/plugins/jira/README.md index 3d6d323a4..5dc5bfc96 100644 --- a/plugins/jira/README.md +++ b/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" diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index 71224bdfb..e789fce92 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/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"