diff --git a/src/commands/deployWorkspaceProject/deploymentConfiguration/workspace/filePaths/EnvUseRemoteConfigurationPromptStep.ts b/src/commands/deployWorkspaceProject/deploymentConfiguration/workspace/filePaths/EnvUseRemoteConfigurationPromptStep.ts index d9d36877b..f6d94074a 100644 --- a/src/commands/deployWorkspaceProject/deploymentConfiguration/workspace/filePaths/EnvUseRemoteConfigurationPromptStep.ts +++ b/src/commands/deployWorkspaceProject/deploymentConfiguration/workspace/filePaths/EnvUseRemoteConfigurationPromptStep.ts @@ -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"; diff --git a/src/commands/editContainer/RegistryAndSecretsUpdateStep.ts b/src/commands/editContainer/RegistryAndSecretsUpdateStep.ts index bffa31f2a..1743692fc 100644 --- a/src/commands/editContainer/RegistryAndSecretsUpdateStep.ts +++ b/src/commands/editContainer/RegistryAndSecretsUpdateStep.ts @@ -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"; diff --git a/src/commands/image/imageSource/ContainerAppUpdateStep.ts b/src/commands/image/imageSource/ContainerAppUpdateStep.ts index c8552878b..d997f1155 100644 --- a/src/commands/image/imageSource/ContainerAppUpdateStep.ts +++ b/src/commands/image/imageSource/ContainerAppUpdateStep.ts @@ -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"; diff --git a/src/commands/image/imageSource/buildImageInAzure/RunStep.ts b/src/commands/image/imageSource/buildImageInAzure/RunStep.ts index a6f46dfbe..6b8c04d21 100644 --- a/src/commands/image/imageSource/buildImageInAzure/RunStep.ts +++ b/src/commands/image/imageSource/buildImageInAzure/RunStep.ts @@ -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"; diff --git a/src/commands/image/imageSource/containerRegistry/acr/AcrTagListStep.ts b/src/commands/image/imageSource/containerRegistry/acr/AcrTagListStep.ts index d4359c2c2..9654f26b7 100644 --- a/src/commands/image/imageSource/containerRegistry/acr/AcrTagListStep.ts +++ b/src/commands/image/imageSource/containerRegistry/acr/AcrTagListStep.ts @@ -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"; @@ -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() }; } }); } } diff --git a/src/commands/logStream/ReplicaListStep.ts b/src/commands/logStream/ReplicaListStep.ts index 0f4e354bd..367bf117a 100644 --- a/src/commands/logStream/ReplicaListStep.ts +++ b/src/commands/logStream/ReplicaListStep.ts @@ -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"; diff --git a/src/commands/logStream/RevisionListStep.ts b/src/commands/logStream/RevisionListStep.ts index c66399355..8a348c8e2 100644 --- a/src/commands/logStream/RevisionListStep.ts +++ b/src/commands/logStream/RevisionListStep.ts @@ -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"; diff --git a/src/commands/revisionDraft/RevisionDraftFileSystem.ts b/src/commands/revisionDraft/RevisionDraftFileSystem.ts index bb6f13e01..fde9d5fa8 100644 --- a/src/commands/revisionDraft/RevisionDraftFileSystem.ts +++ b/src/commands/revisionDraft/RevisionDraftFileSystem.ts @@ -52,9 +52,9 @@ export class RevisionDraftFileSystem implements FileSystemProvider { private readonly emitter: EventEmitter = new EventEmitter(); private readonly bufferedEvents: FileChangeEvent[] = []; - private fireSoonHandle?: NodeJS.Timer; + private fireSoonHandle?: NodeJS.Timeout; - private draftStore: Map = new Map(); + private draftStore = new Map(); get onDidChangeFile(): Event { return this.emitter.event; diff --git a/src/commands/revisionDraft/createRevisionDraft.ts b/src/commands/revisionDraft/createRevisionDraft.ts index d40fd009c..81dd72c0c 100644 --- a/src/commands/revisionDraft/createRevisionDraft.ts +++ b/src/commands/revisionDraft/createRevisionDraft.ts @@ -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"; diff --git a/src/tree/ContainerAppItem.ts b/src/tree/ContainerAppItem.ts index 96b71da9d..59b31ba60 100644 --- a/src/tree/ContainerAppItem.ts +++ b/src/tree/ContainerAppItem.ts @@ -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"; @@ -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; @@ -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]; @@ -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 { @@ -153,7 +152,7 @@ export class ContainerAppItem implements ContainerAppsItem, RevisionsDraftModel resourceGroup: getResourceGroupFromId(nonNullProp(containerApp, 'id')), revisionsMode, ...containerApp, - } + }; } async delete(context: IActionContext & { suppressPrompt?: boolean }): Promise { @@ -169,7 +168,7 @@ export class ContainerAppItem implements ContainerAppsItem, RevisionsDraftModel ...await createActivityContext() }; - const wizard: AzureWizard = new AzureWizard(wizardContext, { + const wizard = new AzureWizard(wizardContext, { promptSteps: [new DeleteConfirmationStep(confirmMessage)], executeSteps: [new DeleteAllContainerAppsStep()] }); diff --git a/src/tree/ContainerAppsBranchDataProvider.ts b/src/tree/ContainerAppsBranchDataProvider.ts index 8145ccb71..f2e5374d4 100644 --- a/src/tree/ContainerAppsBranchDataProvider.ts +++ b/src/tree/ContainerAppsBranchDataProvider.ts @@ -39,7 +39,7 @@ export class ContainerAppsBranchDataProvider extends vscode.Disposable implement async getChildren(element: TreeElementBase): Promise { 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; }); diff --git a/src/tree/LogsGroupItem.ts b/src/tree/LogsGroupItem.ts index 7825c2f1b..dbcb74678 100644 --- a/src/tree/LogsGroupItem.ts +++ b/src/tree/LogsGroupItem.ts @@ -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 { diff --git a/src/tree/ManagedEnvironmentItem.ts b/src/tree/ManagedEnvironmentItem.ts index 224a299ef..19ba5ae6a 100644 --- a/src/tree/ManagedEnvironmentItem.ts +++ b/src/tree/ManagedEnvironmentItem.ts @@ -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 { @@ -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 { @@ -106,5 +106,5 @@ function createAzureResourceModel(resource: T): T & Resource name: nonNullProp(resource, 'name'), resourceGroup: getResourceGroupFromId(id), ...resource, - } + }; } diff --git a/src/tree/configurations/ConfigurationItem.ts b/src/tree/configurations/ConfigurationItem.ts index b76072dcb..dfb62739b 100644 --- a/src/tree/configurations/ConfigurationItem.ts +++ b/src/tree/configurations/ConfigurationItem.ts @@ -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 { @@ -52,6 +51,6 @@ export class ConfigurationItem implements ContainerAppsItem { iconPath: new ThemeIcon('gear'), contextValue: ConfigurationItem.contextValue, collapsibleState: TreeItemCollapsibleState.Collapsed - } + }; } } diff --git a/src/tree/configurations/DaprItem.ts b/src/tree/configurations/DaprItem.ts index c7fd2b10b..9f4c6bb9b 100644 --- a/src/tree/configurations/DaprItem.ts +++ b/src/tree/configurations/DaprItem.ts @@ -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 { @@ -41,7 +42,7 @@ export class DaprEnabledItem implements TreeElementBase { dark: treeUtils.getIconPath('dapr-dark'), }, collapsibleState: TreeItemCollapsibleState.Collapsed, - } + }; } async getChildren(): Promise { @@ -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) { diff --git a/src/tree/configurations/IngressItem.ts b/src/tree/configurations/IngressItem.ts index 9d3d955c8..4334d2b5f 100644 --- a/src/tree/configurations/IngressItem.ts +++ b/src/tree/configurations/IngressItem.ts @@ -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 { @@ -81,7 +82,7 @@ export class IngressDisabledItem implements TreeElementBase { description: localize('disabled', 'Disabled'), contextValue: IngressDisabledItem.contextValue, iconPath: new ThemeIcon('debug-disconnect'), - } + }; } } diff --git a/src/tree/configurations/secrets/SecretItem.ts b/src/tree/configurations/secrets/SecretItem.ts index 0d692374a..973fe47e9 100644 --- a/src/tree/configurations/secrets/SecretItem.ts +++ b/src/tree/configurations/secrets/SecretItem.ts @@ -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 { diff --git a/src/tree/configurations/secrets/SecretsItem.ts b/src/tree/configurations/secrets/SecretsItem.ts index b5f9a77c5..c97d0c1be 100644 --- a/src/tree/configurations/secrets/SecretsItem.ts +++ b/src/tree/configurations/secrets/SecretsItem.ts @@ -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 { diff --git a/src/tree/containers/ContainerItem.ts b/src/tree/containers/ContainerItem.ts index c836ef18b..98b9b1513 100644 --- a/src/tree/containers/ContainerItem.ts +++ b/src/tree/containers/ContainerItem.ts @@ -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"; @@ -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); @@ -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 { @@ -41,7 +46,7 @@ export class ContainerItem extends RevisionDraftDescendantBase { label: this.label, contextValue: ContainerItem.contextValue, collapsibleState: TreeItemCollapsibleState.Collapsed, - } + }; } getChildren(): TreeElementBase[] { @@ -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 ?? ''; } diff --git a/src/tree/containers/ContainersItem.ts b/src/tree/containers/ContainersItem.ts index dc76977a5..8c3813521 100644 --- a/src/tree/containers/ContainersItem.ts +++ b/src/tree/containers/ContainersItem.ts @@ -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"; @@ -58,7 +58,7 @@ export class ContainersItem extends RevisionDraftDescendantBase { iconPath: treeUtils.getIconPath('containers'), contextValue: this.contextValue, collapsibleState: TreeItemCollapsibleState.Collapsed - } + }; } private get contextValue(): string { @@ -82,9 +82,9 @@ export class ContainersItem extends RevisionDraftDescendantBase { viewProperties: ViewPropertiesModel = { label: 'Containers', getData: async () => { - return this.containers.length === 1 ? this.containers[0] : JSON.stringify(this.containers) + return this.containers.length === 1 ? this.containers[0] : JSON.stringify(this.containers); } - } + }; static isContainersItem(item: unknown): item is ContainersItem { return typeof item === 'object' && diff --git a/src/tree/containers/EnvironmentVariableItem.ts b/src/tree/containers/EnvironmentVariableItem.ts index 719b73316..0089b3420 100644 --- a/src/tree/containers/EnvironmentVariableItem.ts +++ b/src/tree/containers/EnvironmentVariableItem.ts @@ -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"; @@ -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 @@ -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 { @@ -51,7 +52,7 @@ export class EnvironmentVariableItem extends RevisionDraftDescendantBase { title: localize('commandtitle', 'Toggle Environment Variable Visibility'), arguments: [this, this.hideValue,] } - } + }; } public async toggleValueVisibility(_: IActionContext): Promise { diff --git a/src/tree/containers/EnvironmentVariablesItem.ts b/src/tree/containers/EnvironmentVariablesItem.ts index e591de771..3d4581d72 100644 --- a/src/tree/containers/EnvironmentVariablesItem.ts +++ b/src/tree/containers/EnvironmentVariablesItem.ts @@ -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"; @@ -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, @@ -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, @@ -43,7 +43,7 @@ export class EnvironmentVariablesItem extends RevisionDraftDescendantBase { iconPath: new ThemeIcon('settings'), contextValue: EnvironmentVariablesItem.contextValue, collapsibleState: TreeItemCollapsibleState.Collapsed - } + }; } getChildren(): TreeElementBase[] { diff --git a/src/tree/containers/ImageItem.ts b/src/tree/containers/ImageItem.ts index a057dd531..55e63da59 100644 --- a/src/tree/containers/ImageItem.ts +++ b/src/tree/containers/ImageItem.ts @@ -5,7 +5,7 @@ import { KnownActiveRevisionsMode, type Container, type Revision } from "@azure/arm-appcontainers"; import { createGenericElement, nonNullValue, nonNullValueAndProp, type TreeElementBase } from "@microsoft/vscode-azext-utils"; -import { type AzureSubscription, type ViewPropertiesModel } from "@microsoft/vscode-azureresources-api"; +import { ViewPropertiesModel, type AzureSubscription } from "@microsoft/vscode-azureresources-api"; import { ThemeIcon, TreeItemCollapsibleState, type TreeItem } from "vscode"; import { localize } from "../../utils/localize"; import { getParentResource } from "../../utils/revisionDraftUtils"; @@ -16,6 +16,9 @@ import { RevisionDraftItem } from "../revisionManagement/RevisionDraftItem"; export class ImageItem extends RevisionDraftDescendantBase { static readonly contextValue: string = 'imageItem'; static readonly contextValueRegExp: RegExp = new RegExp(ImageItem.contextValue); + id: string; + label: string; + viewProperties: ViewPropertiesModel; constructor( subscription: AzureSubscription, @@ -27,19 +30,16 @@ export class ImageItem extends RevisionDraftDescendantBase { readonly container: Container, ) { super(subscription, containerApp, revision); - } - - id: string = `${this.parentResource.id}/image/${this.container.image}`; - label: string; - - viewProperties: ViewPropertiesModel = { - data: nonNullValueAndProp(this.container, 'image'), - label: this.container.name ?? '', + this.id = `${this.parentResource.id}/image/${container.image}`; + this.viewProperties = { + data: nonNullValueAndProp(container, 'image'), + label: this.container.name ?? '', + }; } private getImageName(image?: string): string { const loginServer: string = this.getLoginServer(image); - if (!loginServer) return ''; + if (!loginServer) { return ''; } return image?.substring(nonNullValue(loginServer.length) + 1, image?.length) ?? ''; } @@ -55,7 +55,7 @@ export class ImageItem extends RevisionDraftDescendantBase { iconPath: new ThemeIcon('window'), contextValue: ImageItem.contextValue, collapsibleState: TreeItemCollapsibleState.Collapsed, - } + }; } async getChildren(): Promise { diff --git a/src/tree/revisionManagement/RevisionDraftItem.ts b/src/tree/revisionManagement/RevisionDraftItem.ts index 9214a6726..c732c3481 100644 --- a/src/tree/revisionManagement/RevisionDraftItem.ts +++ b/src/tree/revisionManagement/RevisionDraftItem.ts @@ -7,7 +7,7 @@ import { type ContainerAppsAPIClient, type KnownActiveRevisionsMode, type Revisi import { uiUtils } from "@microsoft/vscode-azext-azureutils"; import { callWithTelemetryAndErrorHandling, createContextValue, createSubscriptionContext, nonNullProp, type IActionContext, 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 { TreeItemCollapsibleState, type TreeItem } from "vscode"; import { unsavedChangesFalseContextValue, unsavedChangesTrueContextValue } from "../../constants"; import { ext } from "../../extensionVariables"; diff --git a/src/tree/revisionManagement/RevisionItem.ts b/src/tree/revisionManagement/RevisionItem.ts index 712b3fae9..c51898358 100644 --- a/src/tree/revisionManagement/RevisionItem.ts +++ b/src/tree/revisionManagement/RevisionItem.ts @@ -26,13 +26,17 @@ const revisionStateInactiveContextValue: string = 'revisionState:inactive'; export class RevisionItem implements RevisionsItemModel { static readonly contextValue: string = 'revisionItem'; static readonly contextValueRegExp: RegExp = new RegExp(RevisionItem.contextValue); - + viewProperties: ViewPropertiesModel; id: string; revisionsMode: KnownActiveRevisionsMode; constructor(readonly subscription: AzureSubscription, readonly containerApp: ContainerAppModel, readonly revision: Revision) { this.id = nonNullProp(this.revision, 'id'); this.revisionsMode = containerApp.revisionsMode; + this.viewProperties = { + data: revision, + label: nonNullProp(revision, 'name'), + }; } private get contextValue(): string { @@ -61,11 +65,6 @@ export class RevisionItem implements RevisionsItemModel { } } - viewProperties: ViewPropertiesModel = { - data: this.revision, - label: nonNullProp(this.revision, 'name'), - }; - static getTemplateChildren(subscription: AzureSubscription, containerApp: ContainerAppModel, revision: Revision): TreeElementBase[] { return [ RevisionDraftDescendantBase.createTreeItem(ContainersItem, subscription, containerApp, revision), @@ -107,7 +106,7 @@ export class RevisionItem implements RevisionsItemModel { colorId = 'testing.iconFailed'; break; case KnownRevisionProvisioningState.Provisioned: - id = 'pass' + id = 'pass'; colorId = 'testing.iconPassed'; break; case KnownRevisionProvisioningState.Deprovisioned: diff --git a/src/tree/scaling/ScaleItem.ts b/src/tree/scaling/ScaleItem.ts index 5be12f13a..973458dda 100644 --- a/src/tree/scaling/ScaleItem.ts +++ b/src/tree/scaling/ScaleItem.ts @@ -6,7 +6,7 @@ import { KnownActiveRevisionsMode, type Revision, type Scale } from "@azure/arm-appcontainers"; import { createGenericElement, nonNullValueAndProp } 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 { ThemeIcon, TreeItemCollapsibleState, type TreeItem } from "vscode"; import { ext } from "../../extensionVariables"; import { localize } from "../../utils/localize"; diff --git a/src/tree/scaling/ScaleRuleGroupItem.ts b/src/tree/scaling/ScaleRuleGroupItem.ts index eee249544..9b1af6e99 100644 --- a/src/tree/scaling/ScaleRuleGroupItem.ts +++ b/src/tree/scaling/ScaleRuleGroupItem.ts @@ -6,7 +6,7 @@ import { KnownActiveRevisionsMode, type Revision, type ScaleRule } from "@azure/arm-appcontainers"; import { 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 { ThemeIcon, TreeItemCollapsibleState, type TreeItem } from "vscode"; import { ext } from "../../extensionVariables"; import { localize } from "../../utils/localize"; diff --git a/src/tree/scaling/ScaleRuleItem.ts b/src/tree/scaling/ScaleRuleItem.ts index 65cb6086f..4d8ea2d6c 100644 --- a/src/tree/scaling/ScaleRuleItem.ts +++ b/src/tree/scaling/ScaleRuleItem.ts @@ -5,7 +5,7 @@ import { KnownActiveRevisionsMode, type Revision, type ScaleRule } from "@azure/arm-appcontainers"; import { type AzureSubscription, type ViewPropertiesModel } from "@microsoft/vscode-azureresources-api"; -import * as deepEqual from "deep-eql"; +import deepEqual from "deep-eql"; import { ThemeIcon, type TreeItem } from "vscode"; import { localize } from "../../utils/localize"; import { getParentResource } from "../../utils/revisionDraftUtils"; @@ -18,6 +18,9 @@ const scaleRuleLabel: string = localize('scaleRule', 'Scale Rule'); export class ScaleRuleItem extends RevisionDraftDescendantBase { static readonly contextValue: string = 'scaleRuleItem'; static readonly contextValueRegExp: RegExp = new RegExp(ScaleRuleItem.contextValue); + id: string; + label: string; + viewProperties: ViewPropertiesModel; constructor( subscription: AzureSubscription, @@ -29,16 +32,13 @@ export class ScaleRuleItem extends RevisionDraftDescendantBase { readonly isDraft: boolean ) { super(subscription, containerApp, revision); + this.id = `${this.parentResource.id}/scalerules/${scaleRule.name}`; + this.viewProperties = { + data: this.scaleRule, + label: `${this.parentResource.name} ${scaleRuleLabel} ${this.scaleRule.name}`, + }; } - id: string = `${this.parentResource.id}/scalerules/${this.scaleRule.name}`; - label: string; - - viewProperties: ViewPropertiesModel = { - data: this.scaleRule, - label: `${this.parentResource.name} ${scaleRuleLabel} ${this.scaleRule.name}`, - }; - private get description(): string { if (this.scaleRule.http) { return localize('http', "HTTP"); @@ -70,7 +70,7 @@ export class ScaleRuleItem extends RevisionDraftDescendantBase { contextValue: ScaleRuleItem.contextValue, iconPath: new ThemeIcon('dash'), description: this.description - } + }; } hasUnsavedChanges(): boolean {