diff --git a/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorTabService.ts b/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorTabService.ts index 4b1973332a..b1e9c41be9 100644 --- a/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorTabService.ts +++ b/webapp/packages/plugin-sql-editor-navigation-tab/src/SqlEditorTabService.ts @@ -40,7 +40,7 @@ import { ESqlDataSourceFeatures, ISQLDatasourceUpdateData, ISqlEditorTabState, - SQL_EDITOR_TAB_STATE_SCHEME, + SQL_EDITOR_TAB_STATE_SCHEMA, SqlDataSourceService, SqlEditorService, SqlResultTabsService, @@ -275,7 +275,7 @@ export class SqlEditorTabService extends Bootstrap { } private async handleTabRestore(tab: ITab): Promise { - if (!SQL_EDITOR_TAB_STATE_SCHEME.safeParse(tab.handlerState).success) { + if (!SQL_EDITOR_TAB_STATE_SCHEMA.safeParse(tab.handlerState).success) { await this.sqlDataSourceService.destroy(tab.handlerState.editorId); return false; } diff --git a/webapp/packages/plugin-sql-editor/src/ISqlEditorTabState.ts b/webapp/packages/plugin-sql-editor/src/ISqlEditorTabState.ts index 3776de71df..a89184dbe7 100644 --- a/webapp/packages/plugin-sql-editor/src/ISqlEditorTabState.ts +++ b/webapp/packages/plugin-sql-editor/src/ISqlEditorTabState.ts @@ -9,7 +9,7 @@ import { schema } from '@cloudbeaver/core-utils'; import { OUTPUT_LOG_TYPES } from './SqlResultTabs/OutputLogs/IOutputLogTypes'; -export const RESULT_TAB_SCHEME = schema.object({ +export const RESULT_TAB_SCHEMA = schema.object({ tabId: schema.string(), groupId: schema.string(), indexInResultSet: schema.number(), @@ -17,16 +17,16 @@ export const RESULT_TAB_SCHEME = schema.object({ valuePresentationId: schema.nullable(schema.string()), }); -export type IResultTab = schema.infer; +export type IResultTab = schema.infer; -export const STATISTIC_TAB_SCHEME = schema.object({ +export const STATISTIC_TAB_SCHEMA = schema.object({ tabId: schema.string(), order: schema.number(), }); -export type IStatisticsTab = schema.infer; +export type IStatisticsTab = schema.infer; -export const RESULT_GROUP_SCHEME = schema.object({ +export const RESULT_GROUP_SCHEMA = schema.object({ groupId: schema.string(), modelId: schema.string(), order: schema.number(), @@ -34,46 +34,46 @@ export const RESULT_GROUP_SCHEME = schema.object({ query: schema.string(), }); -export type IResultGroup = schema.infer; +export type IResultGroup = schema.infer; -export const SQL_EDITOR_RESULT_TAB_SCHEME = schema.object({ +export const SQL_EDITOR_RESULT_TAB_SCHEMA = schema.object({ id: schema.string(), order: schema.number(), name: schema.string(), icon: schema.string(), }); -export type ISqlEditorResultTab = schema.infer; +export type ISqlEditorResultTab = schema.infer; -export const EXECUTION_PLAN_TAB_SCHEME = schema.object({ +export const EXECUTION_PLAN_TAB_SCHEMA = schema.object({ tabId: schema.string(), order: schema.number(), query: schema.string(), options: schema.record(schema.any()).optional(), }); -export type IExecutionPlanTab = schema.infer; +export type IExecutionPlanTab = schema.infer; -const OUTPUT_LOGS_TAB_SCHEME = SQL_EDITOR_RESULT_TAB_SCHEME.extend({ +const OUTPUT_LOGS_TAB_SCHEMA = SQL_EDITOR_RESULT_TAB_SCHEMA.extend({ selectedLogTypes: schema.array(schema.enum(OUTPUT_LOG_TYPES)), }); -export type IOutputLogsTab = schema.infer; +export type IOutputLogsTab = schema.infer; -export const SQL_EDITOR_TAB_STATE_SCHEME = schema.object({ +export const SQL_EDITOR_TAB_STATE_SCHEMA = schema.object({ editorId: schema.string(), datasourceKey: schema.string(), source: schema.string().optional(), order: schema.number(), currentTabId: schema.string().optional(), - tabs: schema.array(SQL_EDITOR_RESULT_TAB_SCHEME), - resultGroups: schema.array(RESULT_GROUP_SCHEME), - resultTabs: schema.array(RESULT_TAB_SCHEME), - statisticsTabs: schema.array(STATISTIC_TAB_SCHEME), - executionPlanTabs: schema.array(EXECUTION_PLAN_TAB_SCHEME), - outputLogsTab: OUTPUT_LOGS_TAB_SCHEME.optional(), + tabs: schema.array(SQL_EDITOR_RESULT_TAB_SCHEMA), + resultGroups: schema.array(RESULT_GROUP_SCHEMA), + resultTabs: schema.array(RESULT_TAB_SCHEMA), + statisticsTabs: schema.array(STATISTIC_TAB_SCHEMA), + executionPlanTabs: schema.array(EXECUTION_PLAN_TAB_SCHEMA), + outputLogsTab: OUTPUT_LOGS_TAB_SCHEMA.optional(), currentModeId: schema.string().optional(), modeState: schema.array(schema.tuple([schema.string(), schema.any()])), }); -export type ISqlEditorTabState = schema.infer; +export type ISqlEditorTabState = schema.infer;