fix(core): connection picker

CB-41
This commit is contained in:
Wroud
2020-06-10 12:58:02 +03:00
parent 34dc6cbb29
commit aa92935966
2 changed files with 13 additions and 9 deletions
@@ -141,7 +141,7 @@ export class ConnectionSchemaManagerService {
if (!this.activeItem?.changeConnectionId) {
return;
}
this.activeItem.changeConnectionId(connectionId, this.activeItem);
this.activeItem.changeConnectionId(connectionId, this.activeItem.context);
this.loadConnection(connectionId);
}
@@ -152,7 +152,7 @@ export class ConnectionSchemaManagerService {
if (!this.activeItem?.changeCatalogId) {
throw new Error('The try to change catalog without connection');
}
this.activeItem.changeCatalogId(catalogId, this.activeItem);
this.activeItem.changeCatalogId(catalogId, this.activeItem.context);
this.loadConnection(this.currentConnectionId!, catalogId);
}
@@ -163,7 +163,7 @@ export class ConnectionSchemaManagerService {
if (!this.activeItem?.changeSchemaId) {
throw new Error('The try to change schema without connection');
}
this.activeItem.changeSchemaId(schemaId, this.activeItem);
this.activeItem.changeSchemaId(schemaId, this.activeItem.context);
}
private onNodeSelect([navNodeId, selected]: [string, boolean]) {
@@ -114,18 +114,22 @@ export class SqlEditorTabService {
await this.sqlDialectInfoService.loadSqlDialectInfo(connectionId);
return true;
} catch (exception) {
this.notificationService.logError({ title: 'Failed to change SQL-editor connection' });
this.notificationService.logException(exception, 'Failed to change SQL-editor connection');
return false;
}
}
private async setObjectCatalogId(containerId: string, tab: ITab<ISqlEditorTabState>) {
try {
await this.updateSqlContext(tab.handlerState.connectionId, tab.handlerState.contextId, containerId);
await this.updateSqlContext(
tab.handlerState.connectionId,
tab.handlerState.contextId,
containerId
);
tab.handlerState.objectCatalogId = containerId;
return true;
} catch (exception) {
this.notificationService.logError({ title: 'Failed to change SQL-editor schema' });
this.notificationService.logException(exception, 'Failed to change SQL-editor catalog');
return false;
}
}
@@ -141,7 +145,7 @@ export class SqlEditorTabService {
tab.handlerState.objectSchemaId = containerId;
return true;
} catch (exception) {
this.notificationService.logError({ title: 'Failed to change SQL-editor schema' });
this.notificationService.logException(exception, 'Failed to change SQL-editor schema');
return false;
}
}
@@ -158,8 +162,8 @@ export class SqlEditorTabService {
}
try {
await this.gql.gql.sqlContextDestroy({ connectionId, contextId });
} catch (e) {
this.notificationService.logError({ title: `Failed to destroy SQL-context ${contextId}` });
} catch (exception) {
this.notificationService.logException(exception, `Failed to destroy SQL-context ${contextId}`);
}
}