1
1
import { md5 } from '@env/crypto' ;
2
2
import slug from 'slug' ;
3
- import type { QuickPick } from 'vscode' ;
3
+ import type { QuickInputButton , QuickPick } from 'vscode' ;
4
4
import { Uri } from 'vscode' ;
5
5
import type {
6
6
AsyncStepResultGenerator ,
@@ -18,7 +18,7 @@ import {
18
18
QuickCommand ,
19
19
StepResultBreak ,
20
20
} from '../../commands/quickCommand' ;
21
- import { OpenOnGitHubQuickInputButton } from '../../commands/quickCommand.buttons' ;
21
+ import { OpenOnGitHubQuickInputButton , OpenOnJiraQuickInputButton } from '../../commands/quickCommand.buttons' ;
22
22
import { getSteps } from '../../commands/quickWizard.utils' ;
23
23
import { proBadge } from '../../constants' ;
24
24
import type { IntegrationId } from '../../constants.integrations' ;
@@ -414,7 +414,8 @@ export class StartWorkCommand extends QuickCommand<State> {
414
414
opened : boolean ,
415
415
) : StepResultGenerator < StartWorkItem | StartWorkTypeItem > {
416
416
const buildIssueItem = ( i : StartWorkItem ) => {
417
- const buttons = i . item . issue . url ? [ OpenOnGitHubQuickInputButton ] : [ ] ;
417
+ const onWebbButton = i . item . issue . url ? getOpenOnWebQuickInputButton ( i . item . issue . provider . id ) : undefined ;
418
+ const buttons = onWebbButton ? [ onWebbButton ] : [ ] ;
418
419
const hoverContent = i . item . issue . body ? `${ repeatSpaces ( 200 ) } \n\n${ i . item . issue . body } ` : '' ;
419
420
return {
420
421
label :
@@ -499,11 +500,18 @@ export class StartWorkCommand extends QuickCommand<State> {
499
500
items : [ ] ,
500
501
onDidActivate : updateItems ,
501
502
onDidClickItemButton : ( _quickpick , button , { item } ) => {
502
- if ( button === OpenOnGitHubQuickInputButton && ! isStartWorkTypeItem ( item ) ) {
503
- this . open ( item ) ;
504
- return undefined ;
503
+ if ( isStartWorkTypeItem ( item ) ) {
504
+ return false ;
505
+ }
506
+
507
+ switch ( button ) {
508
+ case OpenOnGitHubQuickInputButton :
509
+ case OpenOnJiraQuickInputButton :
510
+ this . open ( item ) ;
511
+ return undefined ;
512
+ default :
513
+ return false ;
505
514
}
506
- return false ;
507
515
} ,
508
516
onDidChangeValue : ( ) => true ,
509
517
} ) ;
@@ -576,3 +584,14 @@ function repeatSpaces(count: number) {
576
584
export function getStartWorkItemIdHash ( item : StartWorkItem ) {
577
585
return md5 ( item . item . issue . id ) ;
578
586
}
587
+
588
+ function getOpenOnWebQuickInputButton ( integrationId : string ) : QuickInputButton | undefined {
589
+ switch ( integrationId ) {
590
+ case HostingIntegrationId . GitHub :
591
+ return OpenOnGitHubQuickInputButton ;
592
+ case IssueIntegrationId . Jira :
593
+ return OpenOnJiraQuickInputButton ;
594
+ default :
595
+ return undefined ;
596
+ }
597
+ }
0 commit comments