From 25b895c7aa89216cbd3cf658c43a2bef272d548c Mon Sep 17 00:00:00 2001 From: alex <48489896+devnaumov@users.noreply.github.com> Date: Fri, 15 Mar 2024 11:31:09 +0100 Subject: [PATCH] CB-3977 remove connection from resource on driver delete (#2428) Co-authored-by: Daria Marutkina <125263541+dariamarutkina@users.noreply.github.com> --- .../core-connections/src/ConnectionInfoResource.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/webapp/packages/core-connections/src/ConnectionInfoResource.ts b/webapp/packages/core-connections/src/ConnectionInfoResource.ts index b1b5bfc35a..befdb6ef5e 100644 --- a/webapp/packages/core-connections/src/ConnectionInfoResource.ts +++ b/webapp/packages/core-connections/src/ConnectionInfoResource.ts @@ -40,6 +40,7 @@ import { schemaValidationError } from '@cloudbeaver/core-utils'; import { CONNECTION_INFO_PARAM_SCHEMA, type IConnectionInfoParams } from './CONNECTION_INFO_PARAM_SCHEMA'; import { ConnectionInfoEventHandler, IConnectionInfoEvent } from './ConnectionInfoEventHandler'; import type { DatabaseConnection } from './DatabaseConnection'; +import { DBDriverResource } from './DBDriverResource'; export type Connection = DatabaseConnection & { authProperties?: UserConnectionAuthPropertiesFragment[]; @@ -89,6 +90,7 @@ export class ConnectionInfoResource extends CachedMapResource this.sessionUpdate)); this.onConnectionCreate.addHandler(ExecutorInterrupter.interrupter(() => this.sessionUpdate)); + dbDriverResource.onItemDelete.addHandler(data => { + const hiddenConnections = this.values.filter(connection => connection.driverId === data); + this.delete(resourceKeyList(hiddenConnections.map(connection => createConnectionParam(connection)))); + }); + userInfoResource.onUserChange.addHandler(() => { this.clear(); });