Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { type EnvironmentVar } from "@azure/arm-appcontainers";
import { ActivityChildItem, ActivityChildType, activityInfoContext, activityInfoIcon, AzureWizardPromptStep, createContextValue, nonNullProp, nonNullValueAndProp, type IAzureQuickPickItem } from "@microsoft/vscode-azext-utils";
import * as deepEqual from "deep-eql";
import deepEqual from "deep-eql";
import * as path from "path";
import { ext } from "../../../../../extensionVariables";
import { localize } from "../../../../../utils/localize";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { type RegistryCredentials, type Secret } from "@azure/arm-appcontainers";
import { AzureWizardExecuteStepWithActivityOutput, nonNullProp } from "@microsoft/vscode-azext-utils";
import * as deepEqual from "deep-eql";
import deepEqual from "deep-eql";
import { type Progress } from "vscode";
import { ext } from "../../extensionVariables";
import { getContainerEnvelopeWithSecrets, type ContainerAppModel } from "../../tree/ContainerAppItem";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/image/imageSource/ContainerAppUpdateStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { type Container, type Ingress } from "@azure/arm-appcontainers";
import { AzureWizardExecuteStepWithActivityOutput, nonNullProp, type AzureWizardExecuteStep } from "@microsoft/vscode-azext-utils";
import * as retry from "p-retry";
import retry from "p-retry";
import { type Progress } from "vscode";
import { ext } from "../../../extensionVariables";
import { getContainerEnvelopeWithSecrets, type ContainerAppModel } from "../../../tree/ContainerAppItem";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { type DockerBuildRequest as AcrDockerBuildRequest } from "@azure/arm-containerregistry";
import { ActivityChildItem, ActivityChildType, AzExtFsExtra, AzureWizardExecuteStep, activityFailContext, activityFailIcon, activityProgressContext, activityProgressIcon, createContextValue, type ExecuteActivityOutput } from "@microsoft/vscode-azext-utils";
import * as retry from 'p-retry';
import retry from 'p-retry';
import * as path from 'path';
import { TreeItemCollapsibleState, type Progress } from "vscode";
import { ext } from "../../../../extensionVariables";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import { type ArtifactManifestProperties } from "@azure/container-registry";
import { uiUtils } from "@microsoft/vscode-azext-azureutils";
import { nonNullProp, nonNullValue } from "@microsoft/vscode-azext-utils";
import * as dayjs from 'dayjs';
import * as relativeTime from 'dayjs/plugin/relativeTime';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import { type QuickPickItem } from "vscode";
import { createContainerRegistryClient } from "../../../../../utils/azureClients";
import { type ContainerRegistryImageSourceContext } from "../ContainerRegistryImageSourceContext";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/logStream/ReplicaListStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { type ContainerAppsAPIClient, type Replica } from "@azure/arm-appcontainers";
import { AzureWizardPromptStep, createSubscriptionContext, nonNullProp, nonNullValue, type IAzureQuickPickItem } from "@microsoft/vscode-azext-utils";
import * as dayjs from 'dayjs';
import dayjs from 'dayjs';
import { createContainerAppsAPIClient } from "../../utils/azureClients";
import { localize } from "../../utils/localize";
import { type IStreamLogsContext } from "./IStreamLogsContext";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/logStream/RevisionListStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { type ContainerAppsAPIClient, type Revision } from "@azure/arm-appcontainers";
import { uiUtils } from "@microsoft/vscode-azext-azureutils";
import { AzureWizardPromptStep, createSubscriptionContext, nonNullProp, type IAzureQuickPickItem } from "@microsoft/vscode-azext-utils";
import * as dayjs from 'dayjs';
import dayjs from 'dayjs';
import { createContainerAppsAPIClient } from "../../utils/azureClients";
import { localize } from "../../utils/localize";
import { type IStreamLogsContext } from "./IStreamLogsContext";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/revisionDraft/RevisionDraftFileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class RevisionDraftFileSystem implements FileSystemProvider {

private readonly emitter: EventEmitter<FileChangeEvent[]> = new EventEmitter<FileChangeEvent[]>();
private readonly bufferedEvents: FileChangeEvent[] = [];
private fireSoonHandle?: NodeJS.Timer;
private fireSoonHandle?: NodeJS.Timeout;

private draftStore = new Map<string, RevisionDraftFile>();

Expand Down
4 changes: 2 additions & 2 deletions src/commands/revisionDraft/createRevisionDraft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import { KnownActiveRevisionsMode, type ContainerAppsAPIClient, type Revision } from "@azure/arm-appcontainers";
import { uiUtils } from "@microsoft/vscode-azext-azureutils";
import { createSubscriptionContext, nonNullProp, nonNullValueAndProp, type IActionContext, type IAzureQuickPickItem } from "@microsoft/vscode-azext-utils";
import * as dayjs from "dayjs";
import * as relativeTime from 'dayjs/plugin/relativeTime';
import dayjs from "dayjs";
import relativeTime from 'dayjs/plugin/relativeTime';
import { ext } from "../../extensionVariables";
import { type RevisionItem } from "../../tree/revisionManagement/RevisionItem";
import { type RevisionsItem } from "../../tree/revisionManagement/RevisionsItem";
Expand Down
17 changes: 8 additions & 9 deletions src/tree/ContainerAppItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { KnownActiveRevisionsMode, type ContainerApp, type ContainerAppsAPIClien
import { getResourceGroupFromId, uiUtils } from "@microsoft/vscode-azext-azureutils";
import { AzureWizard, DeleteConfirmationStep, callWithTelemetryAndErrorHandling, createContextValue, createSubscriptionContext, nonNullProp, nonNullValue, nonNullValueAndProp, type IActionContext } from "@microsoft/vscode-azext-utils";
import { type AzureSubscription, type ViewPropertiesModel } from "@microsoft/vscode-azureresources-api";
import * as deepEqual from "deep-eql";
import deepEqual from "deep-eql";
import { TreeItemCollapsibleState, type TreeItem, type Uri } from "vscode";
import { DeleteAllContainerAppsStep } from "../commands/deleteContainerApp/DeleteAllContainerAppsStep";
import { type IDeleteContainerAppWizardContext } from "../commands/deleteContainerApp/IDeleteContainerAppWizardContext";
Expand Down Expand Up @@ -36,8 +36,9 @@ export interface ContainerAppModel extends ContainerApp {
export class ContainerAppItem implements ContainerAppsItem, RevisionsDraftModel {
static readonly contextValue: string = 'containerAppItem';
static readonly contextValueRegExp: RegExp = new RegExp(ContainerAppItem.contextValue);

portalUrl: Uri;
id: string;
viewProperties: ViewPropertiesModel;

private resourceGroup: string;
private name: string;
Expand All @@ -50,15 +51,13 @@ export class ContainerAppItem implements ContainerAppsItem, RevisionsDraftModel
this.id = this.containerApp.id;
this.resourceGroup = this.containerApp.resourceGroup;
this.name = this.containerApp.name;
this.portalUrl = createPortalUrl(subscription, _containerApp.id);
this.viewProperties = {
data: this.containerApp,
label: this.containerApp.name,
};
}

viewProperties: ViewPropertiesModel = {
data: this.containerApp,
label: this.containerApp.name,
};

portalUrl: Uri = createPortalUrl(this.subscription, this.containerApp.id);

private get contextValue(): string {
const values: string[] = [ContainerAppItem.contextValue];

Expand Down
7 changes: 4 additions & 3 deletions src/tree/LogsGroupItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ const logsItemContextValue: string = 'logsItem';
export class LogsGroupItem implements TreeElementBase {
static readonly contextValue: string = 'logsGroupItem';
static readonly contextValueRegExp: RegExp = new RegExp(LogsGroupItem.contextValue);
id: string;

constructor(private readonly subscription: AzureSubscription, private readonly containerApp: ContainerApp) { }

id: string = `${this.containerApp.id}/Logs`;
constructor(private readonly subscription: AzureSubscription, private readonly containerApp: ContainerApp) {
this.id = `${containerApp.id}/Logs`;
}

getTreeItem(): TreeItem {
return {
Expand Down
12 changes: 6 additions & 6 deletions src/tree/ManagedEnvironmentItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ type ManagedEnvironmentModel = ManagedEnvironment & ResourceModel;
export class ManagedEnvironmentItem implements TreeElementBase {
static readonly contextValue: string = 'managedEnvironmentItem';
static readonly contextValueRegExp: RegExp = new RegExp(ManagedEnvironmentItem.contextValue);

viewProperties: ViewPropertiesModel;
id: string;


constructor(public readonly subscription: AzureSubscription, public readonly resource: AzureResource, public readonly managedEnvironment: ManagedEnvironmentModel) {
this.id = managedEnvironment.id;
this.viewProperties = {
data: managedEnvironment,
label: managedEnvironment.name,
};
}

viewProperties: ViewPropertiesModel = {
data: this.managedEnvironment,
label: this.managedEnvironment.name,
};

private get contextValue(): string {
const values: string[] = [];

Expand Down
11 changes: 5 additions & 6 deletions src/tree/configurations/ConfigurationItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,18 @@ const configuration: string = localize('configuration', 'Configuration');
export class ConfigurationItem implements ContainerAppsItem {
static readonly contextValue: string = 'configurationItem';
static readonly contextValueRegExp: RegExp = new RegExp(ConfigurationItem.contextValue);

readonly viewProperties: ViewPropertiesModel;
id: string;

// this is called "Settings" in the Portal
constructor(public readonly subscription: AzureSubscription, public readonly containerApp: ContainerAppModel) {
this.id = `${containerApp.id}/Configurations`;
this.viewProperties = {
data: nonNullProp(containerApp, 'configuration'),
label: `${containerApp.name} ${configuration}`,
};
}

viewProperties: ViewPropertiesModel = {
data: nonNullProp(this.containerApp, 'configuration'),
label: `${this.containerApp.name} ${configuration}`,
};

async getChildren(): Promise<TreeElementBase[]> {
const result = await callWithTelemetryAndErrorHandling('getChildren', async (_context) => {
const children: TreeElementBase[] = [];
Expand Down
17 changes: 9 additions & 8 deletions src/tree/configurations/DaprItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ const daprAppProtocolItemContextValue: string = 'daprAppProtocolItem';
export class DaprEnabledItem implements TreeElementBase {
static readonly contextValue: string = 'daprEnabledItem';
static readonly contextValueRegExp: RegExp = new RegExp(DaprEnabledItem.contextValue);
readonly viewProperties: ViewPropertiesModel;
id: string;

constructor(private readonly containerApp: ContainerAppModel, private readonly dapr: Dapr) { }

id: string = `${this.containerApp.id}/DaprEnabled`;

viewProperties: ViewPropertiesModel = {
data: this.dapr,
label: localize('daprProperties', '{0} Dapr', this.containerApp.name),
};
constructor(containerApp: ContainerAppModel, private readonly dapr: Dapr) {
this.id = `${containerApp.id}/DaprEnabled`;
this.viewProperties = {
data: this.dapr,
label: localize('daprProperties', '{0} Dapr', containerApp.name),
};
}

getTreeItem(): TreeItem {
return {
Expand Down
23 changes: 12 additions & 11 deletions src/tree/configurations/IngressItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@ const visibilityItemContextValue: string = 'visibilityItem';
export class IngressEnabledItem implements ContainerAppsItem {
static readonly contextValue: string = 'ingressEnabledItem';
static readonly contextValueRegExp: RegExp = new RegExp(IngressEnabledItem.contextValue);

constructor(readonly subscription: AzureSubscription, readonly containerApp: ContainerAppModel) { }

id: string = `${this.containerApp.id}/ingress`;

ingress: Ingress = this.containerApp.configuration?.ingress ?? {};

viewProperties: ViewPropertiesModel = {
data: this.ingress,
label: `${this.containerApp.name} ${label}`,
};
readonly viewProperties: ViewPropertiesModel;
id: string;
ingress: Ingress;

constructor(readonly subscription: AzureSubscription, readonly containerApp: ContainerAppModel) {
this.id = `${containerApp.id}/ingress`;
this.ingress = containerApp.configuration?.ingress ?? {};
this.viewProperties = {
data: this.ingress,
label: `${containerApp.name} ${label}`,
};
}

getTreeItem(): TreeItem {
return {
Expand Down
7 changes: 4 additions & 3 deletions src/tree/configurations/secrets/SecretItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ import { SecretsItem } from "./SecretsItem";
export class SecretItem implements ContainerAppsItem {
static readonly contextValue: string = 'secretItem';
static readonly contextValueRegExp: RegExp = new RegExp(SecretItem.contextValue);
id: string;

constructor(readonly subscription: AzureSubscription, readonly containerApp: ContainerAppModel, readonly secretName: string) { }

id: string = `${this.containerApp.id}/${SecretsItem.idSuffix}/${this.secretName}`;
constructor(readonly subscription: AzureSubscription, readonly containerApp: ContainerAppModel, readonly secretName: string) {
this.id = `${containerApp.id}/${SecretsItem.idSuffix}/${secretName}`;
}

getTreeItem(): TreeItem {
return {
Expand Down
19 changes: 10 additions & 9 deletions src/tree/configurations/secrets/SecretsItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ export class SecretsItem implements ContainerAppsItem {
static readonly idSuffix: string = 'secrets';
static readonly contextValue: string = 'secretsItem';
static readonly contextValueRegExp: RegExp = new RegExp(SecretsItem.contextValue);

constructor(readonly subscription: AzureSubscription, readonly containerApp: ContainerAppModel) { }

id: string = `${this.containerApp.id}/${SecretsItem.idSuffix}`;

viewProperties: ViewPropertiesModel = {
data: this.containerApp.configuration?.secrets ?? [],
label: `${this.containerApp.name} ${secrets}`,
};
id: string;
viewProperties: ViewPropertiesModel;

constructor(readonly subscription: AzureSubscription, readonly containerApp: ContainerAppModel) {
this.id = `${containerApp.id}/${SecretsItem.idSuffix}`;
this.viewProperties = {
data: containerApp.configuration?.secrets ?? [],
label: `${containerApp.name} ${secrets}`,
};
}

async getChildren(): Promise<TreeElementBase[]> {
const secrets: Secret[] = this.containerApp.configuration?.secrets ?? [];
Expand Down
12 changes: 6 additions & 6 deletions src/tree/containers/ContainerItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { KnownActiveRevisionsMode, type Container, type Revision } from "@azure/arm-appcontainers";
import { nonNullProp, type TreeElementBase } from "@microsoft/vscode-azext-utils";
import { type AzureSubscription, type ViewPropertiesModel } from "@microsoft/vscode-azureresources-api";
import * as deepEqual from "deep-eql";
import deepEqual from "deep-eql";
import { TreeItemCollapsibleState, type TreeItem } from "vscode";
import { getParentResource } from "../../utils/revisionDraftUtils";
import { type ContainerAppModel } from "../ContainerAppItem";
Expand All @@ -18,6 +18,7 @@ import { ImageItem } from "./ImageItem";
export class ContainerItem extends RevisionDraftDescendantBase {
id: string;
label: string;
viewProperties: ViewPropertiesModel;

static readonly contextValue: string = 'containerItem';
static readonly contextValueRegExp: RegExp = new RegExp(ContainerItem.contextValue);
Expand All @@ -33,6 +34,10 @@ export class ContainerItem extends RevisionDraftDescendantBase {
) {
super(subscription, containerApp, revision);
this.id = `${this.parentResource.id}/${container.name}`;
this.viewProperties = {
data: this.container,
label: nonNullProp(this.container, 'name'),
};
}

getTreeItem(): TreeItem {
Expand All @@ -55,11 +60,6 @@ export class ContainerItem extends RevisionDraftDescendantBase {
return getParentResource(this.containerApp, this.revision);
}

viewProperties: ViewPropertiesModel = {
data: this.container,
label: nonNullProp(this.container, 'name'),
};

protected setProperties(): void {
this.label = this.container.name ?? '';
}
Expand Down
2 changes: 1 addition & 1 deletion src/tree/containers/ContainersItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { KnownActiveRevisionsMode, type Container, type Revision } from "@azure/arm-appcontainers";
import { nonNullValueAndProp, type TreeElementBase } from "@microsoft/vscode-azext-utils";
import { type AzureSubscription, type ViewPropertiesModel } from "@microsoft/vscode-azureresources-api";
import * as deepEqual from 'deep-eql';
import deepEqual from 'deep-eql';
import { TreeItemCollapsibleState, type TreeItem } from "vscode";
import { ext } from "../../extensionVariables";
import { localize } from "../../utils/localize";
Expand Down
5 changes: 3 additions & 2 deletions src/tree/containers/EnvironmentVariableItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { KnownActiveRevisionsMode, type Container, type EnvironmentVar, type Revision } from "@azure/arm-appcontainers";
import { type IActionContext } from "@microsoft/vscode-azext-utils";
import { type AzureSubscription } from "@microsoft/vscode-azureresources-api";
import * as deepEqual from "deep-eql";
import deepEqual from "deep-eql";
import { ThemeIcon, type TreeItem } from "vscode";
import { ext } from "../../extensionVariables";
import { localize } from "../../utils/localize";
Expand All @@ -21,7 +21,7 @@ export class EnvironmentVariableItem extends RevisionDraftDescendantBase {
static readonly contextValue: string = 'environmentVariableItem';
static readonly contextValueRegExp: RegExp = new RegExp(EnvironmentVariableItem.contextValue);

id: string = `${this.parentResource.id}/${this.container.image}/${this.envVariable.name}`;
id: string;

private hideValue: boolean = true;
private hiddenMessage: string; // Shown when 'hideValue' is true
Expand All @@ -38,6 +38,7 @@ export class EnvironmentVariableItem extends RevisionDraftDescendantBase {
readonly envVariable: EnvironmentVar,
) {
super(subscription, containerApp, revision);
this.id = `${this.parentResource.id}/${container.image}/${envVariable.name}`;
}

getTreeItem(): TreeItem {
Expand Down
8 changes: 4 additions & 4 deletions src/tree/containers/EnvironmentVariablesItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { KnownActiveRevisionsMode, type Container, type Revision } from "@azure/arm-appcontainers";
import { type TreeElementBase } from "@microsoft/vscode-azext-utils";
import { type AzureSubscription } from "@microsoft/vscode-azureresources-api";
import * as deepEqual from "deep-eql";
import deepEqual from "deep-eql";
import { ThemeIcon, TreeItemCollapsibleState, type TreeItem } from "vscode";
import { localize } from "../../utils/localize";
import { getParentResource } from "../../utils/revisionDraftUtils";
Expand All @@ -20,6 +20,8 @@ const environmentVariables: string = localize('environmentVariables', 'Environme
export class EnvironmentVariablesItem extends RevisionDraftDescendantBase {
static readonly contextValue: string = 'environmentVariablesItem';
static readonly contextValueRegExp: RegExp = new RegExp(EnvironmentVariablesItem.contextValue);
id: string;
label: string;

constructor(
subscription: AzureSubscription,
Expand All @@ -31,11 +33,9 @@ export class EnvironmentVariablesItem extends RevisionDraftDescendantBase {
readonly container: Container,
) {
super(subscription, containerApp, revision);
this.id = `${this.parentResource.id}/environmentVariables/${container.image}`;
}

id: string = `${this.parentResource.id}/environmentVariables/${this.container.image}`;
label: string;

getTreeItem(): TreeItem {
return {
id: this.id,
Expand Down
Loading