refactor(plugin-sql-editor): CB-2093 memory data source

This commit is contained in:
Wroud
2022-06-20 13:45:37 +03:00
parent 01e0711627
commit 25decfcd81
10 changed files with 153 additions and 4 deletions
@@ -12,7 +12,7 @@ import { NotificationService } from '@cloudbeaver/core-events';
import { IExecutor, Executor, IExecutionContextProvider } from '@cloudbeaver/core-executor';
import { NavigationService } from '@cloudbeaver/core-ui';
import { uuid } from '@cloudbeaver/core-utils';
import { ISqlEditorTabState, SqlResultTabsService } from '@cloudbeaver/plugin-sql-editor';
import { ISqlEditorTabState, MemorySqlDataSource, SqlResultTabsService } from '@cloudbeaver/plugin-sql-editor';
import { SQL_EDITOR_SOURCE_ACTION } from './SQL_EDITOR_SOURCE_ACTION';
import { SqlEditorTabService, isSQLEditorTab } from './SqlEditorTabService';
@@ -28,6 +28,7 @@ export interface SQLEditorActionContext {
}
export interface ISQLEditorOptions {
dataSourceKey?: string;
name?: string;
connectionId?: string;
catalogId?: string;
@@ -111,6 +112,7 @@ export class SqlEditorNavigatorService {
const tabOptions = this.sqlEditorTabService.createNewEditor(
editorId,
data.dataSourceKey ?? MemorySqlDataSource.key,
data.name,
data.source,
data.query,
@@ -103,6 +103,7 @@ export class SqlEditorTabService extends Bootstrap {
createNewEditor(
editorId: string,
dataSourceKey: string,
name?: string,
source?: string,
query?: string,
@@ -113,7 +114,15 @@ export class SqlEditorTabService extends Bootstrap {
return {
id: editorId,
handlerId: sqlEditorTabHandlerKey,
handlerState: this.sqlEditorService.getState(editorId, order, name, source, query, undefined),
handlerState: this.sqlEditorService.getState(
editorId,
dataSourceKey,
order,
name,
source,
query,
undefined
),
};
}