Skip to content

Commit ebf5785

Browse files
committed
Some fixes
1 parent bc26c0c commit ebf5785

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

src/commands/createFunctionApp/UniqueNamePromptStep.ts

+8-16
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { AppInsightsNameStep, type IAppServiceWizardContext } from "@microsoft/vscode-azext-azureappservice";
7-
import { ResourceGroupNameStep, StorageAccountNameStep } from "@microsoft/vscode-azext-azureutils";
8-
import { AzureWizardPromptStep, type IWizardOptions } from "@microsoft/vscode-azext-utils";
6+
import { type IAppServiceWizardContext } from "@microsoft/vscode-azext-azureappservice";
7+
import { AzureWizardPromptStep } from "@microsoft/vscode-azext-utils";
8+
import { localize } from "../../localize";
99
import { setConsumptionPlanProperties } from "./FunctionAppHostingPlanStep";
10+
import { type IFunctionAppWizardContext } from "./IFunctionAppWizardContext";
1011

1112
export class ConfigureCommonNamesStep extends AzureWizardPromptStep<IAppServiceWizardContext> {
1213
public async prompt(_context: IAppServiceWizardContext): Promise<void> {
@@ -18,25 +19,16 @@ export class ConfigureCommonNamesStep extends AzureWizardPromptStep<IAppServiceW
1819
return false;
1920
}
2021

21-
public async configureBeforePrompt(context: IAppServiceWizardContext): Promise<void> {
22+
public async configureBeforePrompt(context: IFunctionAppWizardContext): Promise<void> {
2223
if (!context.advancedCreation) {
2324
const newName: string | undefined = await context.relatedNameTask;
24-
25+
if (!newName) {
26+
throw new Error(localize('noUniqueName', 'Failed to generate unique name for resources. Use advanced creation to manually enter resource names.'));
27+
}
2528
context.newResourceGroupName = context.newResourceGroupName || newName;
2629
setConsumptionPlanProperties(context);
2730
context.newStorageAccountName = newName;
2831
context.newAppInsightsName = newName;
2932
}
3033
}
31-
32-
public async getSubWizard(context: IAppServiceWizardContext): Promise<IWizardOptions<IAppServiceWizardContext> | undefined> {
33-
if (!context.advancedCreation &&
34-
!context.newResourceGroupName &&
35-
!context.newStorageAccountName &&
36-
!context.newAppInsightsName) {
37-
return { promptSteps: [new ResourceGroupNameStep(), new StorageAccountNameStep(), new AppInsightsNameStep()] };
38-
}
39-
40-
return;
41-
}
4234
}

0 commit comments

Comments
 (0)