44 *--------------------------------------------------------------------------------------------*/
55
66import { getGitHubAccessToken } from "@microsoft/vscode-azext-github" ;
7- import { AzureWizard , AzureWizardExecuteStep , ITreeItemPickerContext , createSubscriptionContext } from "@microsoft/vscode-azext-utils" ;
7+ import { AzureWizard , AzureWizardExecuteStep , AzureWizardPromptStep , ITreeItemPickerContext , createSubscriptionContext } from "@microsoft/vscode-azext-utils" ;
88import { ContainerAppsItem } from "../../../tree/ContainerAppsBranchDataProvider" ;
99import { ActionsItem } from "../../../tree/configurations/ActionsItem" ;
1010import { createActivityContext } from "../../../utils/activityUtils" ;
1111import { localize } from "../../../utils/localize" ;
1212import { pickContainerApp } from "../../../utils/pickItem/pickContainerApp" ;
13- import { isGitHubConnected } from "../connectToGitHub/isGitHubConnected" ;
13+ import { getContainerAppSourceControl } from "../connectToGitHub/getContainerAppSourceControl" ;
14+ import { DisconnectRepositoryConfirmStep } from "./DisconnectRepositoryConfirmStep" ;
1415import { GitHubRepositoryDisconnectStep } from "./GitHubRepositoryDisconnectStep" ;
1516import { IDisconnectRepoContext } from "./IDisconnectRepoContext" ;
1617
17- export async function disconnectRepo ( context : ITreeItemPickerContext & Partial < IDisconnectRepoContext > , node ?: ContainerAppsItem | ActionsItem ) : Promise < void > {
18+ export async function disconnectRepo ( context : ITreeItemPickerContext , node ?: ContainerAppsItem | ActionsItem ) : Promise < void > {
1819 if ( ! node ) {
1920 context . suppressCreatePick = true ;
2021 node = await pickContainerApp ( context ) ;
@@ -28,27 +29,30 @@ export async function disconnectRepo(context: ITreeItemPickerContext & Partial<I
2829 ...await createActivityContext ( ) ,
2930 subscription,
3031 containerApp,
31- gitHubAccessToken : await getGitHubAccessToken ( )
32+ gitHubAccessToken : await getGitHubAccessToken ( ) ,
33+ sourceControl : await getContainerAppSourceControl ( context , subscription , containerApp )
3234 } ;
3335
34- if ( ! await isGitHubConnected ( wizardContext ) ) {
36+ if ( ! wizardContext . sourceControl ) {
3537 throw new Error ( localize ( 'repositoryNotConnected' , '"{0}" is not connected to a GitHub repository.' , containerApp . name ) ) ;
3638 }
3739
38- const title : string = localize ( 'disconnectRepository' , 'Disconnect "{0}" from a GitHub repository' , containerApp . name ) ;
40+ const promptSteps : AzureWizardPromptStep < IDisconnectRepoContext > [ ] = [
41+ new DisconnectRepositoryConfirmStep ( )
42+ ] ;
3943
4044 const executeSteps : AzureWizardExecuteStep < IDisconnectRepoContext > [ ] = [
4145 new GitHubRepositoryDisconnectStep ( )
4246 ] ;
4347
4448 const wizard : AzureWizard < IDisconnectRepoContext > = new AzureWizard ( wizardContext , {
45- title,
49+ title : localize ( 'disconnectRepository' , 'Disconnect "{0}" from a GitHub repository' , containerApp . name ) ,
50+ promptSteps,
4651 executeSteps,
4752 showLoadingPrompt : true
4853 } ) ;
4954
50- // Title normally gets set during prompt phase... since no prompt steps are provided we must set the 'activityTitle' manually
51- wizardContext . activityTitle = title ;
55+ await wizard . prompt ( ) ;
5256 await wizard . execute ( ) ;
5357}
5458
0 commit comments