diff --git a/src/commands/chooseRevisionMode.ts b/src/commands/chooseRevisionMode.ts index f79ce32f..2383f432 100644 --- a/src/commands/chooseRevisionMode.ts +++ b/src/commands/chooseRevisionMode.ts @@ -7,7 +7,7 @@ import { KnownActiveRevisionsMode } from "@azure/arm-appcontainers"; import { IActionContext, IAzureQuickPickItem } from "@microsoft/vscode-azext-utils"; import { ProgressLocation, window } from "vscode"; import { ext } from "../extensionVariables"; -import { ContainerAppModel, refreshContainerApp } from "../tree/ContainerAppItem"; +import { ContainerAppModel } from "../tree/ContainerAppItem"; import { ContainerAppsItem } from "../tree/ContainerAppsBranchDataProvider"; import { localize } from "../utils/localize"; import { pickContainerApp } from "../utils/pickContainerApp"; @@ -24,7 +24,7 @@ export async function chooseRevisionMode(context: IActionContext, node?: Contain await window.withProgress({ location: ProgressLocation.Notification, title: updating }, async (): Promise => { await updateContainerApp(context, subscription, containerApp, { configuration: { activeRevisionsMode: pickedRevisionMode } }); - refreshContainerApp(containerApp.id); + ext.state.notifyChildrenChanged(containerApp.managedEnvironmentId); }); const updated = localize('updatedRevision', 'Updated revision mode of "{0}" to "{1}".', containerApp.name, pickedRevisionMode); diff --git a/src/commands/deployImage/deployImage.ts b/src/commands/deployImage/deployImage.ts index f906df57..d4b2b0dc 100644 --- a/src/commands/deployImage/deployImage.ts +++ b/src/commands/deployImage/deployImage.ts @@ -9,7 +9,7 @@ import { AzureWizard, AzureWizardExecuteStep, AzureWizardPromptStep, createSubsc import { MessageItem, ProgressLocation, window } from "vscode"; import { acrDomain, webProvider } from "../../constants"; import { ext } from "../../extensionVariables"; -import { ContainerAppItem, getContainerEnvelopeWithSecrets, refreshContainerApp } from "../../tree/ContainerAppItem"; +import { ContainerAppItem, getContainerEnvelopeWithSecrets } from "../../tree/ContainerAppItem"; import { createContainerAppsAPIClient } from '../../utils/azureClients'; import { localize } from "../../utils/localize"; import { pickContainerApp } from "../../utils/pickContainerApp"; @@ -95,7 +95,7 @@ export async function deployImage(context: ITreeItemPickerContext & Partial => { ext.outputChannel.appendLog(updating); await updateContainerApp(context, subscription, containerApp, { template }) - refreshContainerApp(containerApp.id); + ext.state.notifyChildrenChanged(containerApp.managedEnvironmentId); void window.showInformationMessage(updated); ext.outputChannel.appendLog(updated); }); diff --git a/src/tree/ContainerAppItem.ts b/src/tree/ContainerAppItem.ts index 073327eb..4dbbe9fc 100644 --- a/src/tree/ContainerAppItem.ts +++ b/src/tree/ContainerAppItem.ts @@ -7,7 +7,7 @@ import { ContainerApp, ContainerAppsAPIClient, KnownActiveRevisionsMode } from " import { getResourceGroupFromId, uiUtils } from "@microsoft/vscode-azext-azureutils"; import { AzureWizard, callWithTelemetryAndErrorHandling, createSubscriptionContext, DeleteConfirmationStep, IActionContext, nonNullProp } from "@microsoft/vscode-azext-utils"; import { AzureSubscription, ViewPropertiesModel } from "@microsoft/vscode-azureresources-api"; -import { EventEmitter, TreeItem, TreeItemCollapsibleState, Uri } from "vscode"; +import { TreeItem, TreeItemCollapsibleState, Uri } from "vscode"; import { DeleteAllContainerAppsStep } from "../commands/deleteContainerApp/DeleteAllContainerAppsStep"; import { IDeleteContainerAppWizardContext } from "../commands/deleteContainerApp/IDeleteContainerAppWizardContext"; import { ext } from "../extensionVariables"; @@ -23,13 +23,6 @@ import { LogsItem } from "./LogsItem"; import { RevisionsItem } from "./RevisionsItem"; import { ScaleItem } from "./scaling/ScaleItem"; -const refreshContainerAppEmitter = new EventEmitter(); -const refreshContainerAppEvent = refreshContainerAppEmitter.event; - -export function refreshContainerApp(id: string): void { - refreshContainerAppEmitter.fire(id); -} - export interface ContainerAppModel extends ContainerApp { id: string; name: string; @@ -56,19 +49,6 @@ export class ContainerAppItem implements ContainerAppsItem { this.id = this.containerApp.id; this.resourceGroup = this.containerApp.resourceGroup; this.name = this.containerApp.name; - refreshContainerAppEvent((id) => { - if (id === this.id) { - void this.refresh(); - } - }) - } - - private async refresh(): Promise { - await callWithTelemetryAndErrorHandling('containerAppItem.refresh', async (context) => { - const client: ContainerAppsAPIClient = await createContainerAppsClient(context, this.subscription); - this._containerApp = ContainerAppItem.CreateContainerAppModel(await client.containerApps.get(this.resourceGroup, this.name)); - ext.branchDataProvider.refresh(this); - }); } viewProperties: ViewPropertiesModel = {