Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 39 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@
"category": "Azure Container Apps",
"icon": "$(add)"
},
{
"command": "containerApps.deleteManagedEnvironment",
"title": "%containerApps.deleteManagedEnvironment%",
"category": "Azure Container Apps"
},
{
"command": "containerApps.editContainerApp",
"title": "%containerApps.editContainerApp%",
"category": "Azure Container Apps"
},
{
"command": "containerApps.deployImage",
"title": "%containerApps.deployImage%",
Expand All @@ -76,11 +86,6 @@
"title": "%containerApps.deployImageApi%",
"category": "Azure Container Apps"
},
{
Comment thread
nturinski marked this conversation as resolved.
"command": "containerApps.deleteManagedEnvironment",
"title": "%containerApps.deleteManagedEnvironment%",
"category": "Azure Container Apps"
},
{
"command": "containerApps.deleteContainerApp",
"title": "%containerApps.deleteContainerApp%",
Expand All @@ -106,6 +111,12 @@
"title": "%containerApps.editTargetPort%",
"category": "Azure Container Apps"
},
{
"command": "containerApps.discardRevisionDraft",
"title": "%containerApps.discardRevisionDraft%",
"category": "Azure Container Apps",
"icon": "$(discard)"
},
{
"command": "containerApps.chooseRevisionMode",
"title": "%containerApps.chooseRevisionMode%",
Expand Down Expand Up @@ -215,24 +226,39 @@
"group": "2@2"
},
{
"command": "containerApps.deployImage",
"when": "view =~ /(azureResourceGroups|azureFocusView)/ && viewItem =~ /containerAppItem/i",
"group": "3@1"
"command": "containerApps.discardRevisionDraft",
"when": "view =~ /(azureResourceGroups|azureFocusView)/ && viewItem =~ /containerAppItem(.*)revisionMode:single(.*)unsavedChanges:true/i",
"group": "inline@2"
},
{
"command": "containerApps.discardRevisionDraft",
"when": "view =~ /(azureResourceGroups|azureFocusView)/ && viewItem =~ /containerAppItem(.*)revisionMode:single(.*)unsavedChanges:true/i",
"group": "3@2"
},
{
"command": "containerApps.editContainerApp",
"when": "view =~ /(azureResourceGroups|azureFocusView)/ && viewItem =~ /containerAppItem(.*)revisionMode:single/i",
"group": "4@1"
},
{
"command": "containerApps.deleteContainerApp",
"when": "view =~ /(azureResourceGroups|azureFocusView)/ && viewItem =~ /containerAppItem/i",
"group": "3@2"
"group": "5@1"
},
{
"command": "containerApps.deployImage",
"when": "view =~ /(azureResourceGroups|azureFocusView)/ && viewItem =~ /containerAppItem/i",
"group": "6@1"
},
{
"command": "containerApps.startStreamingLogs",
"when": "view =~ /(azureResourceGroups|azureFocusView)/ && viewItem =~ /containerAppItem/i",
"group": "4@1"
"group": "7@1"
},
{
"command": "containerApps.stopStreamingLogs",
"when": "view =~ /(azureResourceGroups|azureFocusView)/ && viewItem =~ /containerAppItem/i",
"group": "4@2"
"group": "7@2"
},
{
"command": "containerApps.chooseRevisionMode",
Expand Down Expand Up @@ -351,6 +377,7 @@
"@azure/ms-rest-azure-env": "^2.0.0",
"@microsoft/eslint-config-azuretools": "^0.2.1",
"@microsoft/vscode-azext-dev": "^2.0.1",
"@types/deep-eql": "^4.0.0",
"@types/fs-extra": "^8.1.1",
"@types/gulp": "^4.0.6",
"@types/mocha": "^8.2.2",
Expand Down Expand Up @@ -388,6 +415,7 @@
"@microsoft/vscode-azureresources-api": "^2.0.2",
"buffer": "^6.0.3",
"dayjs": "^1.11.3",
"deep-eql": "^4.1.3",
"dotenv": "^16.0.0",
"fs-extra": "^8.1.0",
"semver": "^7.5.2",
Expand Down
4 changes: 3 additions & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
"containerApps.enableOutputTimestamps": "Prepends each line displayed in the output channel with a timestamp.",
"containerApps.browse": "Browse",
"containerApps.createContainerApp": "Create Container App...",
"containerApps.deployImage": "Update Container App Image......",
"containerApps.editContainerApp": "Edit Container App (Advanced)",
Comment thread
nturinski marked this conversation as resolved.
Outdated
"containerApps.deployImage": "Update Container App Image...",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we should call this: "Update Container..." or "Edit Container..." after our conversation offline. The image is just a part of the overall container, after all.

It's annoying and confusing, but Container =/= Container App.

Copy link
Copy Markdown
Contributor Author

@MicroFish91 MicroFish91 Jul 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's 😵‍💫

"containerApps.deployImageApi": "Update Container App Image (API)...",
"containerApps.deleteContainerApp": "Delete Container App...",
"containerApps.disableIngress": "Disable Ingress for Container App",
"containerApps.enableIngress": "Enable Ingress for Container App...",
"containerApps.toggleVisibility": "Switch Ingress Visibility...",
"containerApps.editTargetPort": "Edit Target Port...",
"containerApps.chooseRevisionMode": "Choose Revision Mode...",
"containerApps.discardRevisionDraft": "Discard Changes...",
"containerApps.activateRevision": "Activate Revision",
"containerApps.deactivateRevision": "Deactivate Revision",
"containerApps.restartRevision": "Restart Revision",
Expand Down
36 changes: 36 additions & 0 deletions resources/revision-draft.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import type { Run as AcrRun } from '@azure/arm-containerregistry';
import { KnownRunStatus } from '@azure/arm-containerregistry';
import { nonNullValue } from '@microsoft/vscode-azext-utils';
import { delay } from '../../../../utils/delay';
import { IBuildImageInAzureContext } from "./IBuildImageInAzureContext";

const WAIT_MS = 5000;
Expand All @@ -25,7 +26,3 @@ export async function buildImageInAzure(context: IBuildImageInAzureContext): Pro

return run;
}

