Skip to content

Commit 849c8ee

Browse files
committed
Clean up some code
1 parent dbce2da commit 849c8ee

File tree

6 files changed

+13
-6
lines changed

6 files changed

+13
-6
lines changed

src/commands/addBinding/settingSteps/BindingSettingStepBase.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export abstract class BindingSettingStepBase extends AzureWizardPromptStep<IFunc
2323
public abstract promptCore(context: IFunctionWizardContext): Promise<BindingSettingValue>;
2424

2525
public async prompt(context: IFunctionWizardContext): Promise<void> {
26-
setBindingSetting(context, this._setting as IBindingSetting, await this.promptCore(context));
26+
setBindingSetting(context, this._setting, await this.promptCore(context));
2727
}
2828

2929
public shouldPrompt(context: IFunctionWizardContext): boolean {

src/commands/addBinding/settingSteps/EnumPromptStep.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ import { type IBindingWizardContext } from "../IBindingWizardContext";
1010
import { BindingSettingStepBase } from "./BindingSettingStepBase";
1111

1212
export class EnumPromptStep extends BindingSettingStepBase {
13+
// not used by v2 schema so enforce IBindingSetting
14+
protected readonly _setting: IBindingSetting;
15+
1316
public async promptCore(context: IBindingWizardContext): Promise<BindingSettingValue> {
14-
const picks: IAzureQuickPickItem<string>[] = (this._setting as IBindingSetting).enums.map(e => { return { data: e.value, label: e.displayName }; });
17+
const picks: IAzureQuickPickItem<string>[] = this._setting.enums.map(e => { return { data: e.value, label: e.displayName }; });
1518
return (await context.ui.showQuickPick(picks, { placeHolder: this._setting.label })).data;
1619
}
1720
}

src/commands/addBinding/settingSteps/StringPromptStep.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ import { type IBindingSetting } from "../../../templates/IBindingTemplate";
99
import { type IBindingWizardContext } from "../IBindingWizardContext";
1010
import { BindingSettingStepBase } from "./BindingSettingStepBase";
1111

12-
// not used by v2 schema so assume IBindingSetting
1312
export class StringPromptStep extends BindingSettingStepBase {
13+
// not used by v2 schema so assume IBindingSetting
14+
protected readonly _setting: IBindingSetting;
1415
public async promptCore(context: IBindingWizardContext): Promise<BindingSettingValue> {
1516
return await context.ui.showInputBox({
1617
placeHolder: this._setting.label,
17-
prompt: (this._setting as IBindingSetting).description || localize('stringSettingPrompt', 'Provide a \'{0}\'', this._setting.label),
18+
prompt: this._setting.description || localize('stringSettingPrompt', 'Provide a \'{0}\'', this._setting.label),
1819
validateInput: async (s): Promise<string | undefined> => await this.validateInput(context, s),
1920
value: await this.getDefaultValue(context)
2021
});

src/commands/createFunction/promptStepsV2/PromptSchemaStepBase.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export abstract class PromptSchemaStepBase<T extends FunctionV2WizardContext> ex
2929
for (const validator of validators) {
3030
if (value) {
3131
if (!new RegExp(validator.expression).test(value)) {
32-
// TODO: get the errorText properly
3332
return validator.errorText;
3433
}
3534
}

src/commands/createFunction/promptStepsV2/StringInputStep.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ export class StringInputStep<T extends FunctionV2WizardContext> extends PromptSc
1919
title: this.input.label,
2020
prompt: this.input.help,
2121
value: this.input.defaultValue,
22-
validateInput: value => { return this.validateInput(value, this.input); }
22+
validateInput: value => {
23+
return this.validateInput(value, this.input);
24+
}
2325
};
2426

2527
return await context.ui.showInputBox(options);

src/commands/registerCommands.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { deleteServiceConnector } from '../serviceConnector/deleteServiceConnect
1515
import { validateServiceConnector } from '../serviceConnector/validateServiceConnector';
1616
import { ResolvedFunctionAppResource } from '../tree/ResolvedFunctionAppResource';
1717
import { addBinding } from './addBinding/addBinding';
18+
import { setAzureWebJobsStorage } from './appSettings/connectionSettings/azureWebJobsStorage/setAzureWebJobsStorage';
1819
import { downloadAppSettings } from './appSettings/downloadAppSettings';
1920
import { decryptLocalSettings } from './appSettings/localSettings/decryptLocalSettings';
2021
import { encryptLocalSettings } from './appSettings/localSettings/encryptLocalSettings';
@@ -92,6 +93,7 @@ export function registerCommands(): void {
9293
registerCommandWithTreeNodeUnwrapping('azureFunctions.pickProcess', pickFuncProcess);
9394
registerCommandWithTreeNodeUnwrapping('azureFunctions.redeploy', redeployDeployment);
9495
registerCommandWithTreeNodeUnwrapping('azureFunctions.restartFunctionApp', restartFunctionApp);
96+
registerCommandWithTreeNodeUnwrapping('azureFunctions.setAzureWebJobsStorage', setAzureWebJobsStorage);
9597
registerCommandWithTreeNodeUnwrapping('azureFunctions.startFunctionApp', startFunctionApp);
9698
registerCommandWithTreeNodeUnwrapping('azureFunctions.startJavaRemoteDebug', remoteDebugJavaFunctionApp);
9799
registerCommandWithTreeNodeUnwrapping('azureFunctions.startRemoteDebug', startRemoteDebug);

0 commit comments

Comments
 (0)