mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-10-28 03:41:48 +08:00
dbeaver/pro#6327 refactor: sql editor & vqb (#3742)
* dbeaver/pro#6327 refactor: sql editor & vqb * fix: state sync * fix: segment resolution * chore: add comment * refactor: remove old code, add todo about problem * fix: yarn.lock --------- Co-authored-by: mr-anton-t <42037741+mr-anton-t@users.noreply.github.com> Co-authored-by: Evgenia <139753579+EvgeniaBzzz@users.noreply.github.com>
This commit is contained in:
co-authored by
mr-anton-t
Evgenia
parent
0fe432f45c
commit
4f53ece164
@@ -44,6 +44,7 @@ import {
|
||||
type ISqlEditorTabState,
|
||||
SQL_EDITOR_TAB_STATE_SCHEMA,
|
||||
SqlDataSourceService,
|
||||
SqlEditorModelService,
|
||||
SqlEditorService,
|
||||
SqlResultTabsService,
|
||||
} from '@cloudbeaver/plugin-sql-editor';
|
||||
@@ -67,6 +68,7 @@ const SqlEditorTab = importLazyComponent(() => import('./SqlEditorTab.js').then(
|
||||
ConnectionsManagerService,
|
||||
ContainerResource,
|
||||
CommonDialogService,
|
||||
SqlEditorModelService,
|
||||
])
|
||||
export class SqlEditorTabService extends Bootstrap {
|
||||
get sqlEditorTabs(): ITab<ISqlEditorTabState>[] {
|
||||
@@ -89,6 +91,7 @@ export class SqlEditorTabService extends Bootstrap {
|
||||
private readonly connectionsManagerService: ConnectionsManagerService,
|
||||
private readonly containerResource: ContainerResource,
|
||||
private readonly commonDialogService: CommonDialogService,
|
||||
private readonly sqlEditorModelService: SqlEditorModelService,
|
||||
) {
|
||||
super();
|
||||
|
||||
@@ -305,6 +308,7 @@ export class SqlEditorTabService extends Bootstrap {
|
||||
|
||||
private async handleTabRestore(tab: ITab<ISqlEditorTabState>): Promise<boolean> {
|
||||
if (!SQL_EDITOR_TAB_STATE_SCHEMA.safeParse(tab.handlerState).success) {
|
||||
await this.sqlEditorModelService.destroy(tab.handlerState.editorId);
|
||||
await this.sqlDataSourceService.destroy(tab.handlerState.editorId);
|
||||
return false;
|
||||
}
|
||||
@@ -531,12 +535,14 @@ export class SqlEditorTabService extends Bootstrap {
|
||||
}
|
||||
|
||||
private async handleTabUnload(editorTab: ITab<ISqlEditorTabState>) {
|
||||
await this.sqlEditorModelService.unload(editorTab.handlerState.editorId);
|
||||
await this.sqlDataSourceService.unload(editorTab.handlerState.editorId);
|
||||
|
||||
this.sqlResultTabsService.removeResultTabs(editorTab.handlerState);
|
||||
}
|
||||
|
||||
private async handleTabCloseSilent(editorTab: ITab<ISqlEditorTabState>) {
|
||||
await this.sqlEditorModelService.destroySilent(editorTab.handlerState.editorId);
|
||||
const dataSource = this.sqlDataSourceService.get(editorTab.handlerState.editorId);
|
||||
|
||||
if (dataSource?.executionContext) {
|
||||
@@ -548,6 +554,8 @@ export class SqlEditorTabService extends Bootstrap {
|
||||
}
|
||||
|
||||
private async handleTabClose(editorTab: ITab<ISqlEditorTabState>) {
|
||||
await this.sqlEditorModelService.destroy(editorTab.handlerState.editorId);
|
||||
|
||||
const dataSource = this.sqlDataSourceService.get(editorTab.handlerState.editorId);
|
||||
|
||||
if (dataSource?.executionContext) {
|
||||
|
||||
Reference in New Issue
Block a user