diff --git a/src/commands/createFunctionApp/FunctionAppHostingPlanStep.ts b/src/commands/createFunctionApp/FunctionAppHostingPlanStep.ts index 32dd3e42..bee503e9 100644 --- a/src/commands/createFunctionApp/FunctionAppHostingPlanStep.ts +++ b/src/commands/createFunctionApp/FunctionAppHostingPlanStep.ts @@ -3,14 +3,15 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { AppServicePlanListStep, setLocationsTask, type IAppServiceWizardContext } from '@microsoft/vscode-azext-azureappservice'; +import { AppServicePlanListStep, setLocationsTask } from '@microsoft/vscode-azext-azureappservice'; import { AzureWizardPromptStep, type IAzureQuickPickItem, type IWizardOptions } from '@microsoft/vscode-azext-utils'; import { localize } from '../../localize'; import { getRandomHexString } from '../../utils/fs'; import { nonNullProp } from '../../utils/nonNull'; +import { type IFunctionAppWizardContext } from './IFunctionAppWizardContext'; -export class FunctionAppHostingPlanStep extends AzureWizardPromptStep { - public async prompt(context: IAppServiceWizardContext): Promise { +export class FunctionAppHostingPlanStep extends AzureWizardPromptStep { + public async prompt(context: IFunctionAppWizardContext): Promise { const placeHolder: string = localize('selectHostingPlan', 'Select a hosting plan.'); const picks: IAzureQuickPickItem<[boolean, RegExp | undefined]>[] = [ { label: localize('consumption', 'Consumption'), data: [true, undefined] }, @@ -25,16 +26,16 @@ export class FunctionAppHostingPlanStep extends AzureWizardPromptStep | undefined> { + public async getSubWizard(_context: IFunctionAppWizardContext): Promise | undefined> { return { promptSteps: [new AppServicePlanListStep()] }; } } -export function setConsumptionPlanProperties(context: IAppServiceWizardContext): void { +export function setConsumptionPlanProperties(context: IFunctionAppWizardContext): void { context.newPlanName = `ASP-${nonNullProp(context, 'newSiteName')}-${getRandomHexString(4)}`; context.newPlanSku = { name: 'Y1', tier: 'Dynamic', size: 'Y1', family: 'Y', capacity: 0 }; } diff --git a/src/commands/createFunctionApp/IFunctionAppWizardContext.ts b/src/commands/createFunctionApp/IFunctionAppWizardContext.ts index 7cef3e02..15e79cca 100644 --- a/src/commands/createFunctionApp/IFunctionAppWizardContext.ts +++ b/src/commands/createFunctionApp/IFunctionAppWizardContext.ts @@ -29,6 +29,8 @@ export interface IFunctionAppWizardContext extends IAppServiceWizardContext, ICr hasAzureStorageConnection?: boolean; hasEventHubsConnection?: boolean; hasSqlDbConnection?: boolean; +} +export interface IFunctionAppAgentWizardContext extends IFunctionAppWizardContext { ui: IAzureAgentInput; } diff --git a/src/tree/SubscriptionTreeItem.ts b/src/tree/SubscriptionTreeItem.ts index a12893d6..7a3d5a05 100644 --- a/src/tree/SubscriptionTreeItem.ts +++ b/src/tree/SubscriptionTreeItem.ts @@ -118,6 +118,16 @@ export class SubscriptionTreeItem extends SubscriptionTreeItemBase { await detectDockerfile(context); + if (context.dockerfilePath) { + const containerizedfunctionAppWizard = await createContainerizedFunctionAppWizard(); + promptSteps.push(...containerizedfunctionAppWizard.promptSteps); + executeSteps.push(...containerizedfunctionAppWizard.executeSteps); + } else { + const functionAppWizard = await createFunctionAppWizard(wizardContext); + promptSteps.push(...functionAppWizard.promptSteps); + executeSteps.push(...functionAppWizard.executeSteps); + } + if (!wizardContext.advancedCreation) { LocationListStep.addStep(wizardContext, promptSteps); wizardContext.useConsumptionPlan = true; @@ -152,15 +162,6 @@ export class SubscriptionTreeItem extends SubscriptionTreeItemBase { promptSteps.push(new AppInsightsListStep()); } - if (context.dockerfilePath) { - const containerizedfunctionAppWizard = await createContainerizedFunctionAppWizard(); - promptSteps.push(...containerizedfunctionAppWizard.promptSteps); - executeSteps.push(...containerizedfunctionAppWizard.executeSteps); - } else { - const functionAppWizard = await createFunctionAppWizard(wizardContext); - promptSteps.push(...functionAppWizard.promptSteps); - executeSteps.push(...functionAppWizard.executeSteps); - } const storageProvider = 'Microsoft.Storage'; LocationListStep.addProviderForFiltering(wizardContext, storageProvider, 'storageAccounts');