From a681956912b2e2fc87cf02b7b18d205a38dcb6fe Mon Sep 17 00:00:00 2001 From: Alexey Date: Thu, 25 May 2023 15:14:20 +0400 Subject: [PATCH] CB-3506 feat: increase max sql file size (#1687) * CB-3506 feat: increase max sql file size * CB-3506 chore: revert setting name --------- Co-authored-by: dariamarutkina <125263541+dariamarutkina@users.noreply.github.com> --- .../src/FormControls/InputFileTextContent.tsx | 2 +- .../core-blocks/src/Split/splitButtonStyles.ts | 17 +++++++++-------- webapp/packages/core-blocks/src/Split/styles.ts | 8 ++++---- .../src/SqlEditor/useTools.tsx | 2 +- .../src/SqlEditorSettingsService.ts | 2 +- .../packages/product-default/src/config.json5 | 10 ++++++---- 6 files changed, 22 insertions(+), 19 deletions(-) diff --git a/webapp/packages/core-blocks/src/FormControls/InputFileTextContent.tsx b/webapp/packages/core-blocks/src/FormControls/InputFileTextContent.tsx index e5e492e4f8..2e38251621 100644 --- a/webapp/packages/core-blocks/src/FormControls/InputFileTextContent.tsx +++ b/webapp/packages/core-blocks/src/FormControls/InputFileTextContent.tsx @@ -135,7 +135,7 @@ export const InputFileTextContent: InputFileTextContentType = observer(function } function validateFileSize(size: number) { - const maxFileSizeBytes = maxFileSize * 1000; + const maxFileSizeBytes = maxFileSize * 1024; if (size > maxFileSizeBytes) { throw new Error(translate('ui_file_size_exceeds', undefined, { diff --git a/webapp/packages/core-blocks/src/Split/splitButtonStyles.ts b/webapp/packages/core-blocks/src/Split/splitButtonStyles.ts index 453308cb14..977d74629d 100644 --- a/webapp/packages/core-blocks/src/Split/splitButtonStyles.ts +++ b/webapp/packages/core-blocks/src/Split/splitButtonStyles.ts @@ -14,6 +14,7 @@ export const buttonStyles = css` display: flex; justify-content: center; align-content: center; + align-items: center; /* pointer outline */ &::before { @@ -42,15 +43,15 @@ export const buttonStyles = css` flex-direction: column; cursor: ew-resize; height: 100%; - width: 16px; - left: -7px; + width: 5px; + left: -2px; &[|mode=minimize] { - left: -4px; + left: 0; } &[|mode=maximize] { - left: -12px; + left: -2px; } & button { @@ -79,15 +80,15 @@ export const buttonStyles = css` flex-direction: row; cursor: ns-resize; width: 100%; - height: 16px; - top: -7px; + height: 5px; + top: -2px; &[|mode=minimize] { - top: -4px; + top: 0; } &[|mode=maximize] { - top: -12px; + top: -2px; } & button { diff --git a/webapp/packages/core-blocks/src/Split/styles.ts b/webapp/packages/core-blocks/src/Split/styles.ts index 8b3f4402a7..759f2f4fcc 100644 --- a/webapp/packages/core-blocks/src/Split/styles.ts +++ b/webapp/packages/core-blocks/src/Split/styles.ts @@ -46,10 +46,10 @@ export const splitStyles = css` ResizerControls:before { content: ' '; position: absolute; - width: 12px; + width: 4px; height: 100%; top: 0; - left: -5px; + left: -1px; cursor: ew-resize; box-sizing: border-box; } @@ -72,9 +72,9 @@ export const splitHorizontalStyles = css` } ResizerControls:before { - height: 12px; + height: 4px; width: 100%; - top: -5px; + top: -1px; left: 0; cursor: ns-resize; } diff --git a/webapp/packages/plugin-sql-editor/src/SqlEditor/useTools.tsx b/webapp/packages/plugin-sql-editor/src/SqlEditor/useTools.tsx index f955976ece..867fe6278b 100644 --- a/webapp/packages/plugin-sql-editor/src/SqlEditor/useTools.tsx +++ b/webapp/packages/plugin-sql-editor/src/SqlEditor/useTools.tsx @@ -75,7 +75,7 @@ export function useTools(state: ISqlEditorTabState): Readonly { ? this.sqlEditorSettingsService.deprecatedSettings.getValue('maxFileSize') : this.sqlEditorSettingsService.settings.getValue('maxFileSize'); - const size = Math.round(file.size / 1000); // kilobyte + const size = Math.round(file.size / 1024); // kilobyte const aboveMaxSize = size > maxSize; if (aboveMaxSize) { diff --git a/webapp/packages/plugin-sql-editor/src/SqlEditorSettingsService.ts b/webapp/packages/plugin-sql-editor/src/SqlEditorSettingsService.ts index 628ad49c53..722ef153bb 100644 --- a/webapp/packages/plugin-sql-editor/src/SqlEditorSettingsService.ts +++ b/webapp/packages/plugin-sql-editor/src/SqlEditorSettingsService.ts @@ -10,7 +10,7 @@ import { injectable } from '@cloudbeaver/core-di'; import { PluginManagerService, PluginSettings } from '@cloudbeaver/core-plugin'; const defaultSettings = { - maxFileSize: 100, // kilobyte + maxFileSize: 10 * 1024, // kilobyte disabled: false, }; diff --git a/webapp/packages/product-default/src/config.json5 b/webapp/packages/product-default/src/config.json5 index 3ea2f1689e..c5033adde0 100644 --- a/webapp/packages/product-default/src/config.json5 +++ b/webapp/packages/product-default/src/config.json5 @@ -15,13 +15,15 @@ logBatchSize: 1000, maxLogRecords: 2000, maxFailedRequests: 3 - }, - sqlEditor: { - // max size of the file that can be uploaded to the editor (in kilobytes) - maxFileSize: 100 } } }, + plugin: { + 'sql-editor': { + // max size of the file that can be uploaded to the editor (in kilobytes) + maxFileSize: 10240 + } + }, plugin_data_spreadsheet_new: { hidden: false },