Skip to content

Commit

Permalink
merge with main
Browse files Browse the repository at this point in the history
  • Loading branch information
MicroFish91 committed Jan 20, 2023
2 parents 3b4dc9f + 5922a89 commit fa14742
Show file tree
Hide file tree
Showing 11 changed files with 192 additions and 272 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.14
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!-- region exclude-from-marketplace -->

[![Version](https://vsmarketplacebadge.apphb.com/version/ms-azuretools.vscode-azurecontainerapps.svg)](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurecontainerapps) [![Installs](https://vsmarketplacebadge.apphb.com/installs-short/ms-azuretools.vscode-azurecontainerapps.svg)](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurecontainerapps) [![Build Status](https://dev.azure.com/ms-azuretools/AzCode/_apis/build/status/vscode-azurecontainerapps?branchName=main)](https://dev.azure.com/ms-azuretools/AzCode/_build/latest?definitionId=39&branchName=main)
[![Version](https://img.shields.io/visual-studio-marketplace/v/ms-azuretools.vscode-azurecontainerapps.svg)](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurecontainerapps) [![Installs](https://img.shields.io/visual-studio-marketplace/i/ms-azuretools.vscode-azurecontainerapps.svg)](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurecontainerapps) [![Build Status](https://dev.azure.com/ms-azuretools/AzCode/_apis/build/status/vscode-azurecontainerapps?branchName=main)](https://dev.azure.com/ms-azuretools/AzCode/_build/latest?definitionId=39&branchName=main)


<!-- endregion exclude-from-marketplace -->
Expand Down
411 changes: 165 additions & 246 deletions package-lock.json

Large diffs are not rendered by default.

17 changes: 13 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"preview": true,
"activationEvents": [
"onCommand:containerApps.viewProperties",
"onCommand:containerApps.openLogsInPortal",
"onCommand:containerApps.openInPortal",
"onCommand:containerApps.reportIssue",
"onCommand:containerApps.createContainerApp",
"onCommand:containerApps.deployImage",
Expand Down Expand Up @@ -74,8 +74,8 @@
"category": "Azure Container Apps"
},
{
"command": "containerApps.openLogsInPortal",
"title": "%containerApps.openLogsInPortal%",
"command": "containerApps.openInPortal",
"title": "%containerApps.openInPortal%",
"category": "Azure Container Apps"
},
{
Expand Down Expand Up @@ -182,6 +182,11 @@
"when": "view == azureResourceGroups && viewItem =~ /azResource/i && viewItem =~ /^(?!.*containerEnvironment).*/i",
"group": "z@1"
},
{
"command": "containerApps.openInPortal",
"when": "view == azureResourceGroups && viewItem =~ /containerApp[^s]/i",
"group": "z@2"
},
{
"command": "containerApps.createManagedEnvironment",
"when": "view == azureResourceGroups && viewItem =~ /azureResourceTypeGroup/i && viewItem =~ /containerAppsEnvironment/i",
Expand Down Expand Up @@ -276,6 +281,10 @@
{
"command": "containerApps.deployImageApi",
"when": "never"
},
{
"command": "containerApps.openInPortal",
"when": "never"
}
]
},
Expand Down Expand Up @@ -343,7 +352,7 @@
"glob": "^7.1.6",
"gulp": "^4.0.2",
"husky": "^7.0.2",
"mocha": "^8.3.2",
"mocha": "^10.1.0",
"mocha-junit-reporter": "^2.0.0",
"mocha-multi-reporters": "^1.1.7",
"ts-node": "^7.0.1",
Expand Down
2 changes: 1 addition & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"containerApps.deleteConfirmation": "The behavior to use when confirming delete of a Container Apps environment.",
"containerApps.deleteConfirmation.EnterName": "Prompts with an input box where you enter the Container Apps environment name to delete.",
"containerApps.deleteConfirmation.ClickButton": "Prompts with a warning dialog where you click a button to delete.",
"containerApps.openLogsInPortal": "Open Logs in Portal",
"containerApps.openInPortal": "Open in Portal",
"containerApps.openConsoleInPortal": "Open Console in Portal",
"containerApps.editScalingRange": "Edit Scaling Range...",
"containerApps.addScaleRule": "Add Scale Rule..."
Expand Down
4 changes: 2 additions & 2 deletions src/commands/createContainerApp/ContainerAppNameStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export class ContainerAppNameStep extends AzureWizardPromptStep<IContainerAppCon
name = name ? name.trim() : '';
// to prevent showing an error when the character types the first letter

const { minLength, maxLength } = { minLength: 2, maxLength: 20 };
if (!/^[a-z]([-a-z0-9]*[a-z0-9])?$/.test(name)) {
const { minLength, maxLength } = { minLength: 1, maxLength: 32 };
if (!/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(name)) {
return localize('invalidChar', `A name must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character and cannot have '--'.`);
} else if ((name.length < minLength) || name.length > maxLength) {
return localize('invalidLength', 'The name must be between {0} and {1} characters.', minLength, maxLength);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class DeleteEnvironmentConfirmationStep extends AzureWizardPromptStep<IDe
this.managedEnvironmentName, numOfResources);

const deleteConfirmation: string | undefined = settingUtils.getWorkspaceSetting('deleteConfirmation');
if (deleteConfirmation === 'ClickButton' || hasNoResources) {
if (deleteConfirmation === 'ClickButton') {
const message: string = hasNoResources ? deleteEnv : deleteEnvAndApps;
await context.ui.showWarningMessage(message, { modal: true, stepName: 'confirmDelete' }, DialogResponses.deleteResponse); // no need to check result - cancel will throw error
} else {
Expand All @@ -44,11 +44,11 @@ export class DeleteEnvironmentConfirmationStep extends AzureWizardPromptStep<IDe
return true;
}

private validateInput (val: string | undefined, prompt: string): string | undefined {
private validateInput(val: string | undefined, prompt: string): string | undefined {
return this.isNameEqualToEnvironment(val) ? undefined : prompt;
}

private isNameEqualToEnvironment (val: string | undefined): boolean {
private isNameEqualToEnvironment(val: string | undefined): boolean {
return !!val && val.toLowerCase() === nonNullValue(this.managedEnvironmentName).toLowerCase();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as azUtil from '@microsoft/vscode-azext-azureutils';
import { AzExtTreeItem, IActionContext } from '@microsoft/vscode-azext-utils';
import { rootFilter } from '../constants';
import { ext } from '../extensionVariables';
import { LogsTreeItem } from '../tree/LogsTreeItem';

export async function openLogsInPortal(context: IActionContext, node?: AzExtTreeItem): Promise<void> {
if (!node) {
node = await ext.rgApi.pickAppResource<AzExtTreeItem>(context, {
filter: rootFilter,
expectedChildContextValue: new RegExp(LogsTreeItem.openLogsContext)
});
}
export async function openInPortal(_context: IActionContext, node: AzExtTreeItem): Promise<void> {
await azUtil.openInPortal(node, node.id ?? node.fullId);
}
4 changes: 2 additions & 2 deletions src/commands/registerCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ import { deleteNode } from './deleteNode';
import { deployImage } from './deployImage/deployImage';
import { deployImageApi } from './deployImage/deployImageApi';
import { editTargetPort, toggleIngress, toggleIngressVisibility } from './ingressCommands';
import { openLogsInPortal } from './openLogsInPortal';
import { openInPortal } from './openInPortal';
import { changeRevisionActiveState } from './revisionCommands/changeRevisionActiveState';
import { addScaleRule } from './scaling/addScaleRule/addScaleRule';
import { editScalingRange } from './scaling/editScalingRange';
import { viewProperties } from './viewProperties';

export function registerCommands(): void {
registerCommand('containerApps.viewProperties', viewProperties);
registerCommand('containerApps.openLogsInPortal', openLogsInPortal);
registerCommand('containerApps.openInPortal', openInPortal);
registerCommand('containerApps.selectSubscriptions', () => commands.executeCommand('azure-account.selectSubscriptions'));
registerCommand('containerApps.browse', browse);
registerCommand('containerApps.createManagedEnvironment', createManagedEnvironment);
Expand Down
4 changes: 2 additions & 2 deletions src/tree/LogsTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export class LogsTreeItem extends AzExtParentTreeItem {
public async loadMoreChildrenImpl(): Promise<AzExtTreeItem[]> {
const iconPath = new ThemeIcon('link-external');
return [
new GenericTreeItem(this, { label: 'Open Logs', contextValue: 'openLogs', commandId: 'containerApps.openLogsInPortal', iconPath, id: `${this.parent.id}/logs` }),
new GenericTreeItem(this, { label: 'Open Log Stream', contextValue: 'openLogStream', commandId: 'containerApps.openLogsInPortal', iconPath, id: `${this.parent.id}/logstream` })
new GenericTreeItem(this, { label: 'Open Logs', contextValue: 'openLogs', commandId: 'containerApps.openInPortal', iconPath, id: `${this.parent.id}/logs` }),
new GenericTreeItem(this, { label: 'Open Log Stream', contextValue: 'openLogStream', commandId: 'containerApps.openInPortal', iconPath, id: `${this.parent.id}/logstream` })
]
}

Expand Down
2 changes: 1 addition & 1 deletion src/tree/ResolvedContainerAppsResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class ResolvedContainerEnvironmentResource implements ResolvedAppResource
const proxyTree: ManagedEnvironmentTreeItem = this as unknown as ManagedEnvironmentTreeItem;
const containerApps = <ContainerAppTreeItem[]>(await proxyTree.loadAllChildren(context));

const deleteManagedEnvironment: string = localize('deleteManagedEnvironment', 'Delete Container Apps Environment "{0}"', proxyTree.name);
const deleteManagedEnvironment: string = localize('deleteManagedEnvironment', 'Delete Container Apps environment "{0}"', proxyTree.name);

const wizardContext: IDeleteManagedEnvironmentWizardContext = {
activityTitle: deleteManagedEnvironment,
Expand Down

0 comments on commit fa14742

Please sign in to comment.