Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 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
51 changes: 38 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,26 @@
"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%",
"category": "Azure Container Apps",
"icon": "$(cloud-upload)"
"category": "Azure Container Apps"
},
{
"command": "containerApps.deployImageApi",
"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 +110,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 +225,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
2 changes: 2 additions & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"containerApps.enableOutputTimestamps": "Prepends each line displayed in the output channel with a timestamp.",
"containerApps.browse": "Browse",
"containerApps.createContainerApp": "Create Container App...",
"containerApps.editContainerApp": "Edit Container App (Advanced)",
Comment thread
nturinski marked this conversation as resolved.
Outdated
"containerApps.deployImage": "Update Container App Image......",
"containerApps.deployImageApi": "Update Container App Image (API)...",
"containerApps.deleteContainerApp": "Delete Container App...",
Expand All @@ -14,6 +15,7 @@
"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 in single revision mode.'));
Comment thread
nturinski marked this conversation as resolved.
Outdated
Comment thread
MicroFish91 marked this conversation as resolved.
Outdated
}

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