11import { md5 } from '@env/crypto' ;
22import slug from 'slug' ;
3- import type { QuickPick } from 'vscode' ;
3+ import type { QuickInputButton , QuickPick } from 'vscode' ;
44import { Uri } from 'vscode' ;
55import type {
66 AsyncStepResultGenerator ,
@@ -18,7 +18,7 @@ import {
1818 QuickCommand ,
1919 StepResultBreak ,
2020} from '../../commands/quickCommand' ;
21- import { OpenOnGitHubQuickInputButton } from '../../commands/quickCommand.buttons' ;
21+ import { OpenOnGitHubQuickInputButton , OpenOnJiraQuickInputButton } from '../../commands/quickCommand.buttons' ;
2222import { getSteps } from '../../commands/quickWizard.utils' ;
2323import { proBadge } from '../../constants' ;
2424import type { IntegrationId } from '../../constants.integrations' ;
@@ -414,7 +414,8 @@ export class StartWorkCommand extends QuickCommand<State> {
414414 opened : boolean ,
415415 ) : StepResultGenerator < StartWorkItem | StartWorkTypeItem > {
416416 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 ] : [ ] ;
418419 const hoverContent = i . item . issue . body ? `${ repeatSpaces ( 200 ) } \n\n${ i . item . issue . body } ` : '' ;
419420 return {
420421 label :
@@ -499,11 +500,18 @@ export class StartWorkCommand extends QuickCommand<State> {
499500 items : [ ] ,
500501 onDidActivate : updateItems ,
501502 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 ;
505514 }
506- return false ;
507515 } ,
508516 onDidChangeValue : ( ) => true ,
509517 } ) ;
@@ -576,3 +584,14 @@ function repeatSpaces(count: number) {
576584export function getStartWorkItemIdHash ( item : StartWorkItem ) {
577585 return md5 ( item . item . issue . id ) ;
578586}
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