+
{SqlFormExtension && (
= ({
/>
)}
{queryEditor.isDataset && renderDatasetWarning()}
- {isActive && (
-
- )}
+
+
+ {({ height }) =>
+ isActive && (
+
+ )
+ }
+
+
{renderEditorBottomBar(showEmptyState)}
+
+
-
- );
- };
+
+
+ );
const createViewModalTitle =
createAs === CtasEnum.View ? 'CREATE VIEW AS' : 'CREATE TABLE AS';
@@ -1029,54 +970,68 @@ const SqlEditor: FC
= ({
? t('Specify name to CREATE VIEW AS schema in: public')
: t('Specify name to CREATE TABLE AS schema in: public');
- const leftBarStateClass = hideLeftBar
- ? 'schemaPane-exit-done'
- : 'schemaPane-enter-done';
+ const [width, setWidth] = useStoredSidebarWidth(
+ `sqllab:${queryEditor.id}`,
+ SQL_EDITOR_LEFTBAR_WIDTH,
+ );
+
+ const onSidebarChange = useCallback(
+ (sizes: number[]) => {
+ const [updatedWidth] = sizes;
+ if (hideLeftBar || updatedWidth === 0) {
+ dispatch(toggleLeftBar({ id: queryEditor.id, hideLeftBar }));
+ if (hideLeftBar) {
+ // Due to a bug in the splitter, the width must be changed
+ // in order to properly restore the previous size
+ setWidth(width + 0.01);
+ }
+ } else {
+ setWidth(updatedWidth);
+ }
+ },
+ [dispatch, hideLeftBar],
+ );
+
return (
-
-
+
- {adjustedWidth => (
-
+
+
+
+
+ {shouldLoadQueryEditor ? (
+
-
-
+
+
+ ) : showEmptyState && !hasSqlStatement ? (
+
+ ) : (
+ queryPane()
)}
-
-
- {shouldLoadQueryEditor ? (
-
-
-
- ) : showEmptyState && !hasSqlStatement ? (
-
- ) : (
- queryPane()
- )}
+
+
= ({ dbId, catalog, schema, tableName }) => {
visualize={false}
csv={false}
cache
- height={
- height - TAB_HEADER_HEIGHT - PREVIEW_TOP_ACTION_HEIGHT
- }
displayLimit={PREVIEW_QUERY_LIMIT}
defaultQueryLimit={PREVIEW_QUERY_LIMIT}
/>
diff --git a/superset-frontend/src/SqlLab/constants.ts b/superset-frontend/src/SqlLab/constants.ts
index a2f19c96055..97667325d2b 100644
--- a/superset-frontend/src/SqlLab/constants.ts
+++ b/superset-frontend/src/SqlLab/constants.ts
@@ -66,13 +66,9 @@ export const TIME_OPTIONS = [
];
// SqlEditor layout constants
-export const SQL_EDITOR_GUTTER_HEIGHT = 5;
-export const SQL_EDITOR_GUTTER_MARGIN = 3;
-export const SQL_TOOLBAR_HEIGHT = 51;
+export const SQL_EDITOR_GUTTER_HEIGHT = 4;
export const SQL_EDITOR_LEFTBAR_WIDTH = 400;
-export const SQL_EDITOR_PADDING = 10;
export const INITIAL_NORTH_PERCENT = 30;
-export const INITIAL_SOUTH_PERCENT = 70;
export const SET_QUERY_EDITOR_SQL_DEBOUNCE_MS = 2000;
export const VALIDATION_DEBOUNCE_MS = 600;
export const WINDOW_RESIZE_THROTTLE_MS = 100;
diff --git a/superset-frontend/src/components/Splitter/index.tsx b/superset-frontend/src/components/Splitter/index.tsx
new file mode 100644
index 00000000000..5e6ad213899
--- /dev/null
+++ b/superset-frontend/src/components/Splitter/index.tsx
@@ -0,0 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export { Splitter } from 'antd';
+export type { SplitterProps } from 'antd/es/splitter';