-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathDwpAcrListStep.ts
More file actions
39 lines (32 loc) · 1.92 KB
/
DwpAcrListStep.ts
File metadata and controls
39 lines (32 loc) · 1.92 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
38
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { type Registry } from "@azure/arm-containerregistry";
import { AzureWizardPromptStep, type IAzureQuickPickItem } from "@microsoft/vscode-azext-utils";
import { localize } from "../../../../utils/localize";
import { isRecommendedPick } from "../../../../utils/pickUtils";
import { acrCreatePick, AcrListStep } from "../../../image/imageSource/containerRegistry/acr/AcrListStep";
import { type DeployWorkspaceProjectInternalContext } from "../DeployWorkspaceProjectInternalContext";
export class DwpAcrListStep<T extends DeployWorkspaceProjectInternalContext> extends AzureWizardPromptStep<T> {
public async prompt(context: T): Promise<void> {
const picks: IAzureQuickPickItem<Registry | undefined>[] = await this.getPicks(context);
if (!picks.length) {
// No container registries to choose from
return;
}
const placeHolder: string = localize('selectContainerRegistry', 'Select an Azure Container Registry to store your image');
const pick: IAzureQuickPickItem<Registry | undefined> = await context.ui.showQuickPick(picks, { placeHolder, suppressPersistence: true });
context.telemetry.properties.usedRecommendedRegistry = isRecommendedPick(pick) ? 'true' : 'false';
context.registry = pick.data;
}
public shouldPrompt(context: T): boolean {
return !context.registry;
}
public async getPicks(context: T): Promise<IAzureQuickPickItem<Registry | undefined>[]> {
return [
acrCreatePick,
...await AcrListStep.getSortedAndRecommendedPicks(context),
];
}
}