Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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,9 +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';
// eslint-disable-next-line import/no-internal-modules
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 All @@ -24,9 +23,9 @@ export class AcrTagListStep extends RepositoryTagListStepBase {
const manifests: ArtifactManifestProperties[] = await uiUtils.listAllIterator(repoClient.listManifestProperties());

const tags = manifests.reduce((allTags: { tag: string, date: Date }[], m) => {
const tagsWithDates = m.tags.map(t => { return { tag: t, date: m.lastUpdatedOn } });
const tagsWithDates = m.tags.map(t => { return { tag: t, date: m.lastUpdatedOn }; });
return allTags.concat(tagsWithDates);
}, []);
return tags.map((t) => { { return { label: t.tag, description: dayjs(t.date).fromNow() } } });
return tags.map((t) => { { return { label: t.tag, description: dayjs(t.date).fromNow() }; } });
}
}
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
4 changes: 2 additions & 2 deletions src/commands/revisionDraft/RevisionDraftFileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ 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: Map<string, RevisionDraftFile> = new Map();
private draftStore = new Map<string, RevisionDraftFile>();

get onDidChangeFile(): Event<FileChangeEvent[]> {
return this.emitter.event;
Expand Down
5 changes: 2 additions & 3 deletions src/commands/revisionDraft/createRevisionDraft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +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";
// eslint-disable-next-line import/no-internal-modules
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
23 changes: 11 additions & 12 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 Expand Up @@ -122,7 +121,7 @@ export class ContainerAppItem implements ContainerAppsItem, RevisionsDraftModel
contextValue: this.contextValue,
description: this.description,
collapsibleState: TreeItemCollapsibleState.Collapsed,
}
};
}

static isContainerAppItem(item: unknown): item is ContainerAppItem {
Expand Down Expand Up @@ -153,7 +152,7 @@ export class ContainerAppItem implements ContainerAppsItem, RevisionsDraftModel
resourceGroup: getResourceGroupFromId(nonNullProp(containerApp, 'id')),
revisionsMode,
...containerApp,
}
};
}

async delete(context: IActionContext & { suppressPrompt?: boolean }): Promise<void> {
Expand All @@ -169,7 +168,7 @@ export class ContainerAppItem implements ContainerAppsItem, RevisionsDraftModel
...await createActivityContext()
};

const wizard: AzureWizard<IDeleteContainerAppWizardContext> = new AzureWizard(wizardContext, {
const wizard = new AzureWizard<IDeleteContainerAppWizardContext>(wizardContext, {
promptSteps: [new DeleteConfirmationStep(confirmMessage)],
executeSteps: [new DeleteAllContainerAppsStep()]
});
Expand Down
2 changes: 1 addition & 1 deletion src/tree/ContainerAppsBranchDataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class ContainerAppsBranchDataProvider extends vscode.Disposable implement
async getChildren(element: TreeElementBase): Promise<TreeElementBase[] | null | undefined> {
return (await element.getChildren?.())?.map((child) => {
if (child.id) {
return ext.state.wrapItemInStateHandling(child as TreeElementBase & { id: string }, () => this.refresh(child))
return ext.state.wrapItemInStateHandling(child as TreeElementBase & { id: string }, () => this.refresh(child));
}
return child;
});
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
16 changes: 8 additions & 8 deletions src/tree/ManagedEnvironmentItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ 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;
}

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

private get contextValue(): string {
Expand Down Expand Up @@ -67,7 +67,7 @@ export class ManagedEnvironmentItem implements TreeElementBase {
iconPath: treeUtils.getIconPath('managed-environment'),
contextValue: this.contextValue,
collapsibleState: TreeItemCollapsibleState.Collapsed,
}
};
}

static isManagedEnvironmentItem(item: unknown): item is ManagedEnvironmentItem {
Expand Down Expand Up @@ -106,5 +106,5 @@ function createAzureResourceModel<T extends Resource>(resource: T): T & Resource
name: nonNullProp(resource, 'name'),
resourceGroup: getResourceGroupFromId(id),
...resource,
}
};
}
13 changes: 6 additions & 7 deletions src/tree/configurations/ConfigurationItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@ 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`;
}

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

async getChildren(): Promise<TreeElementBase[]> {
Expand All @@ -52,6 +51,6 @@ export class ConfigurationItem implements ContainerAppsItem {
iconPath: new ThemeIcon('gear'),
contextValue: ConfigurationItem.contextValue,
collapsibleState: TreeItemCollapsibleState.Collapsed
}
};
}
}
19 changes: 10 additions & 9 deletions src/tree/configurations/DaprItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ 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 {
Expand All @@ -41,7 +42,7 @@ export class DaprEnabledItem implements TreeElementBase {
dark: treeUtils.getIconPath('dapr-dark'),
},
collapsibleState: TreeItemCollapsibleState.Collapsed,
}
};
}

async getChildren(): Promise<TreeElementBase[]> {
Expand All @@ -62,7 +63,7 @@ export class DaprEnabledItem implements TreeElementBase {
description: 'app port',
iconPath: new ThemeIcon('dash'),
label: String(this.dapr.appPort),
}))
}));
}

if (this.dapr.appProtocol) {
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,16 +21,17 @@ 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 {
Expand Down Expand Up @@ -81,7 +82,7 @@ export class IngressDisabledItem implements TreeElementBase {
description: localize('disabled', 'Disabled'),
contextValue: IngressDisabledItem.contextValue,
iconPath: new ThemeIcon('debug-disconnect'),
}
};
}
}

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
17 changes: 9 additions & 8 deletions src/tree/configurations/secrets/SecretsItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ 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[]> {
Expand Down
Loading