-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathshowContainerAppNotification.ts
More file actions
32 lines (28 loc) · 1.77 KB
/
showContainerAppNotification.ts
File metadata and controls
32 lines (28 loc) · 1.77 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
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { type ContainerApp } from "@azure/arm-appcontainers";
import { callWithTelemetryAndErrorHandling, type IActionContext } from "@microsoft/vscode-azext-utils";
import { window, type MessageItem } from "vscode";
import { isIngressEnabled } from "../../tree/ContainerAppItem";
import { localize } from "../../utils/localize";
import { browseContainerApp } from "../browseContainerApp";
export async function showContainerAppNotification(containerApp: ContainerApp, isUpdate: boolean = false): Promise<void> {
return await callWithTelemetryAndErrorHandling('containerApps.showCaNotification', async (context: IActionContext) => {
const createdCa: string = localize('createdCa', 'Successfully created new container app "{0}".', containerApp.name);
const deployedCa: string = localize('deployedCa', 'Successfully updated container app "{0}"', containerApp.name);
const message = isUpdate ? deployedCa : createdCa;
const browse: MessageItem = { title: localize('browse', 'Browse') };
const buttons: MessageItem[] = [];
if (isIngressEnabled(containerApp)) {
buttons.push(browse)
}
const result = await window.showInformationMessage(message, ...buttons)
context.telemetry.properties.clicked = 'canceled';
if (result === browse) {
await browseContainerApp(containerApp);
context.telemetry.properties.clicked = 'browse';
}
});
}