From 587b574dd151c92be215e8a6461b9d7fbd6b2024 Mon Sep 17 00:00:00 2001 From: Nathan Turinski Date: Tue, 12 Dec 2023 17:37:04 -0800 Subject: [PATCH 01/11] Add values as desciptions for local settings. Select emulator for storage connection --- package-lock.json | 12 ++--- package.json | 7 +-- package.nls.json | 1 - .../addBinding/IBindingWizardContext.ts | 1 + .../AzureConnectionCreateStepBase.ts | 5 +- .../settingSteps/LocalAppSettingListStep.ts | 20 +++---- .../StorageConnectionCreateStep.ts | 6 +-- .../settingSteps/StorageTypePromptStep.ts | 54 +++++++++++++++++++ .../setAzureWebJobsStorage.ts | 25 --------- .../getLocalConnectionSetting.ts | 12 +++-- src/commands/registerCommands.ts | 2 - 11 files changed, 86 insertions(+), 59 deletions(-) create mode 100644 src/commands/addBinding/settingSteps/StorageTypePromptStep.ts delete mode 100644 src/commands/appSettings/connectionSettings/azureWebJobsStorage/setAzureWebJobsStorage.ts diff --git a/package-lock.json b/package-lock.json index 61d3605af..feca5ba2b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "@azure/core-client": "^1.7.3", "@azure/core-rest-pipeline": "^1.11.0", "@azure/storage-blob": "^12.5.0", - "@microsoft/vscode-azext-azureappservice": "^2.2.7", + "@microsoft/vscode-azext-azureappservice": "file:../vscode-azureresourcegroups/microsoft-vscode-azext-azureappservice-2.2.7.tgz", "@microsoft/vscode-azext-azureappsettings": "^0.2.0", "@microsoft/vscode-azext-azureutils": "^2.0.2", "@microsoft/vscode-azext-serviceconnector": "^0.1.3", @@ -816,8 +816,9 @@ }, "node_modules/@microsoft/vscode-azext-azureappservice": { "version": "2.2.7", - "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-azureappservice/-/vscode-azext-azureappservice-2.2.7.tgz", - "integrity": "sha512-aaYBv4UQO2qO5x7ujkLAZpUMrTFmsgTOVKRjvK8rbrGKHwuWB/6q+fxGhVPVdnhj21FA/L7NFoJGKpV8KOtyWQ==", + "resolved": "file:../vscode-azureresourcegroups/microsoft-vscode-azext-azureappservice-2.2.7.tgz", + "integrity": "sha512-6vPDmo0oeZh0F9bj6AaF9SBC9an8opJOCJNkQgMegTAKnX8HbCKbv+XDBPg6FhwD4eHGFHUBIzw4ieBxYq2tCQ==", + "license": "MIT", "dependencies": { "@azure/abort-controller": "^1.0.4", "@azure/arm-appinsights": "^5.0.0-beta.4", @@ -13890,9 +13891,8 @@ } }, "@microsoft/vscode-azext-azureappservice": { - "version": "2.2.7", - "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-azureappservice/-/vscode-azext-azureappservice-2.2.7.tgz", - "integrity": "sha512-aaYBv4UQO2qO5x7ujkLAZpUMrTFmsgTOVKRjvK8rbrGKHwuWB/6q+fxGhVPVdnhj21FA/L7NFoJGKpV8KOtyWQ==", + "version": "file:..\\vscode-azureresourcegroups\\microsoft-vscode-azext-azureappservice-2.2.7.tgz", + "integrity": "sha512-6vPDmo0oeZh0F9bj6AaF9SBC9an8opJOCJNkQgMegTAKnX8HbCKbv+XDBPg6FhwD4eHGFHUBIzw4ieBxYq2tCQ==", "requires": { "@azure/abort-controller": "^1.0.4", "@azure/arm-appinsights": "^5.0.0-beta.4", diff --git a/package.json b/package.json index e9844b0d1..ef43a1072 100644 --- a/package.json +++ b/package.json @@ -276,11 +276,6 @@ "title": "%azureFunctions.restartFunctionApp%", "category": "Azure Functions" }, - { - "command": "azureFunctions.setAzureWebJobsStorage", - "title": "%azureFunctions.setAzureWebJobsStorage%", - "category": "Azure Functions" - }, { "command": "azureFunctions.startFunctionApp", "title": "%azureFunctions.startFunctionApp%", @@ -1188,7 +1183,7 @@ "@azure/core-client": "^1.7.3", "@azure/core-rest-pipeline": "^1.11.0", "@azure/storage-blob": "^12.5.0", - "@microsoft/vscode-azext-azureappservice": "^2.2.7", + "@microsoft/vscode-azext-azureappservice": "file:../vscode-azureresourcegroups/microsoft-vscode-azext-azureappservice-2.2.7.tgz", "@microsoft/vscode-azext-azureappsettings": "^0.2.0", "@microsoft/vscode-azext-azureutils": "^2.0.2", "@microsoft/vscode-azext-serviceconnector": "^0.1.3", diff --git a/package.nls.json b/package.nls.json index 1359cdf7b..3bbd4a91f 100644 --- a/package.nls.json +++ b/package.nls.json @@ -71,7 +71,6 @@ "azureFunctions.requestTimeout": "The timeout (in seconds) to be used when making requests, for example getting the latest templates.", "azureFunctions.restartFunctionApp": "Restart", "azureFunctions.scmDoBuildDuringDeployment": "Set to true to build your project on the server. Currently only applicable for Linux Function Apps.", - "azureFunctions.setAzureWebJobsStorage": "Set AzureWebJobsStorage...", "azureFunctions.show64BitWarning": "Show a warning to install a 64-bit version of the Azure Functions Core Tools when you create a .NET Framework project.", "azureFunctions.showCoreToolsWarning": "Show a warning if your installed version of Azure Functions Core Tools is out-of-date.", "azureFunctions.showDeployConfirmation": "Ask for confirmation before deploying to a Function App in Azure (deploying will overwrite any previous deployment and cannot be undone).", diff --git a/src/commands/addBinding/IBindingWizardContext.ts b/src/commands/addBinding/IBindingWizardContext.ts index 16a06f2ff..c228d3a25 100644 --- a/src/commands/addBinding/IBindingWizardContext.ts +++ b/src/commands/addBinding/IBindingWizardContext.ts @@ -17,4 +17,5 @@ export interface IBindingWizardContext extends IFunctionWizardContext { bindingTemplate?: IBindingTemplate; binding?: IFunctionBinding; bindingName?: string; + useStorageEmulator?: boolean; } diff --git a/src/commands/addBinding/settingSteps/AzureConnectionCreateStepBase.ts b/src/commands/addBinding/settingSteps/AzureConnectionCreateStepBase.ts index 39adaf717..414752236 100644 --- a/src/commands/addBinding/settingSteps/AzureConnectionCreateStepBase.ts +++ b/src/commands/addBinding/settingSteps/AzureConnectionCreateStepBase.ts @@ -33,7 +33,10 @@ export abstract class AzureConnectionCreateStepBase { const localSettingsPath: string = path.join(context.projectPath, localSettingsFileName); const settings: ILocalSettingsJson = await getLocalSettingsJson(context, localSettingsPath); - const existingSettings: string[] = settings.Values ? Object.keys(settings.Values) : []; + const existingSettings: [string, string][] = settings.Values ? Object.entries(settings.Values) : []; + let picks: IAzureQuickPickItem[] = [{ label: localize('newAppSetting', '$(plus) Create new local app setting'), data: undefined }]; - picks = picks.concat(existingSettings.map((s: string) => { return { data: s, label: s }; })); - const placeHolder: string = localize('selectAppSetting', 'Select setting from "{0}"', localSettingsFileName); + picks = picks.concat(existingSettings.map((s: [string, string]) => { return { data: s[0], label: s[0], description: s[1] }; })); + const placeHolder: string = localize('selectAppSetting', 'Select the app setting with your {1} from "{0}"', localSettingsFileName, this._setting.label); return (await context.ui.showQuickPick(picks, { placeHolder })).data; } @@ -50,11 +50,7 @@ export class LocalAppSettingListStep extends BindingSettingStepBase { azureExecuteSteps.push(new CosmosDBConnectionCreateStep(this._setting)); break; case ResourceType.Storage: - azurePromptSteps.push(new StorageAccountListStep( - { kind: StorageAccountKind.Storage, performance: StorageAccountPerformance.Standard, replication: StorageAccountReplication.LRS }, - { kind: [StorageAccountKind.BlobStorage], learnMoreLink: 'https://aka.ms/T5o0nf' } - )); - azureExecuteSteps.push(new StorageConnectionCreateStep(this._setting)); + azurePromptSteps.push(new StorageTypePromptStep(this._setting)); break; case ResourceType.ServiceBus: azurePromptSteps.push(new ServiceBusListStep()); diff --git a/src/commands/addBinding/settingSteps/StorageConnectionCreateStep.ts b/src/commands/addBinding/settingSteps/StorageConnectionCreateStep.ts index 069ca79a5..575f2d3e7 100644 --- a/src/commands/addBinding/settingSteps/StorageConnectionCreateStep.ts +++ b/src/commands/addBinding/settingSteps/StorageConnectionCreateStep.ts @@ -9,11 +9,11 @@ import { IBindingWizardContext } from '../IBindingWizardContext'; import { AzureConnectionCreateStepBase, IConnection } from './AzureConnectionCreateStepBase'; export class StorageConnectionCreateStep extends AzureConnectionCreateStepBase { - public async getConnection(context: IStorageAccountWizardContext): Promise { + public async getConnection(context: IStorageAccountWizardContext & Partial): Promise { return await getStorageConnectionString(context); } - public shouldExecute(context: IStorageAccountWizardContext): boolean { - return !!context.storageAccount; + public shouldExecute(context: IStorageAccountWizardContext & Partial): boolean { + return !!context.storageAccount || !!context.useStorageEmulator; } } diff --git a/src/commands/addBinding/settingSteps/StorageTypePromptStep.ts b/src/commands/addBinding/settingSteps/StorageTypePromptStep.ts new file mode 100644 index 000000000..8bae22c96 --- /dev/null +++ b/src/commands/addBinding/settingSteps/StorageTypePromptStep.ts @@ -0,0 +1,54 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { StorageAccountKind, StorageAccountListStep, StorageAccountPerformance, StorageAccountReplication } from "@microsoft/vscode-azext-azureutils"; +import { AzureWizardExecuteStep, AzureWizardPromptStep, IAzureQuickPickItem, ISubscriptionActionContext, IWizardOptions } from "@microsoft/vscode-azext-utils"; +import { localize } from "../../../localize"; +import { IBindingSetting } from "../../../templates/IBindingTemplate"; +import { IEventHubsConnectionWizardContext } from "../../appSettings/connectionSettings/eventHubs/IEventHubsConnectionWizardContext"; +import { IBindingWizardContext } from "../IBindingWizardContext"; +import { StorageConnectionCreateStep } from "./StorageConnectionCreateStep"; + +export class StorageTypePromptStep extends AzureWizardPromptStep { + private readonly _setting: IBindingSetting; + + constructor(setting: IBindingSetting) { + super(); + this._setting = setting; + } + + public async prompt(context: IBindingWizardContext): Promise { + const picks: IAzureQuickPickItem[] = [ + { label: localize('useAzurite', 'Use Azurite emulator for local storage'), data: true }, + { label: localize('useAzureStorage', 'Use Azure Storage for remote storage'), data: false } + ]; + + context.useStorageEmulator = (await context.ui.showQuickPick(picks, { placeHolder: localize('selectStorage', 'Select a storage account type for development') })).data; + return; + } + + public shouldPrompt(context: IBindingWizardContext): boolean { + return context.useStorageEmulator === undefined; + } + + public async getSubWizard(context: IBindingWizardContext): Promise | undefined> { + const promptSteps: AzureWizardPromptStep[] = []; + const executeSteps: AzureWizardExecuteStep[] = []; + + if (!context.useStorageEmulator) { + promptSteps.push(new StorageAccountListStep( + { kind: StorageAccountKind.Storage, performance: StorageAccountPerformance.Standard, replication: StorageAccountReplication.LRS }, + { kind: [StorageAccountKind.BlobStorage], learnMoreLink: 'https://aka.ms/T5o0nf' } + )); + } + + executeSteps.push(new StorageConnectionCreateStep(this._setting)); + + return { + promptSteps, + executeSteps + }; + } +} diff --git a/src/commands/appSettings/connectionSettings/azureWebJobsStorage/setAzureWebJobsStorage.ts b/src/commands/appSettings/connectionSettings/azureWebJobsStorage/setAzureWebJobsStorage.ts deleted file mode 100644 index b265bbaa2..000000000 --- a/src/commands/appSettings/connectionSettings/azureWebJobsStorage/setAzureWebJobsStorage.ts +++ /dev/null @@ -1,25 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { AzureWizard } from '@microsoft/vscode-azext-utils'; -import * as path from 'path'; -import { localize } from '../../../../localize'; -import { getLocalSettingsFile } from '../../localSettings/getLocalSettingsFile'; -import { ISetConnectionSettingContext } from '../ISetConnectionSettingContext'; -import { AzureWebJobsStorageExecuteStep } from './AzureWebJobsStorageExecuteStep'; -import { AzureWebJobsStoragePromptStep } from './AzureWebJobsStoragePromptStep'; -import { IAzureWebJobsStorageWizardContext } from './IAzureWebJobsStorageWizardContext'; - -export async function setAzureWebJobsStorage(context: Omit): Promise { - const message: string = localize('selectLocalSettings', 'Select your local settings file.'); - const localSettingsFile: string = await getLocalSettingsFile(context, message); - const wizardContext: IAzureWebJobsStorageWizardContext = Object.assign(context, { projectPath: path.dirname(localSettingsFile) }); - const wizard: AzureWizard = new AzureWizard(wizardContext, { - promptSteps: [new AzureWebJobsStoragePromptStep()], - executeSteps: [new AzureWebJobsStorageExecuteStep()] - }); - await wizard.prompt(); - await wizard.execute(); -} diff --git a/src/commands/appSettings/connectionSettings/getLocalConnectionSetting.ts b/src/commands/appSettings/connectionSettings/getLocalConnectionSetting.ts index 279ee605f..fe8c35491 100644 --- a/src/commands/appSettings/connectionSettings/getLocalConnectionSetting.ts +++ b/src/commands/appSettings/connectionSettings/getLocalConnectionSetting.ts @@ -7,7 +7,7 @@ import { AccessKeys, AuthorizationRule, EventHubManagementClient, KnownAccessRig import type { StorageAccount, StorageAccountListKeysResult, StorageManagementClient } from "@azure/arm-storage"; import { IStorageAccountWizardContext, getResourceGroupFromId, uiUtils } from "@microsoft/vscode-azext-azureutils"; import { ISubscriptionContext, nonNullProp, nonNullValue } from "@microsoft/vscode-azext-utils"; -import { localSettingsFileName } from "../../../constants"; +import { ConnectionKey, localSettingsFileName, localStorageEmulatorConnectionString } from "../../../constants"; import { defaultDescription } from "../../../constants-nls"; import { ext } from "../../../extensionVariables"; import { localize } from "../../../localize"; @@ -21,11 +21,17 @@ export interface IResourceResult { connectionString: string; } -export async function getStorageConnectionString(context: IStorageAccountWizardContext): Promise { +export async function getStorageConnectionString(context: IStorageAccountWizardContext & { useStorageEmulator?: boolean }): Promise { + if (context.useStorageEmulator) { + return { + name: ConnectionKey.Storage, + connectionString: localStorageEmulatorConnectionString + } + } + const client: StorageManagementClient = await createStorageClient(context); const storageAccount: StorageAccount = nonNullProp(context, 'storageAccount'); const name: string = nonNullProp(storageAccount, 'name'); - const resourceGroup: string = getResourceGroupFromId(nonNullProp(storageAccount, 'id')); const result: StorageAccountListKeysResult = await client.storageAccounts.listKeys(resourceGroup, name); const key: string = nonNullProp(nonNullValue(nonNullProp(result, 'keys')[0], 'keys[0]'), 'value'); diff --git a/src/commands/registerCommands.ts b/src/commands/registerCommands.ts index f73c429c4..ff7477716 100644 --- a/src/commands/registerCommands.ts +++ b/src/commands/registerCommands.ts @@ -15,7 +15,6 @@ import { deleteServiceConnector } from '../serviceConnector/deleteServiceConnect import { validateServiceConnector } from '../serviceConnector/validateServiceConnector'; import { ResolvedFunctionAppResource } from '../tree/ResolvedFunctionAppResource'; import { addBinding } from './addBinding/addBinding'; -import { setAzureWebJobsStorage } from './appSettings/connectionSettings/azureWebJobsStorage/setAzureWebJobsStorage'; import { downloadAppSettings } from './appSettings/downloadAppSettings'; import { decryptLocalSettings } from './appSettings/localSettings/decryptLocalSettings'; import { encryptLocalSettings } from './appSettings/localSettings/encryptLocalSettings'; @@ -93,7 +92,6 @@ export function registerCommands(): void { registerCommandWithTreeNodeUnwrapping('azureFunctions.pickProcess', pickFuncProcess); registerCommandWithTreeNodeUnwrapping('azureFunctions.redeploy', redeployDeployment); registerCommandWithTreeNodeUnwrapping('azureFunctions.restartFunctionApp', restartFunctionApp); - registerCommandWithTreeNodeUnwrapping('azureFunctions.setAzureWebJobsStorage', setAzureWebJobsStorage); registerCommandWithTreeNodeUnwrapping('azureFunctions.startFunctionApp', startFunctionApp); registerCommandWithTreeNodeUnwrapping('azureFunctions.startJavaRemoteDebug', remoteDebugJavaFunctionApp); registerCommandWithTreeNodeUnwrapping('azureFunctions.startRemoteDebug', startRemoteDebug); From 39f7726df49475d804a6bbb700bcc80b8b2bd03d Mon Sep 17 00:00:00 2001 From: Nathan Turinski Date: Tue, 12 Dec 2023 17:38:32 -0800 Subject: [PATCH 02/11] Add string to end of placeholder --- src/commands/addBinding/settingSteps/LocalAppSettingListStep.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/addBinding/settingSteps/LocalAppSettingListStep.ts b/src/commands/addBinding/settingSteps/LocalAppSettingListStep.ts index af2958853..b3e31337d 100644 --- a/src/commands/addBinding/settingSteps/LocalAppSettingListStep.ts +++ b/src/commands/addBinding/settingSteps/LocalAppSettingListStep.ts @@ -36,7 +36,7 @@ export class LocalAppSettingListStep extends BindingSettingStepBase { let picks: IAzureQuickPickItem[] = [{ label: localize('newAppSetting', '$(plus) Create new local app setting'), data: undefined }]; picks = picks.concat(existingSettings.map((s: [string, string]) => { return { data: s[0], label: s[0], description: s[1] }; })); - const placeHolder: string = localize('selectAppSetting', 'Select the app setting with your {1} from "{0}"', localSettingsFileName, this._setting.label); + const placeHolder: string = localize('selectAppSetting', 'Select the app setting with your {1} string from "{0}"', localSettingsFileName, this._setting.label); return (await context.ui.showQuickPick(picks, { placeHolder })).data; } From 3184e4965f1cb8a8b47c9aeb2270e92e12bccb3f Mon Sep 17 00:00:00 2001 From: Nathan Turinski Date: Tue, 12 Dec 2023 17:44:24 -0800 Subject: [PATCH 03/11] Revert package.json dependencies --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 458832c01..9f3c0719f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "@azure/core-client": "^1.7.3", "@azure/core-rest-pipeline": "^1.11.0", "@azure/storage-blob": "^12.5.0", - "@microsoft/vscode-azext-azureappservice": "file:../vscode-azureresourcegroups/microsoft-vscode-azext-azureappservice-2.2.7.tgz", + "@microsoft/vscode-azext-azureappservice": "^2.2.7", "@microsoft/vscode-azext-azureappsettings": "^0.2.0", "@microsoft/vscode-azext-azureutils": "^2.0.2", "@microsoft/vscode-azext-serviceconnector": "^0.1.3", @@ -13891,7 +13891,7 @@ } }, "@microsoft/vscode-azext-azureappservice": { - "version": "file:..\\vscode-azureresourcegroups\\microsoft-vscode-azext-azureappservice-2.2.7.tgz", + "version": "2.2.7", "integrity": "sha512-6vPDmo0oeZh0F9bj6AaF9SBC9an8opJOCJNkQgMegTAKnX8HbCKbv+XDBPg6FhwD4eHGFHUBIzw4ieBxYq2tCQ==", "requires": { "@azure/abort-controller": "^1.0.4", diff --git a/package.json b/package.json index ef30f9fd5..2281bfd14 100644 --- a/package.json +++ b/package.json @@ -1183,7 +1183,7 @@ "@azure/core-client": "^1.7.3", "@azure/core-rest-pipeline": "^1.11.0", "@azure/storage-blob": "^12.5.0", - "@microsoft/vscode-azext-azureappservice": "file:../vscode-azureresourcegroups/microsoft-vscode-azext-azureappservice-2.2.7.tgz", + "@microsoft/vscode-azext-azureappservice": "^2.2.7", "@microsoft/vscode-azext-azureappsettings": "^0.2.0", "@microsoft/vscode-azext-azureutils": "^2.0.2", "@microsoft/vscode-azext-serviceconnector": "^0.1.3", From bdb8ee59ffb69704adc5550bf1e56b623e1fbdc5 Mon Sep 17 00:00:00 2001 From: Nathan Turinski Date: Tue, 12 Dec 2023 17:46:11 -0800 Subject: [PATCH 04/11] Revert package-lock.json dependencies --- package-lock.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9f3c0719f..5d5ab9cff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -816,8 +816,8 @@ }, "node_modules/@microsoft/vscode-azext-azureappservice": { "version": "2.2.7", - "resolved": "file:../vscode-azureresourcegroups/microsoft-vscode-azext-azureappservice-2.2.7.tgz", - "integrity": "sha512-6vPDmo0oeZh0F9bj6AaF9SBC9an8opJOCJNkQgMegTAKnX8HbCKbv+XDBPg6FhwD4eHGFHUBIzw4ieBxYq2tCQ==", + "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-azureappservice/-/vscode-azext-azureappservice-2.2.7.tgz", + "integrity": "sha512-aaYBv4UQO2qO5x7ujkLAZpUMrTFmsgTOVKRjvK8rbrGKHwuWB/6q+fxGhVPVdnhj21FA/L7NFoJGKpV8KOtyWQ==", "license": "MIT", "dependencies": { "@azure/abort-controller": "^1.0.4", @@ -13892,7 +13892,8 @@ }, "@microsoft/vscode-azext-azureappservice": { "version": "2.2.7", - "integrity": "sha512-6vPDmo0oeZh0F9bj6AaF9SBC9an8opJOCJNkQgMegTAKnX8HbCKbv+XDBPg6FhwD4eHGFHUBIzw4ieBxYq2tCQ==", + "resolved": "https://registry.npmjs.org/@microsoft/vscode-azext-azureappservice/-/vscode-azext-azureappservice-2.2.7.tgz", + "integrity": "sha512-aaYBv4UQO2qO5x7ujkLAZpUMrTFmsgTOVKRjvK8rbrGKHwuWB/6q+fxGhVPVdnhj21FA/L7NFoJGKpV8KOtyWQ==", "requires": { "@azure/abort-controller": "^1.0.4", "@azure/arm-appinsights": "^5.0.0-beta.4", From ab23bf1afd5053a427989abb73574fbc13ad9094 Mon Sep 17 00:00:00 2001 From: Nathan Turinski Date: Wed, 13 Dec 2023 09:39:35 -0800 Subject: [PATCH 05/11] Fix linter --- .vscode/settings.json | 4 ++-- .../addBinding/settingSteps/StorageTypePromptStep.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 92cb1077c..6edb54fcb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ { "editor.codeActionsOnSave": { - "source.fixAll.eslint": true, - "source.organizeImports": true + "source.fixAll.eslint": "explicit", + "source.organizeImports": "explicit" }, "editor.detectIndentation": false, "editor.formatOnSave": true, diff --git a/src/commands/addBinding/settingSteps/StorageTypePromptStep.ts b/src/commands/addBinding/settingSteps/StorageTypePromptStep.ts index 8bae22c96..2439a2c99 100644 --- a/src/commands/addBinding/settingSteps/StorageTypePromptStep.ts +++ b/src/commands/addBinding/settingSteps/StorageTypePromptStep.ts @@ -4,11 +4,11 @@ *--------------------------------------------------------------------------------------------*/ import { StorageAccountKind, StorageAccountListStep, StorageAccountPerformance, StorageAccountReplication } from "@microsoft/vscode-azext-azureutils"; -import { AzureWizardExecuteStep, AzureWizardPromptStep, IAzureQuickPickItem, ISubscriptionActionContext, IWizardOptions } from "@microsoft/vscode-azext-utils"; +import { AzureWizardPromptStep, type AzureWizardExecuteStep, type IAzureQuickPickItem, type ISubscriptionActionContext, type IWizardOptions } from "@microsoft/vscode-azext-utils"; import { localize } from "../../../localize"; -import { IBindingSetting } from "../../../templates/IBindingTemplate"; -import { IEventHubsConnectionWizardContext } from "../../appSettings/connectionSettings/eventHubs/IEventHubsConnectionWizardContext"; -import { IBindingWizardContext } from "../IBindingWizardContext"; +import { type IBindingSetting } from "../../../templates/IBindingTemplate"; +import { type IEventHubsConnectionWizardContext } from "../../appSettings/connectionSettings/eventHubs/IEventHubsConnectionWizardContext"; +import { type IBindingWizardContext } from "../IBindingWizardContext"; import { StorageConnectionCreateStep } from "./StorageConnectionCreateStep"; export class StorageTypePromptStep extends AzureWizardPromptStep { From f25be5118ea936c97141488a5af20b55b1dc3a70 Mon Sep 17 00:00:00 2001 From: Nathan Turinski Date: Wed, 13 Dec 2023 17:18:08 -0800 Subject: [PATCH 06/11] Hide app settings value by default --- package.json | 5 +++++ package.nls.json | 1 + .../AzureConnectionCreateStepBase.ts | 5 +---- .../settingSteps/LocalAppSettingListStep.ts | 20 ++++++++++++++++--- .../getLocalConnectionSetting.ts | 4 ++-- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 2281bfd14..a034855a3 100644 --- a/package.json +++ b/package.json @@ -276,6 +276,11 @@ "title": "%azureFunctions.restartFunctionApp%", "category": "Azure Functions" }, + { + "command": "azureFunctions.setAzureWebJobsStorage", + "title": "%azureFunctions.setAzureWebJobsStorage%", + "category": "Azure Functions" + }, { "command": "azureFunctions.startFunctionApp", "title": "%azureFunctions.startFunctionApp%", diff --git a/package.nls.json b/package.nls.json index 3bbd4a91f..1359cdf7b 100644 --- a/package.nls.json +++ b/package.nls.json @@ -71,6 +71,7 @@ "azureFunctions.requestTimeout": "The timeout (in seconds) to be used when making requests, for example getting the latest templates.", "azureFunctions.restartFunctionApp": "Restart", "azureFunctions.scmDoBuildDuringDeployment": "Set to true to build your project on the server. Currently only applicable for Linux Function Apps.", + "azureFunctions.setAzureWebJobsStorage": "Set AzureWebJobsStorage...", "azureFunctions.show64BitWarning": "Show a warning to install a 64-bit version of the Azure Functions Core Tools when you create a .NET Framework project.", "azureFunctions.showCoreToolsWarning": "Show a warning if your installed version of Azure Functions Core Tools is out-of-date.", "azureFunctions.showDeployConfirmation": "Ask for confirmation before deploying to a Function App in Azure (deploying will overwrite any previous deployment and cannot be undone).", diff --git a/src/commands/addBinding/settingSteps/AzureConnectionCreateStepBase.ts b/src/commands/addBinding/settingSteps/AzureConnectionCreateStepBase.ts index 7d12a75e9..0254eddba 100644 --- a/src/commands/addBinding/settingSteps/AzureConnectionCreateStepBase.ts +++ b/src/commands/addBinding/settingSteps/AzureConnectionCreateStepBase.ts @@ -33,10 +33,7 @@ export abstract class AzureConnectionCreateStepBase