-
Notifications
You must be signed in to change notification settings - Fork 149
Expand file tree
/
Copy pathBooleanPromptStep.ts
More file actions
23 lines (19 loc) · 1.27 KB
/
BooleanPromptStep.ts
File metadata and controls
23 lines (19 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { type IAzureQuickPickItem } from "@microsoft/vscode-azext-utils";
import { type BindingSettingValue } from "../../../funcConfig/function";
import { envUtils } from "../../../utils/envUtils";
import { type IBindingWizardContext } from "../IBindingWizardContext";
import { BindingSettingStepBase } from "./BindingSettingStepBase";
export class BooleanPromptStep extends BindingSettingStepBase {
public async promptCore(context: IBindingWizardContext): Promise<BindingSettingValue> {
let picks: IAzureQuickPickItem<boolean>[] = [true, false].map(v => { return { label: String(v), data: v }; });
// Make sure the correct default value is at the top of the list
if (!envUtils.isEnvironmentVariableSet(this._setting.defaultValue)) {
picks = picks.reverse();
}
return (await context.ui.showQuickPick(picks, { placeHolder: this._setting.description || this._setting.label })).data;
}
}