-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy patheditTargetPort.ts
More file actions
46 lines (38 loc) · 1.98 KB
/
editTargetPort.ts
File metadata and controls
46 lines (38 loc) · 1.98 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
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { AzureWizard, AzureWizardExecuteStep, AzureWizardPromptStep, createSubscriptionContext, IActionContext } from "@microsoft/vscode-azext-utils";
import { IngressItem } from "../../../tree/configurations/IngressItem";
import type { ContainerAppItem } from "../../../tree/ContainerAppItem";
import { createActivityContext } from "../../../utils/activityUtils";
import { localize } from "../../../utils/localize";
import { pickContainerApp } from "../../../utils/pickContainerApp";
import type { IngressContext } from "../IngressContext";
import { TargetPortInputStep } from "./TargetPortInputStep";
import { TargetPortUpdateStep } from "./TargetPortUpdateStep";
export async function editTargetPort(context: IActionContext, node?: IngressItem): Promise<void> {
const { subscription, containerApp }: ContainerAppItem | IngressItem = node ?? await pickContainerApp(context);
const wizardContext: IngressContext = {
...context,
...createSubscriptionContext(subscription),
...(await createActivityContext()),
subscription,
containerApp
};
const title: string = localize('updateTargetPort', 'Update target port for container app "{0}"', containerApp.name);
const promptSteps: AzureWizardPromptStep<IngressContext>[] = [
new TargetPortInputStep()
];
const executeSteps: AzureWizardExecuteStep<IngressContext>[] = [
new TargetPortUpdateStep()
];
const wizard: AzureWizard<IngressContext> = new AzureWizard(wizardContext, {
title,
promptSteps,
executeSteps,
showLoadingPrompt: true
});
await wizard.prompt();
await wizard.execute();
}