feat: CB-835 execution context unique id

This commit is contained in:
Wroud
2021-12-20 01:56:26 +03:00
parent 9a066907e2
commit 86802a34da
17 changed files with 79 additions and 101 deletions
@@ -103,7 +103,7 @@ export class SqlEditorTabService extends Bootstrap {
);
for (const tab of tabs) {
const executionContext = this.connectionExecutionContextService.get(tab.handlerState.executionContext!.baseId);
const executionContext = this.connectionExecutionContextService.get(tab.handlerState.executionContext!.id);
if (!executionContext?.context) {
this.resetConnectionInfo(tab.handlerState);
@@ -119,7 +119,7 @@ export class SqlEditorTabService extends Bootstrap {
);
for (const tab of tabs) {
if (ResourceKeyUtils.includes(key, tab.handlerState.executionContext!.baseId)) {
if (ResourceKeyUtils.includes(key, tab.handlerState.executionContext!.id)) {
this.resetConnectionInfo(tab.handlerState);
}
}
@@ -137,7 +137,6 @@ export class SqlEditorTabService extends Bootstrap {
|| !['undefined', 'object'].includes(typeof tab.handlerState.executionContext)
|| !['string', 'undefined', 'object'].includes(typeof tab.handlerState.executionContext?.connectionId)
|| !['string', 'undefined', 'object'].includes(typeof tab.handlerState.executionContext?.id)
|| !['string', 'undefined', 'object'].includes(typeof tab.handlerState.executionContext?.baseId)
|| !['string', 'undefined', 'object'].includes(typeof tab.handlerState.executionContext?.defaultCatalog)
|| !['string', 'undefined', 'object'].includes(typeof tab.handlerState.executionContext?.defaultSchema)
|| !['string', 'undefined', 'object'].includes(typeof tab.handlerState.currentTabId)
@@ -153,7 +152,7 @@ export class SqlEditorTabService extends Bootstrap {
if (tab.handlerState.executionContext) {
await this.connectionInfo.load(CachedMapAllKey);
await this.connectionExecutionContextResource.loadAll();
const executionContext = this.connectionExecutionContextService.get(tab.handlerState.executionContext.baseId);
const executionContext = this.connectionExecutionContextService.get(tab.handlerState.executionContext.id);
if (!executionContext) {
this.resetConnectionInfo(tab.handlerState);
@@ -210,7 +209,7 @@ export class SqlEditorTabService extends Bootstrap {
return false;
}
const executionContext = this.connectionExecutionContextService.get(tab.handlerState.executionContext.baseId);
const executionContext = this.connectionExecutionContextService.get(tab.handlerState.executionContext.id);
if (!executionContext) {
return false;
@@ -234,7 +233,7 @@ export class SqlEditorTabService extends Bootstrap {
return false;
}
const executionContext = this.connectionExecutionContextService.get(tab.handlerState.executionContext.baseId);
const executionContext = this.connectionExecutionContextService.get(tab.handlerState.executionContext.id);
if (!executionContext) {
return false;
@@ -266,13 +265,13 @@ export class SqlEditorTabService extends Bootstrap {
}
private async destroyContext(contextInfo: IConnectionExecutionContextInfo) {
const executionContext = this.connectionExecutionContextService.get(contextInfo.baseId);
const executionContext = this.connectionExecutionContextService.get(contextInfo.id);
if (executionContext) {
try {
await executionContext.destroy();
} catch (exception) {
this.notificationService.logException(exception, `Failed to destroy SQL-context ${executionContext.context?.baseId}`, '', true);
this.notificationService.logException(exception, `Failed to destroy SQL-context ${executionContext.context?.id}`, '', true);
}
}
}