Skip to content

Commit 1c85377

Browse files
authored
Refactor / consolidate deployImage & deployImageApi commands (#476)
1 parent f29c3a7 commit 1c85377

File tree

64 files changed

+113
-122
lines changed

Some content is hidden

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

64 files changed

+113
-122
lines changed

package.json

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,6 @@
7575
"title": "%containerApps.editContainerApp%",
7676
"category": "Azure Container Apps"
7777
},
78-
{
79-
"command": "containerApps.deployImage",
80-
"title": "%containerApps.deployImage%",
81-
"category": "Azure Container Apps",
82-
"icon": "$(cloud-upload)"
83-
},
8478
{
8579
"command": "containerApps.deployImageApi",
8680
"title": "%containerApps.deployImageApi%",
@@ -334,11 +328,6 @@
334328
"when": "view =~ /(azureResourceGroups|azureFocusView)/ && viewItem =~ /containerAppItem/i",
335329
"group": "5@1"
336330
},
337-
{
338-
"command": "containerApps.deployImage",
339-
"when": "view =~ /(azureResourceGroups|azureFocusView)/ && viewItem =~ /containerAppItem/i",
340-
"group": "6@1"
341-
},
342331
{
343332
"command": "containerApps.startStreamingLogs",
344333
"when": "view =~ /(azureResourceGroups|azureFocusView)/ && viewItem =~ /containerAppItem/i",

package.nls.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
"containerApps.browse": "Browse",
88
"containerApps.createContainerApp": "Create Container App...",
99
"containerApps.editContainerApp": "Edit Container App (Advanced)...",
10-
"containerApps.deployImage": "Update Container App Image...",
11-
"containerApps.deployImageApi": "Update Container App Image (API)...",
10+
"containerApps.deployImageApi": "Deploy Image to Container App (API)...",
1211
"containerApps.deployWorkspaceProject": "Deploy Project from Workspace...",
1312
"containerApps.deleteContainerApp": "Delete Container App...",
1413
"containerApps.disableIngress": "Disable Ingress for Container App",

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
import { KnownActiveRevisionsMode } from "@azure/arm-appcontainers";
77
import { AzureWizardPromptStep, nonNullProp } from "@microsoft/vscode-azext-utils";
88
import type { MessageItem } from "vscode";
9-
import type { ContainerAppModel } from "../../tree/ContainerAppItem";
10-
import { localize } from "../../utils/localize";
11-
import type { IDeployImageContext } from "./deployImage";
9+
import type { ContainerAppModel } from "../tree/ContainerAppItem";
10+
import { localize } from "../utils/localize";
11+
import type { IContainerAppContext } from "./IContainerAppContext";
1212

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

16-
public async prompt(context: IDeployImageContext): Promise<void> {
16+
public async prompt(context: T): 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: IDeployImageContext): boolean {
26+
public shouldPrompt(context: T): 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: IDeployImageContext): boolean {
31+
private hasUnsupportedFeatures(context: T): boolean {
3232
const containerApp: ContainerAppModel = nonNullProp(context, 'containerApp');
3333
if (containerApp.template?.volumes) {
3434
return true;

src/commands/createContainerApp/ContainerAppCreateStep.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { ExecuteActivityOutput, ExecuteActivityOutputStepBase } from "../../util
1313
import { createActivityChildContext } from "../../utils/activity/activityUtils";
1414
import { createContainerAppsAPIClient } from "../../utils/azureClients";
1515
import { localize } from "../../utils/localize";
16-
import { getContainerNameForImage } from "../deployImage/imageSource/containerRegistry/getContainerNameForImage";
16+
import { getContainerNameForImage } from "../image/imageSource/containerRegistry/getContainerNameForImage";
1717
import type { ICreateContainerAppContext } from "./ICreateContainerAppContext";
1818

1919
export class ContainerAppCreateStep extends ExecuteActivityOutputStepBase<ICreateContainerAppContext> {

src/commands/createContainerApp/ICreateContainerAppContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { ManagedEnvironment } from '@azure/arm-appcontainers';
77
import type { IResourceGroupWizardContext } from '@microsoft/vscode-azext-azureutils';
88
import type { ExecuteActivityContext } from '@microsoft/vscode-azext-utils';
99
import type { IContainerAppContext } from '../IContainerAppContext';
10-
import type { ImageSourceBaseContext } from '../deployImage/imageSource/ImageSourceBaseContext';
10+
import type { ImageSourceBaseContext } from '../image/imageSource/ImageSourceBaseContext';
1111
import type { IngressContext } from '../ingress/IngressContext';
1212

1313
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
@@ -13,7 +13,7 @@ import type { ManagedEnvironmentItem } from "../../tree/ManagedEnvironmentItem";
1313
import { createActivityContext } from "../../utils/activity/activityUtils";
1414
import { localize } from "../../utils/localize";
1515
import { pickEnvironment } from "../../utils/pickItem/pickEnvironment";
16-
import { ImageSourceListStep } from "../deployImage/imageSource/ImageSourceListStep";
16+
import { ImageSourceListStep } from "../image/imageSource/ImageSourceListStep";
1717
import { IngressPromptStep } from "../ingress/IngressPromptStep";
1818
import { ContainerAppCreateStep } from "./ContainerAppCreateStep";
1919
import { ContainerAppNameStep } from "./ContainerAppNameStep";

src/commands/deployImage/deployImage.ts

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/commands/deployWorkspaceProject/DeployWorkspaceProjectContext.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import type { ExecuteActivityContext } from "@microsoft/vscode-azext-utils";
77
import type { ICreateContainerAppContext } from "../createContainerApp/ICreateContainerAppContext";
88
import type { IManagedEnvironmentContext } from "../createManagedEnvironment/IManagedEnvironmentContext";
9-
import type { IBuildImageInAzureContext } from "../deployImage/imageSource/buildImageInAzure/IBuildImageInAzureContext";
10-
import type { CreateAcrContext } from "../deployImage/imageSource/containerRegistry/acr/createAcr/CreateAcrContext";
9+
import type { IBuildImageInAzureContext } from "../image/imageSource/buildImageInAzure/IBuildImageInAzureContext";
10+
import type { CreateAcrContext } from "../image/imageSource/containerRegistry/acr/createAcr/CreateAcrContext";
1111

1212
// Use intersection typing instead of an interface here to bypass some minor (relatively trivial) type mismatch issues introduced by having to use the 'Partial' utility
1313
export type DeployWorkspaceProjectContext = IManagedEnvironmentContext & ICreateContainerAppContext & CreateAcrContext & Partial<IBuildImageInAzureContext> & ExecuteActivityContext & {

src/commands/deployWorkspaceProject/deployWorkspaceProject.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ import { ext } from "../../extensionVariables";
1212
import { ContainerAppModel, isIngressEnabled } from "../../tree/ContainerAppItem";
1313
import { createActivityChildContext, createActivityContext } from "../../utils/activity/activityUtils";
1414
import { localize } from "../../utils/localize";
15+
import { ContainerAppOverwriteConfirmStep } from "../ContainerAppOverwriteConfirmStep";
1516
import { browseContainerApp } from "../browseContainerApp";
1617
import { ContainerAppCreateStep } from "../createContainerApp/ContainerAppCreateStep";
1718
import { LogAnalyticsCreateStep } from "../createManagedEnvironment/LogAnalyticsCreateStep";
1819
import { ManagedEnvironmentCreateStep } from "../createManagedEnvironment/ManagedEnvironmentCreateStep";
19-
import { ContainerAppOverwriteConfirmStep } from "../deployImage/ContainerAppOverwriteConfirmStep";
20-
import { ContainerAppUpdateStep } from "../deployImage/ContainerAppUpdateStep";
21-
import { ImageSourceListStep } from "../deployImage/imageSource/ImageSourceListStep";
20+
import { ContainerAppUpdateStep } from "../image/imageSource/ContainerAppUpdateStep";
21+
import { ImageSourceListStep } from "../image/imageSource/ImageSourceListStep";
2222
import { IngressPromptStep } from "../ingress/IngressPromptStep";
2323
import { DeployWorkspaceProjectConfirmStep } from "./DeployWorkspaceProjectConfirmStep";
2424
import type { DeployWorkspaceProjectContext } from "./DeployWorkspaceProjectContext";

src/commands/deployWorkspaceProject/getDefaultValues/DefaultResourcesNameStep.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { localize } from "../../../utils/localize";
1111
import { validateUtils } from "../../../utils/validateUtils";
1212
import { ContainerAppNameStep } from "../../createContainerApp/ContainerAppNameStep";
1313
import { ManagedEnvironmentNameStep } from "../../createManagedEnvironment/ManagedEnvironmentNameStep";
14-
import { RegistryNameStep } from "../../deployImage/imageSource/containerRegistry/acr/createAcr/RegistryNameStep";
14+
import { RegistryNameStep } from "../../image/imageSource/containerRegistry/acr/createAcr/RegistryNameStep";
1515
import type { DeployWorkspaceProjectContext } from "../DeployWorkspaceProjectContext";
1616

1717
export class DefaultResourcesNameStep extends AzureWizardPromptStep<DeployWorkspaceProjectContext> {

0 commit comments

Comments
 (0)