3
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
4
*--------------------------------------------------------------------------------------------*/
5
5
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 " ;
9
9
import { setConsumptionPlanProperties } from "./FunctionAppHostingPlanStep" ;
10
+ import { type IFunctionAppWizardContext } from "./IFunctionAppWizardContext" ;
10
11
11
12
export class ConfigureCommonNamesStep extends AzureWizardPromptStep < IAppServiceWizardContext > {
12
13
public async prompt ( _context : IAppServiceWizardContext ) : Promise < void > {
@@ -18,25 +19,16 @@ export class ConfigureCommonNamesStep extends AzureWizardPromptStep<IAppServiceW
18
19
return false ;
19
20
}
20
21
21
- public async configureBeforePrompt ( context : IAppServiceWizardContext ) : Promise < void > {
22
+ public async configureBeforePrompt ( context : IFunctionAppWizardContext ) : Promise < void > {
22
23
if ( ! context . advancedCreation ) {
23
24
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
+ }
25
28
context . newResourceGroupName = context . newResourceGroupName || newName ;
26
29
setConsumptionPlanProperties ( context ) ;
27
30
context . newStorageAccountName = newName ;
28
31
context . newAppInsightsName = newName ;
29
32
}
30
33
}
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
- }
42
34
}
0 commit comments