Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to option for saying what SiteNameStep is for instead of passing in agent metadata #1694

Merged
merged 2 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions appservice/package-lock.json

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

2 changes: 1 addition & 1 deletion appservice/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@microsoft/vscode-azext-azureappservice",
"author": "Microsoft Corporation",
"version": "3.0.1",
"version": "3.1.0",
"description": "Common tools for developing Azure App Service extensions for VS Code",
"tags": [
"azure",
Expand Down
17 changes: 9 additions & 8 deletions appservice/src/createAppService/SiteNameStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import type { ResourceNameAvailability, WebSiteManagementClient } from '@azure/arm-appservice';
import { ResourceGroupListStep, StorageAccountListStep, resourceGroupNamingRules, storageAccountNamingRules } from '@microsoft/vscode-azext-azureutils';
import { AgentInputBoxOptions, AzureNameStep, IAzureAgentInput, IAzureNamingRules, ParameterAgentMetadata } from '@microsoft/vscode-azext-utils';
import { AgentInputBoxOptions, AzureNameStep, IAzureAgentInput, IAzureNamingRules } from '@microsoft/vscode-azext-utils';
import * as vscode from 'vscode';
import { createWebSiteClient } from '../utils/azureClients';
import { appInsightsNamingRules } from './AppInsightsListStep';
Expand All @@ -25,11 +25,11 @@ const siteNamingRules: IAzureNamingRules = {
};

export class SiteNameStep extends AzureNameStep<SiteNameStepWizardContext> {
private _inputBoxOptionsAgentMetadata: ParameterAgentMetadata | undefined;
private _siteFor: "functionApp" | undefined;

constructor(inputBoxOptionsAgentMetadata?: ParameterAgentMetadata) {
constructor(siteFor?: "functionApp" | undefined) {
super();
this._inputBoxOptionsAgentMetadata = inputBoxOptionsAgentMetadata;
this._siteFor = siteFor;
}

public async prompt(context: SiteNameStepWizardContext): Promise<void> {
Expand Down Expand Up @@ -59,15 +59,16 @@ export class SiteNameStep extends AzureNameStep<SiteNameStepWizardContext> {
prompt = vscode.l10n.t('Enter a globally unique name for the new web app.');
}

const agentMetadata = this._siteFor === "functionApp" ?
{ parameterDisplayTitle: vscode.l10n.t('Function App Name'), parameterDisplayDescription: vscode.l10n.t('The name of the new function app.') } :
{ parameterDisplayTitle: vscode.l10n.t('Site Name'), parameterDisplayDescription: vscode.l10n.t('The name of the app service site.'), };

const options: AgentInputBoxOptions = {
prompt,
placeHolder,
validateInput: (name: string): string | undefined => this.validateSiteName(name),
asyncValidationTask: async (name: string): Promise<string | undefined> => await this.asyncValidateSiteName(client, name),
agentMetadata: this._inputBoxOptionsAgentMetadata ?? {
parameterDisplayTitle: "Site Name",
parameterDisplayDescription: "The name of the app service site.",
}
agentMetadata: agentMetadata
MRayermannMSFT marked this conversation as resolved.
Show resolved Hide resolved
};

context.newSiteName = (await context.ui.showInputBox(options)).trim();
Expand Down
Loading