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,11 +18,11 @@ 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' ;
25- import { HostingIntegrationId , IssueIntegrationId } from '../../constants.integrations' ;
25+ import { HostingIntegrationId , IssueIntegrationId , SelfHostedIntegrationId } from '../../constants.integrations' ;
2626import type { Source , Sources , StartWorkTelemetryContext } from '../../constants.telemetry' ;
2727import type { Container } from '../../container' ;
2828import type { Issue , IssueShape , SearchedIssue } from '../../git/models/issue' ;
@@ -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 return {
419420 label :
420421 i . item . issue . title . length > 60 ? `${ i . item . issue . title . substring ( 0 , 60 ) } ...` : i . item . issue . title ,
@@ -497,11 +498,18 @@ export class StartWorkCommand extends QuickCommand<State> {
497498 items : [ ] ,
498499 onDidActivate : updateItems ,
499500 onDidClickItemButton : ( _quickpick , button , { item } ) => {
500- if ( button === OpenOnGitHubQuickInputButton && ! isStartWorkTypeItem ( item ) ) {
501- this . open ( item ) ;
502- return true ;
501+ if ( isStartWorkTypeItem ( item ) ) {
502+ return false ;
503+ }
504+
505+ switch ( button ) {
506+ case OpenOnGitHubQuickInputButton :
507+ case OpenOnJiraQuickInputButton :
508+ this . open ( item ) ;
509+ return true ;
510+ default :
511+ return false ;
503512 }
504- return false ;
505513 } ,
506514 } ) ;
507515
@@ -569,3 +577,15 @@ function isStartWorkTypeItem(item: unknown): item is StartWorkTypeItem {
569577export function getStartWorkItemIdHash ( item : StartWorkItem ) {
570578 return md5 ( item . item . issue . id ) ;
571579}
580+
581+ function getOpenOnWebQuickInputButton ( integrationId : string ) : QuickInputButton | undefined {
582+ switch ( integrationId ) {
583+ case HostingIntegrationId . GitHub :
584+ case SelfHostedIntegrationId . GitHubEnterprise :
585+ return OpenOnGitHubQuickInputButton ;
586+ case IssueIntegrationId . Jira :
587+ return OpenOnJiraQuickInputButton ;
588+ default :
589+ return undefined ;
590+ }
591+ }
0 commit comments