Skip to content

Commit

Permalink
Remove Node V4 preview label and make it the default (#3834)
Browse files Browse the repository at this point in the history
  • Loading branch information
nturinski authored Sep 11, 2023
1 parent d1249d4 commit abb35de
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
3 changes: 2 additions & 1 deletion src/commands/createFunctionApp/stacks/getStackPicks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { AzExtPipelineResponse, createGenericClient } from '@microsoft/vscode-az
import { IAzureQuickPickItem, openUrl, parseError } from '@microsoft/vscode-azext-utils';
import { FuncVersion, funcVersionLink } from '../../../FuncVersion';
import { hiddenStacksSetting, noRuntimeStacksAvailableLabel } from '../../../constants';
import { previewDescription } from '../../../constants-nls';
import { localize } from '../../../localize';
import { requestUtils } from '../../../utils/requestUtils';
import { getWorkspaceSetting } from '../../../vsCodeConfig/settings';
Expand Down Expand Up @@ -37,7 +38,7 @@ export async function getStackPicks(context: IFunctionAppWizardContext): Promise
const previewOs = getFlagOs(minorVersion.stackSettings, 'isPreview');
switch (previewOs) {
case 'All':
description = localize('preview', '(Preview)');
description = previewDescription;
break;
case 'Linux':
case 'Windows':
Expand Down
15 changes: 5 additions & 10 deletions src/commands/createNewProject/ProgrammingModelStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,20 @@ import { AzureWizardPromptStep, IAzureQuickPickItem, IAzureQuickPickOptions, non
import { localize } from '../../localize';
import { IProjectWizardContext } from './IProjectWizardContext';

type ProgrammingModel = { modelVersion: number | undefined, label: string };
export class ProgrammingModelStep extends AzureWizardPromptStep<IProjectWizardContext> {
public hideStepCount: boolean = true;
private _models: ProgrammingModel[] = [];
private _models: IAzureQuickPickItem<number | undefined>[] = [];
private _learnMoreLink: string | undefined;

public constructor(options: { models: ProgrammingModel | ProgrammingModel[], learnMoreLink?: string }) {
public constructor(options: { models: IAzureQuickPickItem<number | undefined>[], learnMoreLink?: string }) {
super();
this._models = Array.isArray(options.models) ? options.models : [options.models];
this._learnMoreLink = options.learnMoreLink;
}

public async prompt(context: IProjectWizardContext): Promise<void> {
const modelsPick: IAzureQuickPickItem<number | undefined>[] = this._models.map(model => {
return {
label: model.label,
data: model.modelVersion
}
});
// duplicate the array so we don't modify the original
const modelsPick: IAzureQuickPickItem<number | undefined>[] = this._models.slice();

const learnMoreQp = { label: localize('learnMore', '$(link-external) Learn more about Model V4...'), description: '', data: undefined };
if (this._learnMoreLink) {
Expand Down Expand Up @@ -53,7 +48,7 @@ export class ProgrammingModelStep extends AzureWizardPromptStep<IProjectWizardCo
public shouldPrompt(context: IProjectWizardContext): boolean {
// auto-select the default model if there is only one
if (this._models.length === 1) {
context.languageModel = this._models[0].modelVersion;
context.languageModel = this._models[0].data;
}

// this only impacts node for now so only check the feature flag for node
Expand Down
8 changes: 5 additions & 3 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { IAzureQuickPickItem } from "@microsoft/vscode-azext-utils";
import { defaultDescription } from "./constants-nls";
import { localize } from "./localize";

export const extensionId: string = 'ms-azuretools.vscode-azurefunctions';
Expand Down Expand Up @@ -167,10 +169,10 @@ export const azureWebJobsFeatureFlags: string = 'AzureWebJobsFeatureFlags';
* Any significantly changed new model should use an incremented number.
*/
export const nodeV4ModelVersion: number = 4;
export const nodeV4Model: { modelVersion: number, label: string } = { modelVersion: nodeV4ModelVersion, label: localize('modelV4', 'Model V4 (Preview)') };
export const nodeDefaultModel: { modelVersion: undefined, label: string } = { modelVersion: undefined, label: localize('modelV3', 'Model V3') }
export const nodeDefaultModel: IAzureQuickPickItem<number | undefined> = { data: nodeV4ModelVersion, label: localize('modelV4', 'Model V4'), description: defaultDescription };
export const nodeV3Model: IAzureQuickPickItem<number | undefined> = { data: undefined, label: localize('modelV3', 'Model V3') }

export const nodeModels = [nodeDefaultModel, nodeV4Model];
export const nodeModels = [nodeDefaultModel, nodeV3Model];
export const nodeLearnMoreLink = 'https://aka.ms/AzFuncNodeV4';

export const webProvider: string = 'Microsoft.Web';
Expand Down

0 comments on commit abb35de

Please sign in to comment.