From 0530eb44928c04bb9915b571c41c75582f3f2ad7 Mon Sep 17 00:00:00 2001 From: "s.teleshev" Date: Wed, 20 Mar 2024 15:23:40 +0100 Subject: [PATCH] CB-4686 makes onDataOutdated execution manual --- .../core-authentication/src/AuthConfigurationsResource.ts | 6 +++++- .../packages/core-authentication/src/UserInfoResource.ts | 4 ++++ webapp/packages/core-authentication/src/UsersResource.ts | 2 ++ .../ConnectionExecutionContextResource.ts | 7 ++++++- .../core-connections/src/ConnectionFolderResource.ts | 7 ++++++- .../core-connections/src/ConnectionInfoResource.ts | 7 +++++++ .../src/NodesManager/NavTreeResource.ts | 6 +++++- .../core-resource-manager/src/ResourceManagerResource.ts | 3 +++ .../core-resource-manager/src/SharedProjectsResource.ts | 2 ++ .../packages/core-resource/src/Resource/CachedResource.ts | 1 - webapp/packages/core-root/src/ServerConfigResource.ts | 4 ++++ 11 files changed, 44 insertions(+), 5 deletions(-) diff --git a/webapp/packages/core-authentication/src/AuthConfigurationsResource.ts b/webapp/packages/core-authentication/src/AuthConfigurationsResource.ts index be4acb05d7..14960db42b 100644 --- a/webapp/packages/core-authentication/src/AuthConfigurationsResource.ts +++ b/webapp/packages/core-authentication/src/AuthConfigurationsResource.ts @@ -30,7 +30,10 @@ type NewConfiguration = AuthConfiguration & { [NEW_CONFIGURATION_SYMBOL]: boolea @injectable() export class AuthConfigurationsResource extends CachedMapResource { - constructor(private readonly graphQLService: GraphQLService, permissionsResource: SessionPermissionsResource) { + constructor( + private readonly graphQLService: GraphQLService, + permissionsResource: SessionPermissionsResource, + ) { super(() => new Map(), []); permissionsResource.require(this, EAdminPermission.admin).outdateResource(this); @@ -51,6 +54,7 @@ export class AuthConfigurationsResource extends CachedMapResource { - return await this.performUpdate(getContextBaseId(key, ''), [], async () => { + const contextKey = getContextBaseId(key, ''); + return await this.performUpdate(contextKey, [], async () => { const { context } = await this.graphQLService.sdk.executionContextCreate({ ...key, defaultCatalog, @@ -85,6 +86,8 @@ export class ConnectionExecutionContextResource extends CachedMapResource { diff --git a/webapp/packages/core-connections/src/ConnectionFolderResource.ts b/webapp/packages/core-connections/src/ConnectionFolderResource.ts index 5b25873085..63bbab8571 100644 --- a/webapp/packages/core-connections/src/ConnectionFolderResource.ts +++ b/webapp/packages/core-connections/src/ConnectionFolderResource.ts @@ -37,7 +37,11 @@ export const ConnectionFolderProjectKey = resourceKeyAliasFactory('@connection-f @injectable() export class ConnectionFolderResource extends CachedMapResource { - constructor(private readonly graphQLService: GraphQLService, sessionDataResource: SessionDataResource, appAuthService: AppAuthService) { + constructor( + private readonly graphQLService: GraphQLService, + sessionDataResource: SessionDataResource, + appAuthService: AppAuthService, + ) { super(); appAuthService.requireAuthentication(this); @@ -70,6 +74,7 @@ export class ConnectionFolderResource extends CachedMapResource { await this.performUpdate(key, [], async () => { await this.graphQLService.sdk.deleteConnection({ projectId: key.projectId, connectionId: key.connectionId }); + this.onDataOutdated.execute(key); }); this.delete(key); }); diff --git a/webapp/packages/core-navigation-tree/src/NodesManager/NavTreeResource.ts b/webapp/packages/core-navigation-tree/src/NodesManager/NavTreeResource.ts index dfad4051f6..92edcdb250 100644 --- a/webapp/packages/core-navigation-tree/src/NodesManager/NavTreeResource.ts +++ b/webapp/packages/core-navigation-tree/src/NodesManager/NavTreeResource.ts @@ -193,6 +193,7 @@ export class NavTreeResource extends CachedMapResource { const deletedNodes: string[] = []; @@ -223,8 +224,9 @@ export class NavTreeResource extends CachedMapResource, target: string): Promise { const parents = Array.from(new Set(ResourceKeyUtils.mapArray(key, key => this.navNodeInfoResource.get(key)?.parentId).filter(isDefined))); + const parentsKey = resourceKeyList(parents); - await this.performUpdate(resourceKeyList(parents), [], async () => { + await this.performUpdate(parentsKey, [], async () => { this.markLoading(target, true); try { @@ -235,6 +237,7 @@ export class NavTreeResource extends CachedMapResource 0) { diff --git a/webapp/packages/core-resource/src/Resource/CachedResource.ts b/webapp/packages/core-resource/src/Resource/CachedResource.ts index 811526aced..3310a353fd 100644 --- a/webapp/packages/core-resource/src/Resource/CachedResource.ts +++ b/webapp/packages/core-resource/src/Resource/CachedResource.ts @@ -659,7 +659,6 @@ export abstract class CachedResource< { success: () => { if (loaded) { - this.onDataOutdated.execute(key); // TODO: probably need to remove, we need to notify any related resources that subscribed to .onOutdate, to recursively outdate them this.dataUpdate(key); } }, diff --git a/webapp/packages/core-root/src/ServerConfigResource.ts b/webapp/packages/core-root/src/ServerConfigResource.ts index c4f1dd2fc3..840a5781d6 100644 --- a/webapp/packages/core-root/src/ServerConfigResource.ts +++ b/webapp/packages/core-root/src/ServerConfigResource.ts @@ -232,6 +232,7 @@ export class ServerConfigResource extends CachedDataResource { await this.graphQLService.sdk.updateProductConfiguration({ configuration }); this.setData(await this.loader()); + this.onDataOutdated.execute(); }); } @@ -256,6 +257,8 @@ export class ServerConfigResource extends CachedDataResource !this.isNavigatorSettingsChanged() && (!this.isChanged() || skipConfigUpdate), ); @@ -271,6 +274,7 @@ export class ServerConfigResource extends CachedDataResource !this.isChanged() && !onlyRestart, );