Skip to content

Commit 5bfcf28

Browse files
authored
Add legacy to Linux Consumption plan (#4425)
* Add legacy to Linux Consumption plan * Add a learnMore link to the hosting plan qp
1 parent 952d07e commit 5bfcf28

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/commands/createFunctionApp/FunctionAppHostingPlanStep.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,39 @@ import { type IFunctionAppWizardContext } from './IFunctionAppWizardContext';
1616
export class FunctionAppHostingPlanStep extends AzureWizardPromptStep<IFunctionAppWizardContext> {
1717
public async prompt(context: IFunctionAppWizardContext): Promise<void> {
1818
const placeHolder: string = localize('selectHostingPlan', 'Select a hosting plan.');
19-
const picks: IAzureQuickPickItem<[boolean, RegExp | undefined]>[] = [
20-
{ label: localize('flexConsumption', 'Flex Consumption'), data: [false, undefined] },
21-
{ label: localize('consumption', 'Consumption'), data: [true, undefined] },
22-
{ label: localize('premium', 'Premium'), data: [false, /^EP$/i] },
23-
{ label: localize('dedicated', 'App Service Plan'), data: [false, /^((?!EP|Y|FC).)*$/i] }
19+
const picks: IAzureQuickPickItem<[boolean, boolean, RegExp | undefined]>[] = [
20+
{ label: localize('flexConsumption', 'Flex Consumption'), data: [false, true, undefined] },
21+
{ label: localize('consumption', 'Linux Consumption'), description: localize('legacy', 'Legacy'), data: [true, false, undefined] },
22+
{ label: localize('premium', 'Premium'), data: [false, false, /^EP$/i] },
23+
{ label: localize('dedicated', 'App Service Plan'), data: [false, false, /^((?!EP|Y|FC).)*$/i] }
2424
];
2525

26-
[context.useConsumptionPlan, context.planSkuFamilyFilter] = (await context.ui.showQuickPick(picks, { placeHolder })).data;
26+
[context.useConsumptionPlan, context.useFlexConsumptionPlan, context.planSkuFamilyFilter] = (await context.ui.showQuickPick(picks, { placeHolder, learnMoreLink: 'aka.ms/flexconsumption' })).data;
2727
await setLocationsTask(context);
2828
if (context.useConsumptionPlan) {
2929
setConsumptionPlanProperties(context);
30-
} else if (!context.useConsumptionPlan && !context.planSkuFamilyFilter) {
31-
// if it's not consumption and has no filter, then it's flex consumption
30+
} else if (context.useFlexConsumptionPlan) {
3231
setFlexConsumptionPlanProperties(context);
3332
}
3433
}
3534

3635
public shouldPrompt(context: IFunctionAppWizardContext): boolean {
37-
return context.useConsumptionPlan === undefined && context.dockerfilePath === undefined;
36+
return context.useFlexConsumptionPlan === undefined && context.dockerfilePath === undefined;
3837
}
3938

4039
public configureBeforePrompt(context: IFunctionAppWizardContext): void | Promise<void> {
41-
if (!context.advancedCreation) {
40+
if (context.useFlexConsumptionPlan) {
4241
setFlexConsumptionPlanProperties(context);
4342
}
4443
}
4544
}
4645

47-
export function setConsumptionPlanProperties(context: IFunctionAppWizardContext): void {
46+
function setConsumptionPlanProperties(context: IFunctionAppWizardContext): void {
4847
context.newPlanName = `ASP-${nonNullProp(context, 'newSiteName')}-${getRandomHexString(4)}`;
4948
context.newPlanSku = { name: 'Y1', tier: 'Dynamic', size: 'Y1', family: 'Y', capacity: 0 };
5049
}
5150

52-
export function setFlexConsumptionPlanProperties(context: IAppServiceWizardContext): void {
51+
function setFlexConsumptionPlanProperties(context: IAppServiceWizardContext): void {
5352
context.newPlanName = `FLEX-${nonNullProp(context, 'newSiteName')}-${getRandomHexString(4)}`;
5453
context.newPlanSku = { name: 'FC1', tier: 'FlexConsumption', size: 'FC', family: 'FC' };
5554
// flex consumption only supports linux

src/commands/createFunctionApp/IFunctionAppWizardContext.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export interface IFunctionAppWizardContext extends IAppServiceWizardContext, ICr
2424
stackFilter?: string;
2525
newSiteStack?: FullFunctionAppStack;
2626
durableStorageType?: DurableBackendValues;
27+
useFlexConsumptionPlan?: boolean;
2728

2829
// Detected local connection string
2930
hasAzureStorageConnection?: boolean;

src/commands/createFunctionApp/createCreateFunctionAppComponents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export async function createCreateFunctionAppComponents(context: ICreateFunction
6565

6666
if (!wizardContext.advancedCreation) {
6767
LocationListStep.addStep(wizardContext, promptSteps);
68-
wizardContext.useConsumptionPlan = true;
68+
wizardContext.useFlexConsumptionPlan = true;
6969
wizardContext.stackFilter = getRootFunctionsWorkerRuntime(wizardContext.language);
7070
promptSteps.push(new ConfigureCommonNamesStep());
7171
executeSteps.push(new ResourceGroupCreateStep());

0 commit comments

Comments
 (0)