Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 47 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1410,10 +1410,10 @@
"@azure/core-client": "^1.7.3",
"@azure/core-rest-pipeline": "^1.11.0",
"@azure/storage-blob": "^12.5.0",
"@microsoft/vscode-azext-azureappservice": "^3.5.4",
"@microsoft/vscode-azext-azureappservice": "^3.6.0",
"@microsoft/vscode-azext-azureappsettings": "^0.2.8",
"@microsoft/vscode-azext-azureutils": "^3.1.7",
"@microsoft/vscode-azext-utils": "^2.6.6",
"@microsoft/vscode-azext-azureutils": "^3.2.1",
"@microsoft/vscode-azext-utils": "^3.0.1",
"@microsoft/vscode-azureresources-api": "^2.0.4",
"cross-fetch": "^4.0.0",
"escape-string-regexp": "^4.0.0",
Expand Down
8 changes: 5 additions & 3 deletions src/commands/addMIConnections/LocalSettingsAddStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { activitySuccessContext, activitySuccessIcon, AzExtFsExtra, AzureWizardExecuteStep, createUniversallyUniqueContextValue, GenericTreeItem, nonNullProp } from "@microsoft/vscode-azext-utils";
import { ActivityChildItem, ActivityChildType, activitySuccessContext, activitySuccessIcon, AzExtFsExtra, AzureWizardExecuteStep, createUniversallyUniqueContextValue, nonNullProp } from "@microsoft/vscode-azext-utils";
import { ext } from "../../extensionVariables";
import { getLocalSettingsJsonwithEncryption } from "../../funcConfig/local.settings";
import { localize } from "../../localize";
Expand All @@ -24,11 +24,13 @@ export class LocalSettingsAddStep extends AzureWizardExecuteStep<AddMIConnection
if (localSettings.Values) {
for (const connection of nonNullProp(context, 'connectionsToAdd')) {
localSettings.Values[connection.name] = connection.value;
// TODO: Convert to use createSuccessOutput
context.activityChildren?.push(
new GenericTreeItem(undefined, {
new ActivityChildItem({
contextValue: createUniversallyUniqueContextValue(['useExistingResourceGroupInfoItem', activitySuccessContext]),
label: localize('addedLocalSetting', 'Add local setting "{0}"', connection.name),
iconPath: activitySuccessIcon
iconPath: activitySuccessIcon,
activityType: ActivityChildType.Success
})
);
}
Expand Down
8 changes: 5 additions & 3 deletions src/commands/addMIConnections/RemoteSettingsAddStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { activitySuccessContext, activitySuccessIcon, AzureWizardExecuteStep, createUniversallyUniqueContextValue, GenericTreeItem, nonNullProp } from "@microsoft/vscode-azext-utils";
import { ActivityChildItem, ActivityChildType, activitySuccessContext, activitySuccessIcon, AzureWizardExecuteStep, createUniversallyUniqueContextValue, nonNullProp } from "@microsoft/vscode-azext-utils";
import { ext } from "../../extensionVariables";
import { localize } from "../../localize";
import { type AddMIConnectionsContext } from "./AddMIConnectionsContext";
Expand All @@ -21,11 +21,13 @@ export class RemoteSettingsAddStep extends AzureWizardExecuteStep<AddMIConnectio

await client.updateApplicationSettings({ properties });
for (const connection of nonNullProp(context, 'connectionsToAdd')) {
// TODO: Convert to use createSuccessOutput
context.activityChildren?.push(
new GenericTreeItem(undefined, {
new ActivityChildItem({
contextValue: createUniversallyUniqueContextValue(['useExistingResourceGroupInfoItem', activitySuccessContext]),
label: localize('addedAppSetting', 'Add app setting "{0}"', connection.name),
iconPath: activitySuccessIcon
iconPath: activitySuccessIcon,
activityType: ActivityChildType.Success
})
);
}
Expand Down
30 changes: 21 additions & 9 deletions src/commands/createFunctionApp/FunctionAppCreateStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { type Identity } from '@azure/arm-resources';
import { BlobServiceClient } from '@azure/storage-blob';
import { ParsedSite, WebsiteOS, type CustomLocation, type IAppServiceWizardContext } from '@microsoft/vscode-azext-azureappservice';
import { LocationListStep } from '@microsoft/vscode-azext-azureutils';
import { AzureWizardExecuteStep, maskUserInfo, parseError, randomUtils } from '@microsoft/vscode-azext-utils';
import { AzureWizardExecuteStepWithActivityOutput, maskUserInfo, parseError, randomUtils } from '@microsoft/vscode-azext-utils';
import { type AppResource } from '@microsoft/vscode-azext-utils/hostapi';
import { type Progress } from 'vscode';
import { FuncVersion, getMajorVersion } from '../../FuncVersion';
Expand All @@ -22,14 +22,14 @@ import { nonNullProp } from '../../utils/nonNull';
import { getStorageConnectionString } from '../appSettings/connectionSettings/getLocalConnectionSetting';
import { enableFileLogging } from '../logstream/enableFileLogging';
import { type FullFunctionAppStack, type IFlexFunctionAppWizardContext, type IFunctionAppWizardContext } from './IFunctionAppWizardContext';
import { showSiteCreated } from './showSiteCreated';
import { type Sku } from './stacks/models/FlexSkuModel';
import { type FunctionAppRuntimeSettings, } from './stacks/models/FunctionAppStackModel';

export class FunctionAppCreateStep extends AzureWizardExecuteStep<IFunctionAppWizardContext> {
export class FunctionAppCreateStep extends AzureWizardExecuteStepWithActivityOutput<IFunctionAppWizardContext> {
stepName: string = 'createFunctionAppStep';
public priority: number = 1000;

public async execute(context: IFlexFunctionAppWizardContext, progress: Progress<{ message?: string; increment?: number }>): Promise<void> {
public async execute(context: IFlexFunctionAppWizardContext, _progress: Progress<{ message?: string; increment?: number }>): Promise<void> {
const os: WebsiteOS = nonNullProp(context, 'newSiteOS');
const stack: FullFunctionAppStack = nonNullProp(context, 'newSiteStack');

Expand All @@ -39,10 +39,6 @@ export class FunctionAppCreateStep extends AzureWizardExecuteStep<IFunctionAppWi
context.telemetry.properties.newSiteMinorVersion = stack.minorVersion.value;
context.telemetry.properties.planSkuTier = context.plan?.sku?.tier;

const message: string = localize('creatingNewApp', 'Creating new function app "{0}"...', context.newSiteName);
ext.outputChannel.appendLog(message);
progress.report({ message });

const siteName: string = nonNullProp(context, 'newSiteName');
const rgName: string = nonNullProp(nonNullProp(context, 'resourceGroup'), 'name');

Expand All @@ -58,7 +54,6 @@ export class FunctionAppCreateStep extends AzureWizardExecuteStep<IFunctionAppWi
context.telemetry.properties.fileLoggingError = maskUserInfo(parseError(error).message, []);
}
}
showSiteCreated(site, context);
}

public shouldExecute(context: IFunctionAppWizardContext): boolean {
Expand Down Expand Up @@ -243,6 +238,23 @@ export class FunctionAppCreateStep extends AzureWizardExecuteStep<IFunctionAppWi

return result;
}

protected getTreeItemLabel(context: IFunctionAppWizardContext): string {
const siteName: string = nonNullProp(context, 'newSiteName');
return localize('creatingNewApp', 'Create new function app "{0}"', siteName);
}
protected getOutputLogSuccess(context: IFunctionAppWizardContext): string {
const siteName: string = nonNullProp(context, 'newSiteName');
return localize('createdNewApp', 'Successfully created new function app "{0}".', siteName);
}
protected getOutputLogFail(context: IFunctionAppWizardContext): string {
const siteName: string = nonNullProp(context, 'newSiteName');
return localize('failedToCreateNewApp', 'Failed to create new function app "{0}".', siteName);
}
protected getOutputLogProgress(context: IFunctionAppWizardContext): string {
const siteName: string = nonNullProp(context, 'newSiteName');
return localize('creatingNewApp', 'Creating new function app "{0}"...', siteName);
}
}

function getNewFileShareName(siteName: string): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,15 @@ import { AzureWizardExecuteStep, nonNullProp } from "@microsoft/vscode-azext-uti
import { type AppResource } from "@microsoft/vscode-azext-utils/hostapi";
import { type Progress } from "vscode";
import { webProvider } from "../../../constants";
import { ext } from "../../../extensionVariables";
import { localize } from "../../../localize";
import { createWebSiteClient } from "../../../utils/azureClients";
import { getStorageConnectionString } from "../../appSettings/connectionSettings/getLocalConnectionSetting";
import { type IFunctionAppWizardContext } from "../IFunctionAppWizardContext";
import { showSiteCreated } from "../showSiteCreated";

export class ContainerizedFunctionAppCreateStep extends AzureWizardExecuteStep<IFunctionAppWizardContext> {
public priority: number = 140;

public async execute(context: IFunctionAppWizardContext, progress: Progress<{ message?: string; increment?: number }>): Promise<void> {
const message: string = localize('creatingNewApp', 'Creating new function app "{0}"...', context.newSiteName);
ext.outputChannel.appendLog(message);
progress.report({ message });

public async execute(context: IFunctionAppWizardContext, _progress: Progress<{ message?: string; increment?: number }>): Promise<void> {
if (!context.deployWorkspaceResult?.registryLoginServer || !context.deployWorkspaceResult?.imageName) {
throw new Error(localize('failToCreateApp', 'Failed to create function app. There was an error creating the necessary container resources.'));
}
Expand All @@ -35,11 +29,7 @@ export class ContainerizedFunctionAppCreateStep extends AzureWizardExecuteStep<I
const client: WebSiteManagementClient = await createWebSiteClient(context);
context.site = await client.webApps.beginCreateOrUpdateAndWait(rgName, siteName, await this.getNewSite(context));
context.activityResult = context.site as AppResource;

const containerSite = Object.assign(context.site, { defaultHostUrl: `https://${context.site.defaultHostName}`, fullName: context.site.name, isSlot: false });

await pingContainerizedFunctionApp(context, client, context.site);
showSiteCreated(containerSite, context);
}

public shouldExecute(context: IFunctionAppWizardContext): boolean {
Expand Down Expand Up @@ -84,6 +74,23 @@ export class ContainerizedFunctionAppCreateStep extends AzureWizardExecuteStep<I
}
}
}

protected getTreeItemLabel(context: IFunctionAppWizardContext): string {
const siteName: string = nonNullProp(context, 'newSiteName');
return localize('creatingNewApp', 'Create new function app "{0}"', siteName);
}
protected getOutputLogSuccess(context: IFunctionAppWizardContext): string {
const siteName: string = nonNullProp(context, 'newSiteName');
return localize('createdNewApp', 'Successfully created new function app "{0}".', siteName);
}
protected getOutputLogFail(context: IFunctionAppWizardContext): string {
const siteName: string = nonNullProp(context, 'newSiteName');
return localize('failedToCreateNewApp', 'Failed to create new function app "{0}".', siteName);
}
protected getOutputLogProgress(context: IFunctionAppWizardContext): string {
const siteName: string = nonNullProp(context, 'newSiteName');
return localize('creatingNewApp', 'Creating new function app "{0}"...', siteName);
}
}

async function pingContainerizedFunctionApp(context: IFunctionAppWizardContext, client: WebSiteManagementClient, site: Site): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export async function createCreateFunctionAppComponents(context: ICreateFunction
...(await createActivityContext())
});

wizardContext.activityChildren = [];

const promptSteps: AzureWizardPromptStep<IFunctionAppWizardContext>[] = [];
const executeSteps: AzureWizardExecuteStep<IFunctionAppWizardContext>[] = [];

Expand Down
2 changes: 0 additions & 2 deletions src/commands/createFunctionApp/createFunctionApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { localize } from '../../localize';
import { type SlotTreeItem } from '../../tree/SlotTreeItem';
import { SubscriptionTreeItem, type ICreateFunctionAppContext } from '../../tree/SubscriptionTreeItem';
import { type ContainerTreeItem } from '../../tree/containerizedFunctionApp/ContainerTreeItem';
import { type ISiteCreatedOptions } from './showSiteCreated';

function isSubscription(item?: AzExtParentTreeItem): boolean {
try {
Expand All @@ -36,7 +35,6 @@ export async function createFunctionApp(context: IActionContext & Partial<ICreat
}

context.newResourceGroupName = newResourceGroupName;
(<ISiteCreatedOptions>context).showCreatedNotification = true;

const funcAppNode: SlotTreeItem | ContainerTreeItem = await SubscriptionTreeItem.createChild(context as ICreateFunctionAppContext, node as SubscriptionTreeItem);

Expand Down
Loading