Skip to content

Commit f70da16

Browse files
committed
Address nitmaster Matts comments
1 parent aaa262e commit f70da16

File tree

4 files changed

+24
-14
lines changed

4 files changed

+24
-14
lines changed

src/commands/addMIConnections/LocalSettingsAddStep.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.md in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { ActivityChildItem, ActivityChildType, activitySuccessContext, activitySuccessIcon, AzExtFsExtra, AzureWizardExecuteStep, createUniversallyUniqueContextValue, nonNullProp } from "@microsoft/vscode-azext-utils";
6+
import { ActivityChildItem, ActivityChildType, activitySuccessIcon, AzExtFsExtra, AzureWizardExecuteStep, createContextValue, nonNullProp } from "@microsoft/vscode-azext-utils";
77
import { ext } from "../../extensionVariables";
88
import { getLocalSettingsJsonwithEncryption } from "../../funcConfig/local.settings";
99
import { localize } from "../../localize";
@@ -12,6 +12,7 @@ import { type AddMIConnectionsContext } from "./AddMIConnectionsContext";
1212

1313
export class LocalSettingsAddStep extends AzureWizardExecuteStep<AddMIConnectionsContext> {
1414
public priority: number = 160;
15+
public stepName: string = 'localSettingsAddStep';
1516

1617
public async execute(context: AddMIConnectionsContext): Promise<void> {
1718
// If right clicking on a connection we will have the connections to convert but not the local settings path
@@ -22,12 +23,13 @@ export class LocalSettingsAddStep extends AzureWizardExecuteStep<AddMIConnection
2223

2324
const localSettings = await getLocalSettingsJsonwithEncryption(context, context.localSettingsPath);
2425
if (localSettings.Values) {
26+
// Potentially split this up into multiple execute steps to allow for better progress reporting
2527
for (const connection of nonNullProp(context, 'connectionsToAdd')) {
2628
localSettings.Values[connection.name] = connection.value;
2729
// TODO: Convert to use createSuccessOutput
2830
context.activityChildren?.push(
2931
new ActivityChildItem({
30-
contextValue: createUniversallyUniqueContextValue(['useExistingResourceGroupInfoItem', activitySuccessContext]),
32+
contextValue: createContextValue([this.stepName]),
3133
label: localize('addedLocalSetting', 'Add local setting "{0}"', connection.name),
3234
iconPath: activitySuccessIcon,
3335
activityType: ActivityChildType.Success

src/commands/addMIConnections/RemoteSettingsAddStep.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@
33
* Licensed under the MIT License. See License.md in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { ActivityChildItem, ActivityChildType, activitySuccessContext, activitySuccessIcon, AzureWizardExecuteStep, createUniversallyUniqueContextValue, nonNullProp } from "@microsoft/vscode-azext-utils";
6+
import { ActivityChildItem, ActivityChildType, activitySuccessIcon, AzureWizardExecuteStep, createContextValue, nonNullProp } from "@microsoft/vscode-azext-utils";
77
import { ext } from "../../extensionVariables";
88
import { localize } from "../../localize";
99
import { type AddMIConnectionsContext } from "./AddMIConnectionsContext";
1010

1111
export class RemoteSettingsAddStep extends AzureWizardExecuteStep<AddMIConnectionsContext> {
1212
public priority: number = 160;
13+
public stepName: string = 'remoteSettingsAddStep';
1314

1415
public async execute(context: AddMIConnectionsContext): Promise<void> {
1516
const client = await nonNullProp(context, 'functionapp').site.createClient(context);
1617
const remoteSettings = await client.listApplicationSettings();
1718
const properties = remoteSettings.properties || {};
19+
// // Potentially split this up into multiple execute steps to allow for better progress reporting
1820
for (const connection of nonNullProp(context, 'connectionsToAdd')) {
1921
properties[connection.name] = connection.value;
2022
}
@@ -24,7 +26,7 @@ export class RemoteSettingsAddStep extends AzureWizardExecuteStep<AddMIConnectio
2426
// TODO: Convert to use createSuccessOutput
2527
context.activityChildren?.push(
2628
new ActivityChildItem({
27-
contextValue: createUniversallyUniqueContextValue(['useExistingResourceGroupInfoItem', activitySuccessContext]),
29+
contextValue: createContextValue([this.stepName]),
2830
label: localize('addedAppSetting', 'Add app setting "{0}"', connection.name),
2931
iconPath: activitySuccessIcon,
3032
activityType: ActivityChildType.Success

src/commands/createFunctionApp/FunctionAppCreateStep.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class FunctionAppCreateStep extends AzureWizardExecuteStepWithActivityOut
2929
stepName: string = 'createFunctionAppStep';
3030
public priority: number = 1000;
3131

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

@@ -39,6 +39,9 @@ export class FunctionAppCreateStep extends AzureWizardExecuteStepWithActivityOut
3939
context.telemetry.properties.newSiteMinorVersion = stack.minorVersion.value;
4040
context.telemetry.properties.planSkuTier = context.plan?.sku?.tier;
4141

42+
const message: string = localize('creatingFuncApp', 'Creating function app "{0}"...', context.newSiteName);
43+
progress.report({ message });
44+
4245
const siteName: string = nonNullProp(context, 'newSiteName');
4346
const rgName: string = nonNullProp(nonNullProp(context, 'resourceGroup'), 'name');
4447

@@ -241,19 +244,19 @@ export class FunctionAppCreateStep extends AzureWizardExecuteStepWithActivityOut
241244

242245
protected getTreeItemLabel(context: IFunctionAppWizardContext): string {
243246
const siteName: string = nonNullProp(context, 'newSiteName');
244-
return localize('creatingNewApp', 'Create new function app "{0}"', siteName);
247+
return localize('creatingNewApp', 'Create function app "{0}"', siteName);
245248
}
246249
protected getOutputLogSuccess(context: IFunctionAppWizardContext): string {
247250
const siteName: string = nonNullProp(context, 'newSiteName');
248-
return localize('createdNewApp', 'Successfully created new function app "{0}".', siteName);
251+
return localize('createdNewApp', 'Successfully created function app "{0}".', siteName);
249252
}
250253
protected getOutputLogFail(context: IFunctionAppWizardContext): string {
251254
const siteName: string = nonNullProp(context, 'newSiteName');
252-
return localize('failedToCreateNewApp', 'Failed to create new function app "{0}".', siteName);
255+
return localize('failedToCreateNewApp', 'Failed to create function app "{0}".', siteName);
253256
}
254257
protected getOutputLogProgress(context: IFunctionAppWizardContext): string {
255258
const siteName: string = nonNullProp(context, 'newSiteName');
256-
return localize('creatingNewApp', 'Creating new function app "{0}"...', siteName);
259+
return localize('creatingNewApp', 'Creating function app "{0}"...', siteName);
257260
}
258261
}
259262

src/commands/createFunctionApp/containerImage/ContainerizedFunctionAppCreateStep.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@ import { type IFunctionAppWizardContext } from "../IFunctionAppWizardContext";
1919
export class ContainerizedFunctionAppCreateStep extends AzureWizardExecuteStep<IFunctionAppWizardContext> {
2020
public priority: number = 140;
2121

22-
public async execute(context: IFunctionAppWizardContext, _progress: Progress<{ message?: string; increment?: number }>): Promise<void> {
22+
public async execute(context: IFunctionAppWizardContext, progress: Progress<{ message?: string; increment?: number }>): Promise<void> {
2323
if (!context.deployWorkspaceResult?.registryLoginServer || !context.deployWorkspaceResult?.imageName) {
2424
throw new Error(localize('failToCreateApp', 'Failed to create function app. There was an error creating the necessary container resources.'));
2525
}
2626

27+
const message: string = localize('creatingNewApp', 'Creating function app "{0}"...', context.newSiteName);
28+
progress.report({ message });
29+
2730
const siteName: string = nonNullProp(context, 'newSiteName');
2831
const rgName: string = nonNullProp(nonNullProp(context, 'resourceGroup'), 'name');
2932
const client: WebSiteManagementClient = await createWebSiteClient(context);
@@ -77,19 +80,19 @@ export class ContainerizedFunctionAppCreateStep extends AzureWizardExecuteStep<I
7780

7881
protected getTreeItemLabel(context: IFunctionAppWizardContext): string {
7982
const siteName: string = nonNullProp(context, 'newSiteName');
80-
return localize('creatingNewApp', 'Create new function app "{0}"', siteName);
83+
return localize('creatingNewApp', 'Create function app "{0}"', siteName);
8184
}
8285
protected getOutputLogSuccess(context: IFunctionAppWizardContext): string {
8386
const siteName: string = nonNullProp(context, 'newSiteName');
84-
return localize('createdNewApp', 'Successfully created new function app "{0}".', siteName);
87+
return localize('createdNewApp', 'Successfully created function app "{0}".', siteName);
8588
}
8689
protected getOutputLogFail(context: IFunctionAppWizardContext): string {
8790
const siteName: string = nonNullProp(context, 'newSiteName');
88-
return localize('failedToCreateNewApp', 'Failed to create new function app "{0}".', siteName);
91+
return localize('failedToCreateNewApp', 'Failed to create function app "{0}".', siteName);
8992
}
9093
protected getOutputLogProgress(context: IFunctionAppWizardContext): string {
9194
const siteName: string = nonNullProp(context, 'newSiteName');
92-
return localize('creatingNewApp', 'Creating new function app "{0}"...', siteName);
95+
return localize('creatingNewApp', 'Creating function app "{0}"...', siteName);
9396
}
9497
}
9598

0 commit comments

Comments
 (0)