1
1
import { isMinimalIssue , MinimalIssue , MinimalIssueOrKeyAndSite } from '@atlassianlabs/jira-pi-common-models' ;
2
- import { commands , env , ExtensionContext , Uri } from 'vscode' ;
2
+ import { commands , env , ExtensionContext , Uri , window } from 'vscode' ;
3
3
4
4
import {
5
5
cloneRepositoryButtonEvent ,
@@ -19,6 +19,7 @@ import { startWorkOnIssue } from './commands/jira/startWorkOnIssue';
19
19
import { configuration } from './config/configuration' ;
20
20
import { HelpTreeViewId } from './constants' ;
21
21
import { Container } from './container' ;
22
+ import { transitionIssue } from './jira/transitionIssue' ;
22
23
import { knownLinkIdMap } from './lib/ipc/models/common' ;
23
24
import { ConfigSection , ConfigSubSection } from './lib/ipc/models/config' ;
24
25
import { AbstractBaseNode } from './views/nodes/abstractBaseNode' ;
@@ -71,6 +72,7 @@ export enum Commands {
71
72
ShowOnboardingPage = 'atlascode.showOnboardingPage' ,
72
73
ShowPullRequestDetailsPage = 'atlascode.showPullRequestDetailsPage' ,
73
74
AssignIssueToMe = 'atlascode.jira.assignIssueToMe' ,
75
+ TransitionIssue = 'atlascode.jira.transitionIssue' ,
74
76
StartWorkOnIssue = 'atlascode.jira.startWorkOnIssue' ,
75
77
CreatePullRequest = 'atlascode.bb.createPullRequest' ,
76
78
RerunPipeline = 'atlascode.bb.rerunPipeline' ,
@@ -193,6 +195,32 @@ export function registerCommands(vscodeContext: ExtensionContext) {
193
195
commands . executeCommand ( Commands . ShowIssue , issueNode . issue ) ,
194
196
) ,
195
197
commands . registerCommand ( Commands . AssignIssueToMe , ( issueNode : IssueNode ) => assignIssue ( issueNode ) ) ,
198
+ commands . registerCommand ( Commands . TransitionIssue , async ( issueNode : IssueNode ) => {
199
+ const issue = issueNode . issue as MinimalIssue < DetailedSiteInfo > ;
200
+ window
201
+ . showQuickPick (
202
+ issue . transitions . map ( ( x ) => ( {
203
+ label : x . name ,
204
+ detail : x . name !== x . to . name ? `${ x . to . name } ` : '' ,
205
+ } ) ) ,
206
+ {
207
+ placeHolder : `Select a transition for ${ issue . key } ` ,
208
+ } ,
209
+ )
210
+ . then ( async ( transition ) => {
211
+ if ( ! transition ) {
212
+ return ;
213
+ }
214
+
215
+ const target = issue . transitions . find ( ( x ) => x . name === transition . label ) ;
216
+ if ( ! target ) {
217
+ window . showErrorMessage ( `Transition ${ transition . label } not found` ) ;
218
+ return ;
219
+ }
220
+
221
+ await transitionIssue ( issue , target ) ;
222
+ } ) ;
223
+ } ) ,
196
224
commands . registerCommand (
197
225
Commands . StartWorkOnIssue ,
198
226
( issueNodeOrMinimalIssue : IssueNode | MinimalIssue < DetailedSiteInfo > ) =>
0 commit comments