async function delay(ms: number): Promise<void> {
await new Promise<void>((resolve: () => void): NodeJS.Timer => setTimeout(resolve, ms));
}
21 changes: 21 additions & 0 deletions src/commands/editContainerApp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { KnownActiveRevisionsMode } from "@azure/arm-appcontainers";
import type { IActionContext } from "@microsoft/vscode-azext-utils";
import { ext } from "../extensionVariables";
import type { ContainerAppItem } from "../tree/ContainerAppItem";
import { localize } from "../utils/localize";
import { pickContainerApp } from "../utils/pickContainerApp";

export async function editContainerApp(context: IActionContext, node?: ContainerAppItem): Promise<void> {
node ??= await pickContainerApp(context);

if (node.containerApp.revisionsMode !== KnownActiveRevisionsMode.Single) {
throw new Error(localize('revisionModeError', 'The issued command can only be executed when the container app is in single revision mode.'));
}

await ext.revisionDraftFileSystem.editRevisionDraft(node);
}
6 changes: 6 additions & 0 deletions src/commands/registerCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { deleteContainerApp } from './deleteContainerApp/deleteContainerApp';
import { deleteManagedEnvironment } from './deleteManagedEnvironment/deleteManagedEnvironment';
import { deployImage } from './deployImage/deployImage';
import { deployImageApi } from './deployImage/deployImageApi';
import { editContainerApp } from './editContainerApp';
import { connectToGitHub } from './gitHub/connectToGitHub/connectToGitHub';
import { disconnectRepo } from './gitHub/disconnectRepo/disconnectRepo';
import { openGitHubRepo } from './gitHub/openGitHubRepo';
Expand All @@ -25,6 +26,7 @@ import { activateRevision } from './revision/activateRevision';
import { chooseRevisionMode } from './revision/chooseRevisionMode';
import { deactivateRevision } from './revision/deactivateRevision';
import { restartRevision } from './revision/restartRevision';
import { discardRevisionDraft } from './revisionDraft/discardRevisionDraft';
import { addScaleRule } from './scaling/addScaleRule/addScaleRule';
import { editScalingRange } from './scaling/editScalingRange';

Expand All @@ -35,6 +37,7 @@ export function registerCommands(): void {

// container apps
registerCommandWithTreeNodeUnwrapping('containerApps.createContainerApp', createContainerApp);
registerCommandWithTreeNodeUnwrapping('containerApps.editContainerApp', editContainerApp);
registerCommandWithTreeNodeUnwrapping('containerApps.deleteContainerApp', deleteContainerApp);
registerCommandWithTreeNodeUnwrapping('containerApps.deployImage', deployImage);
registerCommandWithTreeNodeUnwrapping('containerApps.deployImageApi', deployImageApi);
Expand All @@ -58,6 +61,9 @@ export function registerCommands(): void {
registerCommandWithTreeNodeUnwrapping('containerApps.deactivateRevision', deactivateRevision);
registerCommandWithTreeNodeUnwrapping('containerApps.restartRevision', restartRevision);

// revision draft
registerCommandWithTreeNodeUnwrapping('containerApps.discardRevisionDraft', discardRevisionDraft);

// scaling
registerCommandWithTreeNodeUnwrapping('containerApps.editScalingRange', editScalingRange);
registerCommandWithTreeNodeUnwrapping('containerApps.addScaleRule', addScaleRule);
Expand Down
Loading