CB-4584 fix: object property table reloads pages after connection being disconnected

This commit is contained in:
sergeyteleshev
2024-05-23 16:24:08 +02:00
parent 63b94e42db
commit 46f28dc045
2 changed files with 9 additions and 3 deletions
@@ -8,7 +8,7 @@
import { action, makeObservable } from 'mobx';
import { Dependency, injectable } from '@cloudbeaver/core-di';
import { ExecutorInterrupter, IAsyncContextLoader, IExecutionContextProvider } from '@cloudbeaver/core-executor';
import { ExecutorInterrupter, IAsyncContextLoader, IExecutionContextProvider, IExecutorHandler } from '@cloudbeaver/core-executor';
import {
INodeNavigationData,
NavNodeInfoResource,
@@ -23,7 +23,7 @@ import { ServerEventId } from '@cloudbeaver/core-root';
import type { IConnectionInfoParams } from '../CONNECTION_INFO_PARAM_SCHEMA';
import { ConnectionFolderEventHandler, IConnectionFolderEvent } from '../ConnectionFolderEventHandler';
import { Connection, ConnectionInfoActiveProjectKey, ConnectionInfoResource, createConnectionParam } from '../ConnectionInfoResource';
import { ConnectionsManagerService } from '../ConnectionsManagerService';
import { ConnectionsManagerService, IConnectionExecutorData } from '../ConnectionsManagerService';
import { ContainerResource } from '../ContainerResource';
import { getConnectionParentId } from './getConnectionParentId';
import { getFolderNodeParents } from './getFolderNodeParents';
@@ -57,6 +57,8 @@ export class ConnectionNavNodeService extends Dependency {
this.navNodeManagerService.navigator.addHandler(this.navigateHandler.bind(this));
this.connectionsManagerService.onDisconnect.addHandler(this.onDisconnectHandle.bind(this));
this.connectionInfoResource.connect(this.navTreeResource);
this.connectionFolderEventHandler.onEvent<IConnectionFolderEvent>(
@@ -99,6 +101,10 @@ export class ConnectionNavNodeService extends Dependency {
);
}
onDisconnectHandle: IExecutorHandler<IConnectionExecutorData, any> = async (data, contexts) => {
this.navTreeResource.markOutdated(resourceKeyList(data.connections.map(connection => connection.connectionId)));
};
navigationNavNodeConnectionContext: IAsyncContextLoader<Connection | undefined, INodeNavigationData> = async (context, { nodeId }) => {
await this.connectionInfoResource.load(ConnectionInfoActiveProjectKey);
const connection = this.connectionInfoResource.getConnectionForNode(nodeId);
@@ -45,7 +45,7 @@ export const ObjectPropertyTable = observer<ObjectPropertyTableProps>(function O
return (
<>
{nodes.length === 0 ? (
{objects.length === 0 ? (
<TextPlaceholder>{translate('plugin_object_viewer_table_no_items')}</TextPlaceholder>
) : (
<div className={s(styles, { box: true }, className)}>