diff --git a/appsettings/package-lock.json b/appsettings/package-lock.json index 6965619805..3852adef2e 100644 --- a/appsettings/package-lock.json +++ b/appsettings/package-lock.json @@ -1,12 +1,12 @@ { "name": "@microsoft/vscode-azext-azureappsettings", - "version": "0.2.0", + "version": "0.2.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@microsoft/vscode-azext-azureappsettings", - "version": "0.2.0", + "version": "0.2.1", "license": "MIT", "dependencies": { "@microsoft/vscode-azext-utils": "^2.0.0" diff --git a/appsettings/package.json b/appsettings/package.json index 106f30ed29..b8dbfdddf1 100644 --- a/appsettings/package.json +++ b/appsettings/package.json @@ -1,7 +1,7 @@ { "name": "@microsoft/vscode-azext-azureappsettings", "author": "Microsoft Corporation", - "version": "0.2.0", + "version": "0.2.1", "description": "Common features and tools surrounding App Settings for the Azure VS Code extensions", "tags": [ "azure", diff --git a/appsettings/src/tree/AppSettingsTreeItem.ts b/appsettings/src/tree/AppSettingsTreeItem.ts index 9eb2b2d659..83829bee46 100644 --- a/appsettings/src/tree/AppSettingsTreeItem.ts +++ b/appsettings/src/tree/AppSettingsTreeItem.ts @@ -5,6 +5,7 @@ import type { StringDictionary } from '@azure/arm-appservice'; import { AzExtParentTreeItem, AzExtTreeItem, createContextValue, IActionContext, ICreateChildImplContext, TreeItemIconPath } from '@microsoft/vscode-azext-utils'; +import * as vscode from 'vscode'; import { ThemeIcon } from 'vscode'; import { AppSettingsClientProvider, IAppSettingsClient } from '../IAppSettingsClient'; import { AppSettingTreeItem } from './AppSettingTreeItem'; @@ -35,6 +36,14 @@ export function validateAppSettingKey(settings: StringDictionary, client: IAppSe return undefined; } +export function validateAppSettingValue(value: string): string | undefined { + if (!value.trim()) { + return vscode.l10n.t('App setting values cannot be null, undefined or an empty string.'); + } + + return undefined; +} + interface AppSettingsTreeItemOptions { supportsSlots?: boolean; settingsToHide?: string[]; @@ -131,7 +140,8 @@ export class AppSettingsTreeItem extends AzExtParentTreeItem { const newValue: string = await context.ui.showInputBox({ prompt: `Enter value for "${newKey}"`, - stepName: 'appSettingValue' + stepName: 'appSettingValue', + validateInput: (v: string): string | undefined => validateAppSettingValue(v) }); if (!settings.properties) {