-
Notifications
You must be signed in to change notification settings - Fork 149
Expand file tree
/
Copy pathEventGridSourceStep.ts
More file actions
37 lines (32 loc) · 1.76 KB
/
EventGridSourceStep.ts
File metadata and controls
37 lines (32 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { AzureWizardPromptStep, type IAzureQuickPickItem } from "@microsoft/vscode-azext-utils";
import { localize } from "../../../localize";
import { type EventGridExecuteFunctionContext } from "./EventGridExecuteFunctionContext";
import { supportedEventGridSourceLabels, supportedEventGridSources, type EventGridSource } from "./eventGridSources";
export class EventGridSourceStep extends AzureWizardPromptStep<EventGridExecuteFunctionContext> {
public hideStepCount: boolean = false;
public async prompt(context: EventGridExecuteFunctionContext): Promise<void> {
// Prompt for event source
const eventGridSourcePicks: IAzureQuickPickItem<EventGridSource | undefined>[] = supportedEventGridSources.map((source: EventGridSource) => {
return {
label: supportedEventGridSourceLabels.get(source) || source,
data: source,
};
});
const eventSource =
(
await context.ui.showQuickPick(eventGridSourcePicks, {
placeHolder: localize('selectEventSource', 'Select the event source'),
stepName: 'eventGridSource',
})
).data;
context.telemetry.properties.eventGridSource = eventSource;
context.eventSource = eventSource;
}
public shouldPrompt(context: EventGridExecuteFunctionContext): boolean {
return !context.eventSource;
}
}