Merge pull request #86 from dbeaver/feat-data-refresh

fix(core): temporary connection disconnect behavior
This commit is contained in:
Serge Rider
2020-06-15 17:26:08 +03:00
committed by GitHub
3 changed files with 12 additions and 7 deletions
@@ -180,7 +180,7 @@ export class ConnectionSchemaManagerService {
try {
await this.connectionsManagerService.loadConnectionInfoAsync(connectionId);
} catch (exception) {
this.notificationService.logException(exception, 'Can\'t load connection info');
this.notificationService.logException(exception, 'Can\'t load connection info', true);
}
try {
@@ -41,7 +41,7 @@ export class ConnectionSelectorController {
}
get isConnectionSelectorVisible() {
return !!this.connectionSelectorService.currentConnectionId;
return !!this.currentConnection;
}
get isObjectContainerSelectorVisible() {
return !!this.connectionSelectorService.currentObjectCatalogId
@@ -173,22 +173,27 @@ export class ConnectionsManagerService {
}
async closeNavNodeConnectionAsync(navNodeId: string): Promise<void> {
const node = this.navNodeManagerService.getNode(navNodeId);
if (!node) {
const connectionId = NodeManagerUtils.connectionNodeIdToConnectionId(navNodeId);
const connection = this.getConnectionById(connectionId);
if (!connection) {
return;
}
try {
const connectionId = NodeManagerUtils.connectionNodeIdToConnectionId(navNodeId);
await this.graphQLService.gql.closeConnection({ id: connectionId });
await this.afterConnectionClose(connectionId);
await this.connectionInfo.refresh(true, { connectionId, close: true });
if (node.objectFeatures.includes('dataSourceTemporary')) {
if (connection.features.includes(EConnectionFeature.temporary)) {
const node = this.navNodeManagerService.getNode(navNodeId);
if (!node) {
return;
}
await this.navNodeManagerService.refreshTree(node.parentId);
} else {
await this.navNodeManagerService.refreshNode(navNodeId);
await this.navNodeManagerService.removeTree(navNodeId);
}
await this.navNodeManagerService.removeTree(navNodeId);
} catch (exception) {
this.notificationService.logException(exception, `Can't close connection: ${navNodeId}`);
}