-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathAcrEnableAdminUserConfirmStep.ts
More file actions
21 lines (18 loc) · 1.43 KB
/
AcrEnableAdminUserConfirmStep.ts
File metadata and controls
21 lines (18 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { AzureWizardPromptStep } from "@microsoft/vscode-azext-utils";
import { acrDomain } from "../../../constants";
import { getRegistryDomainFromContext } from "../../../utils/imageNameUtils";
import { localize } from "../../../utils/localize";
import { type DockerLoginRegistryCredentialsContext } from "./DockerLoginRegistryCredentialsContext";
export class AcrEnableAdminUserConfirmStep extends AzureWizardPromptStep<DockerLoginRegistryCredentialsContext> {
public async prompt(context: DockerLoginRegistryCredentialsContext): Promise<void> {
const message = localize('enableAdminUser', 'Admin user login is required to continue. If enabled, it will allow docker login access to your ACR using the registry\'s username and password.');
await context.ui.showWarningMessage(message, { modal: true }, { title: localize('enable', 'Enable') });
}
public shouldPrompt(context: DockerLoginRegistryCredentialsContext): boolean {
return !context.suppressEnableAdminUserPrompt && getRegistryDomainFromContext(context) === acrDomain && !context.registry?.adminUserEnabled;
}
}