-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathDeployWorkspaceProjectConfirmStep.ts
More file actions
64 lines (54 loc) · 2.68 KB
/
DeployWorkspaceProjectConfirmStep.ts
File metadata and controls
64 lines (54 loc) · 2.68 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { nonNullValue } from "@microsoft/vscode-azext-utils";
import { ext } from "../../extensionVariables";
import { localize } from "../../utils/localize";
import { OverwriteConfirmStepBase } from "../OverwriteConfirmStepBase";
import type { DeployWorkspaceProjectContext } from "./DeployWorkspaceProjectContext";
export class DeployWorkspaceProjectConfirmStep extends OverwriteConfirmStepBase<DeployWorkspaceProjectContext> {
protected async promptCore(context: DeployWorkspaceProjectContext): Promise<void> {
const resourcesToCreate: string[] = [];
if (!context.resourceGroup) {
resourcesToCreate.push('resource group');
}
if (!context.managedEnvironment) {
resourcesToCreate.push('log analytics workspace');
resourcesToCreate.push('container app environment');
}
if (!context.registry) {
resourcesToCreate.push('container registry');
}
if (!context.containerApp) {
resourcesToCreate.push('container app');
}
let confirmMessage: string | undefined;
let outputMessage: string | undefined;
if (resourcesToCreate.length) {
confirmMessage = localize('resourceCreationConfirm',
'To deploy your workspace project, the following resources will be created: "{0}".',
resourcesToCreate.join(', ')
);
outputMessage = localize('resourceCreationConfirmed',
'User confirmed creation for the following resources: "{0}".',
resourcesToCreate.join(', ')
);
} else {
confirmMessage = localize('overwriteConfirm', 'The latest deployment of container app "{0}" will be overwritten.', context.containerApp?.name);
outputMessage = localize('overwriteConfirmed', 'User confirmed overwrite of container app "{0}".', context.containerApp?.name);
}
if (this.hasUnsupportedFeatures(context)) {
confirmMessage += '\n\n' + this.unsupportedFeaturesWarning;
}
await context.ui.showWarningMessage(
nonNullValue(confirmMessage),
{ modal: true },
{ title: localize('continue', 'Continue') }
);
ext.outputChannel.appendLog(outputMessage);
}
public shouldPrompt(): boolean {
return true;
}
}