33 * Licensed under the MIT License. See License.txt in the project root for license information.
44 *--------------------------------------------------------------------------------------------*/
55
6- import { SubscriptionTreeItemBase } from "@microsoft/vscode-azext-azureutils" ;
7- import { ISubscriptionContext } from "@microsoft/vscode-azext-dev" ;
8- import { callWithMaskHandling , IActionContext , ISubscriptionActionContext } from "@microsoft/vscode-azext-utils" ;
6+ import { callWithMaskHandling , createSubscriptionContext , ISubscriptionActionContext , ITreeItemPickerContext } from "@microsoft/vscode-azext-utils" ;
97import { acrDomain } from "../../constants" ;
10- import { ext } from "../../extensionVariables" ;
118import { detectRegistryDomain , getRegistryFromAcrName } from "../../utils/imageNameUtils" ;
9+ import { pickContainerApp } from "../../utils/pickContainerApp" ;
1210import { deployImage } from "./deployImage" ;
1311import { IDeployImageContext } from "./IDeployImageContext" ;
1412
@@ -21,9 +19,12 @@ interface DeployImageToAcaOptionsContract {
2119 secret ?: string ;
2220}
2321
24- export async function deployImageApi ( context : IActionContext & Partial < IDeployImageContext > , deployImageOptions : DeployImageToAcaOptionsContract ) : Promise < void > {
25- const subscription : ISubscriptionContext = ( await ext . rgApi . appResourceTree . showTreeItemPicker < SubscriptionTreeItemBase > ( SubscriptionTreeItemBase . contextValue , context ) ) . subscription ;
26- Object . assign ( context , subscription , deployImageOptions ) ;
22+ export async function deployImageApi ( context : ITreeItemPickerContext & Partial < IDeployImageContext > , deployImageOptions : DeployImageToAcaOptionsContract ) : Promise < void > {
23+ context . suppressCreatePick = true ;
24+ const node = await pickContainerApp ( context ) ;
25+ const { subscription } = node ;
26+
27+ Object . assign ( context , { ...createSubscriptionContext ( subscription ) } , deployImageOptions ) ;
2728
2829 context . registryDomain = detectRegistryDomain ( deployImageOptions . registryName ) ;
2930 if ( context . registryDomain === acrDomain ) {
@@ -40,8 +41,8 @@ export async function deployImageApi(context: IActionContext & Partial<IDeployIm
4041 context . valuesToMask . push ( deployImageOptions . image ) ;
4142
4243 if ( deployImageOptions . secret ) {
43- return callWithMaskHandling < void > ( ( ) => deployImage ( context , undefined ) , deployImageOptions . secret ) ;
44+ return callWithMaskHandling < void > ( ( ) => deployImage ( context , node ) , deployImageOptions . secret ) ;
4445 } else {
45- return deployImage ( context , undefined ) ;
46+ return deployImage ( context , node ) ;
4647 }
4748}
0 commit comments