Skip to content

Commit 1951fa4

Browse files
authored
Reorganizing commands in preparation for upcoming revision draft work (#403)
1 parent 503032c commit 1951fa4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+145
-171
lines changed

package.json

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
"icon": "$(add)"
6767
},
6868
{
69-
"command": "containerApps.deploy",
70-
"title": "%containerApps.deploy%",
69+
"command": "containerApps.deployImage",
70+
"title": "%containerApps.deployImage%",
7171
"category": "Azure Container Apps",
7272
"icon": "$(cloud-upload)"
7373
},
@@ -177,31 +177,7 @@
177177
"category": "Azure Container Apps"
178178
}
179179
],
180-
"submenus": [
181-
{
182-
"id": "containerApps.submenus.workspaceActions",
183-
"label": "Azure Container Apps",
184-
"icon": "resources/azure-containerapps.svg"
185-
}
186-
],
187180
"menus": {
188-
"containerApps.submenus.workspaceActions": [
189-
{
190-
"command": "containerApps.deploy",
191-
"group": "1_deploy@1"
192-
},
193-
{
194-
"command": "containerApps.createContainerApp",
195-
"group": "2_create@1"
196-
}
197-
],
198-
"view/title": [
199-
{
200-
"submenu": "containerApps.submenus.workspaceActions",
201-
"when": "view == azureWorkspace",
202-
"group": "navigation@4"
203-
}
204-
],
205181
"view/item/context": [
206182
{
207183
"command": "containerApps.createManagedEnvironment",
@@ -239,7 +215,7 @@
239215
"group": "2@2"
240216
},
241217
{
242-
"command": "containerApps.deploy",
218+
"command": "containerApps.deployImage",
243219
"when": "view =~ /(azureResourceGroups|azureFocusView)/ && viewItem =~ /containerAppItem/i",
244220
"group": "3@1"
245221
},

package.nls.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"containerApps.enableOutputTimestamps": "Prepends each line displayed in the output channel with a timestamp.",
77
"containerApps.browse": "Browse",
88
"containerApps.createContainerApp": "Create Container App...",
9-
"containerApps.deploy": "Deploy to Container App...",
10-
"containerApps.deployImageApi": "Update Image in Container App (API)...",
9+
"containerApps.deployImage": "Update Container App Image......",
10+
"containerApps.deployImageApi": "Update Container App Image (API)...",
1111
"containerApps.deleteContainerApp": "Delete Container App...",
1212
"containerApps.disableIngress": "Disable Ingress for Container App",
1313
"containerApps.enableIngress": "Enable Ingress for Container App...",

src/commands/createContainerApp/ContainerAppCreateStep.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { ext } from "../../extensionVariables";
1212
import { ContainerAppItem } from "../../tree/ContainerAppItem";
1313
import { createContainerAppsAPIClient } from "../../utils/azureClients";
1414
import { localize } from "../../utils/localize";
15-
import { getContainerNameForImage } from "../imageSource/containerRegistry/getContainerNameForImage";
15+
import { getContainerNameForImage } from "../deployImage/imageSource/containerRegistry/getContainerNameForImage";
1616
import { ICreateContainerAppContext } from "./ICreateContainerAppContext";
1717

1818
export class ContainerAppCreateStep extends AzureWizardExecuteStep<ICreateContainerAppContext> {

src/commands/createContainerApp/ICreateContainerAppContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import type { IResourceGroupWizardContext } from '@microsoft/vscode-azext-azureutils';
77
import type { ExecuteActivityContext } from '@microsoft/vscode-azext-utils';
88
import type { IContainerAppContext } from '../IContainerAppContext';
9-
import type { ImageSourceBaseContext } from '../imageSource/ImageSourceBaseContext';
9+
import type { ImageSourceBaseContext } from '../deployImage/imageSource/ImageSourceBaseContext';
1010
import type { IngressContext } from '../ingress/IngressContext';
1111

1212
export interface ICreateContainerAppContext extends IResourceGroupWizardContext, ImageSourceBaseContext, IngressContext, IContainerAppContext, ExecuteActivityContext {

src/commands/createContainerApp/createContainerApp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type { ManagedEnvironmentItem } from "../../tree/ManagedEnvironmentItem";
1212
import { createActivityContext } from "../../utils/activityUtils";
1313
import { localize } from "../../utils/localize";
1414
import { containerAppEnvironmentExperience } from "../../utils/pickContainerApp";
15-
import { ImageSourceListStep } from "../imageSource/ImageSourceListStep";
15+
import { ImageSourceListStep } from "../deployImage/imageSource/ImageSourceListStep";
1616
import { IngressPromptStep } from "../ingress/IngressPromptStep";
1717
import { ContainerAppCreateStep } from "./ContainerAppCreateStep";
1818
import { ContainerAppNameStep } from "./ContainerAppNameStep";

src/commands/deployContainerApp/ContainerAppOverwriteConfirmStep.ts renamed to src/commands/deployImage/ContainerAppOverwriteConfirmStep.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55

66
import { KnownActiveRevisionsMode } from "@azure/arm-appcontainers";
77
import { AzureWizardPromptStep, nonNullProp } from "@microsoft/vscode-azext-utils";
8-
import { MessageItem } from "vscode";
9-
import { ContainerAppModel } from "../../tree/ContainerAppItem";
8+
import type { MessageItem } from "vscode";
9+
import type { ContainerAppModel } from "../../tree/ContainerAppItem";
1010
import { localize } from "../../utils/localize";
11-
import { IDeployContainerAppContext } from "./deployContainerApp";
11+
import type { IDeployImageContext } from "./deployImage";
1212

13-
export class ContainerAppOverwriteConfirmStep extends AzureWizardPromptStep<IDeployContainerAppContext> {
13+
export class ContainerAppOverwriteConfirmStep extends AzureWizardPromptStep<IDeployImageContext> {
1414
public hideStepCount: boolean = true;
1515

16-
public async prompt(context: IDeployContainerAppContext): Promise<void> {
16+
public async prompt(context: IDeployImageContext): Promise<void> {
1717
const containerApp: ContainerAppModel = nonNullProp(context, 'containerApp');
1818
const warning: string = containerApp.revisionsMode === KnownActiveRevisionsMode.Single ?
1919
localize('confirmDeploySingle', 'Are you sure you want to deploy to "{0}"? This will overwrite the active revision and unsupported features in VS Code will be lost.', containerApp.name) :
@@ -23,12 +23,12 @@ export class ContainerAppOverwriteConfirmStep extends AzureWizardPromptStep<IDep
2323
await context.ui.showWarningMessage(warning, { modal: true, stepName: 'confirmDestructiveDeployment' }, ...items);
2424
}
2525

26-
public shouldPrompt(context: IDeployContainerAppContext): boolean {
26+
public shouldPrompt(context: IDeployImageContext): boolean {
2727
return !!context.containerApp && this.hasUnsupportedFeatures(context);
2828
}
2929

3030
// Check for any portal features that VS Code doesn't currently support
31-
private hasUnsupportedFeatures(context: IDeployContainerAppContext): boolean {
31+
private hasUnsupportedFeatures(context: IDeployImageContext): boolean {
3232
const containerApp: ContainerAppModel = nonNullProp(context, 'containerApp');
3333
if (containerApp.template?.volumes) {
3434
return true;

src/commands/deployContainerApp/ContainerAppUpdateStep.ts renamed to src/commands/deployImage/ContainerAppUpdateStep.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { AzureWizardExecuteStep, nonNullProp } from "@microsoft/vscode-azext-utils";
7-
import { Progress } from "vscode";
7+
import type { Progress } from "vscode";
88
import { ext } from "../../extensionVariables";
99
import { ContainerAppItem, ContainerAppModel, getContainerEnvelopeWithSecrets } from "../../tree/ContainerAppItem";
1010
import { localize } from "../../utils/localize";
11+
import { updateContainerApp } from "../../utils/updateContainerApp";
1112
import { showContainerAppCreated } from "../createContainerApp/showContainerAppCreated";
12-
import { getContainerNameForImage } from "../imageSource/containerRegistry/getContainerNameForImage";
13-
import { IDeployContainerAppContext } from "./deployContainerApp";
14-
import { updateContainerApp } from "./updateContainerApp";
13+
import type { IDeployImageContext } from "./deployImage";
14+
import { getContainerNameForImage } from "./imageSource/containerRegistry/getContainerNameForImage";
1515

16-
export class ContainerAppUpdateStep extends AzureWizardExecuteStep<IDeployContainerAppContext> {
16+
export class ContainerAppUpdateStep extends AzureWizardExecuteStep<IDeployImageContext> {
1717
public priority: number = 260;
1818

19-
public async execute(context: IDeployContainerAppContext, progress: Progress<{ message?: string | undefined; increment?: number | undefined }>): Promise<void> {
19+
public async execute(context: IDeployImageContext, progress: Progress<{ message?: string | undefined; increment?: number | undefined }>): Promise<void> {
2020
const containerApp: ContainerAppModel = nonNullProp(context, 'containerApp');
2121
const containerAppEnvelope = await getContainerEnvelopeWithSecrets(context, context.subscription, containerApp);
2222

src/commands/deployContainerApp/deployContainerApp.ts renamed to src/commands/deployImage/deployImage.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,42 @@
55
import { VerifyProvidersStep } from "@microsoft/vscode-azext-azureutils";
66
import { AzureWizard, AzureWizardExecuteStep, AzureWizardPromptStep, ITreeItemPickerContext, createSubscriptionContext } from "@microsoft/vscode-azext-utils";
77
import { webProvider } from "../../constants";
8-
import { ContainerAppItem } from "../../tree/ContainerAppItem";
8+
import type { ContainerAppItem } from "../../tree/ContainerAppItem";
99
import { localize } from "../../utils/localize";
1010
import { pickContainerApp } from "../../utils/pickContainerApp";
11-
import { ImageSourceBaseContext } from "../imageSource/ImageSourceBaseContext";
12-
import { ImageSourceListStep } from "../imageSource/ImageSourceListStep";
1311
import { ContainerAppOverwriteConfirmStep } from "./ContainerAppOverwriteConfirmStep";
1412
import { ContainerAppUpdateStep } from "./ContainerAppUpdateStep";
13+
import type { ImageSourceBaseContext } from "./imageSource/ImageSourceBaseContext";
14+
import { ImageSourceListStep } from "./imageSource/ImageSourceListStep";
1515

16-
export type IDeployContainerAppContext = ImageSourceBaseContext;
16+
export type IDeployImageContext = ImageSourceBaseContext;
1717

18-
export async function deployContainerApp(context: ITreeItemPickerContext & Partial<IDeployContainerAppContext>, node?: ContainerAppItem): Promise<void> {
18+
export async function deployImage(context: ITreeItemPickerContext & Partial<IDeployImageContext>, node?: ContainerAppItem): Promise<void> {
1919
if (!node) {
2020
context.suppressCreatePick = true;
2121
node = await pickContainerApp(context);
2222
}
2323

2424
const { subscription, containerApp } = node;
2525

26-
const wizardContext: IDeployContainerAppContext = {
26+
const wizardContext: IDeployImageContext = {
2727
...context,
2828
...createSubscriptionContext(subscription),
2929
subscription,
3030
containerApp
3131
};
3232

33-
const promptSteps: AzureWizardPromptStep<IDeployContainerAppContext>[] = [
33+
const promptSteps: AzureWizardPromptStep<IDeployImageContext>[] = [
34+
new ImageSourceListStep(),
3435
new ContainerAppOverwriteConfirmStep(),
35-
new ImageSourceListStep()
3636
];
3737

38-
const executeSteps: AzureWizardExecuteStep<IDeployContainerAppContext>[] = [
38+
const executeSteps: AzureWizardExecuteStep<IDeployImageContext>[] = [
3939
new VerifyProvidersStep([webProvider]),
4040
new ContainerAppUpdateStep()
4141
];
4242

43-
const wizard: AzureWizard<IDeployContainerAppContext> = new AzureWizard(wizardContext, {
43+
const wizard: AzureWizard<IDeployImageContext> = new AzureWizard(wizardContext, {
4444
title: localize('deploy', 'Deploying to "{0}"', containerApp.name),
4545
promptSteps,
4646
executeSteps,

src/commands/deployContainerApp/deployImageApi.ts renamed to src/commands/deployImage/deployImageApi.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { callWithMaskHandling, createSubscriptionContext, ISubscriptionActionCon
77
import { acrDomain, ImageSource } from "../../constants";
88
import { detectRegistryDomain, getRegistryFromAcrName } from "../../utils/imageNameUtils";
99
import { pickContainerApp } from "../../utils/pickContainerApp";
10-
import { IContainerRegistryImageContext } from "../imageSource/containerRegistry/IContainerRegistryImageContext";
11-
import { deployContainerApp } from "./deployContainerApp";
10+
import { deployImage } from "./deployImage";
11+
import type { IContainerRegistryImageContext } from "./imageSource/containerRegistry/IContainerRegistryImageContext";
1212

1313
// The interface of the command options passed to the Azure Container Apps extension's deployImageToAca command
1414
// This interface is shared with the Docker extension (https://github.com/microsoft/vscode-docker)
@@ -24,7 +24,7 @@ export async function deployImageApi(context: ITreeItemPickerContext & Partial<I
2424
const node = await pickContainerApp(context);
2525
const { subscription } = node;
2626

27-
Object.assign(context, {...createSubscriptionContext(subscription), imageSource: ImageSource.ContainerRegistry }, deployImageOptions);
27+
Object.assign(context, { ...createSubscriptionContext(subscription), imageSource: ImageSource.ContainerRegistry }, deployImageOptions);
2828

2929
context.registryDomain = detectRegistryDomain(deployImageOptions.registryName);
3030
if (context.registryDomain === acrDomain) {
@@ -41,8 +41,8 @@ export async function deployImageApi(context: ITreeItemPickerContext & Partial<I
4141
context.valuesToMask.push(deployImageOptions.image);
4242

4343
if (deployImageOptions.secret) {
44-
return callWithMaskHandling<void>(() => deployContainerApp(context, node), deployImageOptions.secret);
44+
return callWithMaskHandling<void>(() => deployImage(context, node), deployImageOptions.secret);
4545
} else {
46-
return deployContainerApp(context, node);
46+
return deployImage(context, node);
4747
}
4848
}

src/commands/imageSource/EnvironmentVariablesListStep.ts renamed to src/commands/deployImage/imageSource/EnvironmentVariablesListStep.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
import { AzExtFsExtra, AzureWizardPromptStep } from "@microsoft/vscode-azext-utils";
77
import { parse } from "dotenv";
8-
import { ImageSource } from "../../constants";
9-
import { localize } from "../../utils/localize";
10-
import { selectWorkspaceFile } from "../../utils/workspaceUtils";
11-
import { ImageSourceBaseContext } from "./ImageSourceBaseContext";
8+
import { ImageSource } from "../../../constants";
9+
import { localize } from "../../../utils/localize";
10+
import { selectWorkspaceFile } from "../../../utils/workspaceUtils";
11+
import type { ImageSourceBaseContext } from "./ImageSourceBaseContext";
1212

1313
const skipForNowLabel: string = localize('skipForNow', '$(clock) Skip for now');
1414

0 commit comments

Comments
 (0)