This is an automated email from the ASF dual-hosted git repository.
michaelsmolina pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 6984e93171e fix: SQL Lab improvements and bug fixes (#37760)
6984e93171e is described below
commit 6984e93171e032bbc8416886ce69174d14bb5601
Author: Michael S. Molina <[email protected]>
AuthorDate: Mon Feb 9 14:29:08 2026 -0300
fix: SQL Lab improvements and bug fixes (#37760)
---
.../src/components/Icons/AntdEnhanced.tsx | 2 +
.../TableExploreTree/TreeNodeRenderer.tsx | 2 +-
.../SqlLab/components/TableExploreTree/index.tsx | 63 +++++++++++++---------
.../src/components/PanelToolbar/index.tsx | 2 +-
.../src/core/editors/AceEditorProvider.tsx | 20 +++----
superset/sqllab/utils.py | 3 ++
6 files changed, 51 insertions(+), 41 deletions(-)
diff --git
a/superset-frontend/packages/superset-ui-core/src/components/Icons/AntdEnhanced.tsx
b/superset-frontend/packages/superset-ui-core/src/components/Icons/AntdEnhanced.tsx
index b41f38597ae..0f9c0a33244 100644
---
a/superset-frontend/packages/superset-ui-core/src/components/Icons/AntdEnhanced.tsx
+++
b/superset-frontend/packages/superset-ui-core/src/components/Icons/AntdEnhanced.tsx
@@ -112,6 +112,7 @@ import {
PlusSquareOutlined,
PlusOutlined,
ProfileOutlined,
+ PushpinOutlined,
QuestionCircleOutlined,
ReloadOutlined,
RightOutlined,
@@ -263,6 +264,7 @@ const AntdIcons = {
PlusSquareOutlined,
PlusOutlined,
ProfileOutlined,
+ PushpinOutlined,
ReloadOutlined,
QuestionCircleOutlined,
RightOutlined,
diff --git
a/superset-frontend/src/SqlLab/components/TableExploreTree/TreeNodeRenderer.tsx
b/superset-frontend/src/SqlLab/components/TableExploreTree/TreeNodeRenderer.tsx
index 44eeb19d464..9f1b9fec345 100644
---
a/superset-frontend/src/SqlLab/components/TableExploreTree/TreeNodeRenderer.tsx
+++
b/superset-frontend/src/SqlLab/components/TableExploreTree/TreeNodeRenderer.tsx
@@ -226,7 +226,7 @@ const TreeNodeRenderer: React.FC<TreeNodeRendererProps> = ({
<IconButton
icon={
<Tooltip title={t('Pin to the result panel')}>
- <Icons.FolderAddOutlined iconSize="xl" />
+ <Icons.PushpinOutlined iconSize="xl" />
</Tooltip>
}
onClick={e => {
diff --git a/superset-frontend/src/SqlLab/components/TableExploreTree/index.tsx
b/superset-frontend/src/SqlLab/components/TableExploreTree/index.tsx
index 5bc2cf75f87..cb71b54e2b3 100644
--- a/superset-frontend/src/SqlLab/components/TableExploreTree/index.tsx
+++ b/superset-frontend/src/SqlLab/components/TableExploreTree/index.tsx
@@ -24,7 +24,7 @@ import {
useMemo,
} from 'react';
import { useSelector, useDispatch, shallowEqual } from 'react-redux';
-import { styled, t } from '@apache-superset/core';
+import { styled, css, t, useTheme } from '@apache-superset/core';
import AutoSizer from 'react-virtualized-auto-sizer';
// Due to performance issues with the virtual list in the existing Ant Design
(antd)-based tree view,
// it has been replaced with react-arborist solution.
@@ -109,6 +109,7 @@ const ROW_HEIGHT = 28;
const TableExploreTree: React.FC<Props> = ({ queryEditorId }) => {
const dispatch = useDispatch();
+ const theme = useTheme();
const treeRef = useRef<TreeApi<TreeNodeData>>(null);
const tables = useSelector(
({ sqlLab }: SqlLabRootState) => sqlLab.tables,
@@ -236,31 +237,38 @@ const TableExploreTree: React.FC<Props> = ({
queryEditorId }) => {
return (
<>
- <PanelToolbar
- viewId={ViewContribution.LeftSidebar}
- defaultPrimaryActions={
- <>
- <Button
- color="primary"
- variant="text"
- icon={<Icons.MinusSquareOutlined />}
- onClick={() => {
- treeRef.current?.closeAll();
- setManuallyOpenedNodes({});
- }}
- tooltip={t('Collapse all')}
- />
- <Button
- color="primary"
- variant="text"
- icon={<Icons.ReloadOutlined />}
- onClick={() => refetch()}
- loading={isFetching}
- tooltip={t('Force refresh schema list')}
- />
- </>
- }
- />
+ {/* Negative margin to align toolbar icons with other elements on the
screen */}
+ <div
+ css={css`
+ margin-left: -${theme.sizeUnit * 2}px;
+ `}
+ >
+ <PanelToolbar
+ viewId={ViewContribution.LeftSidebar}
+ defaultPrimaryActions={
+ <>
+ <Button
+ color="primary"
+ variant="text"
+ icon={<Icons.MinusSquareOutlined />}
+ onClick={() => {
+ treeRef.current?.closeAll();
+ setManuallyOpenedNodes({});
+ }}
+ tooltip={t('Collapse all')}
+ />
+ <Button
+ color="primary"
+ variant="text"
+ icon={<Icons.ReloadOutlined />}
+ onClick={() => refetch()}
+ loading={isFetching}
+ tooltip={t('Force refresh schema list')}
+ />
+ </>
+ }
+ />
+ </div>
<Input
allowClear
type="text"
@@ -268,6 +276,9 @@ const TableExploreTree: React.FC<Props> = ({ queryEditorId
}) => {
placeholder={t('Enter a part of the object name')}
onChange={handleSearchChange}
value={searchTerm}
+ css={css`
+ margin-bottom: 2px;
+ `}
/>
{errorPayload && (
<ErrorMessageWithStackTrace error={errorPayload} source="crud" />
diff --git a/superset-frontend/src/components/PanelToolbar/index.tsx
b/superset-frontend/src/components/PanelToolbar/index.tsx
index 7f88197811b..18144ae253a 100644
--- a/superset-frontend/src/components/PanelToolbar/index.tsx
+++ b/superset-frontend/src/components/PanelToolbar/index.tsx
@@ -110,7 +110,7 @@ const PanelToolbar = ({
const toolbarStyles = css`
display: flex;
align-items: center;
- gap: ${theme.sizeUnit * 2}px;
+ gap: ${theme.sizeUnit}px;
& .ant-divider {
height: ${theme.sizeUnit * 6}px;
diff --git a/superset-frontend/src/core/editors/AceEditorProvider.tsx
b/superset-frontend/src/core/editors/AceEditorProvider.tsx
index 6e18e3e0f36..c52d0f93332 100644
--- a/superset-frontend/src/core/editors/AceEditorProvider.tsx
+++ b/superset-frontend/src/core/editors/AceEditorProvider.tsx
@@ -251,18 +251,6 @@ const AceEditorProvider = forwardRef<EditorHandle,
EditorProps>(
// Track if event listeners have been registered to prevent duplicates
const listenersRegisteredRef = useRef(false);
- // Notify when ready (only once)
- useEffect(() => {
- if (
- onReady &&
- aceEditorRef.current?.editor &&
- !onReadyCalledRef.current
- ) {
- onReadyCalledRef.current = true;
- onReady(handle);
- }
- }, [onReady, handle]);
-
// Handle editor load
const onEditorLoad = useCallback(
(editor: AceEditor['editor']) => {
@@ -306,10 +294,16 @@ const AceEditorProvider = forwardRef<EditorHandle,
EditorProps>(
});
}
+ // Notify when ready (only once) - must be done here after editor is
loaded
+ if (onReady && !onReadyCalledRef.current) {
+ onReadyCalledRef.current = true;
+ onReady(handle);
+ }
+
// Focus the editor
editor.focus();
},
- [hotkeys, handle],
+ [hotkeys, handle, onReady],
);
// Handle blur
diff --git a/superset/sqllab/utils.py b/superset/sqllab/utils.py
index 5f179beccda..73576fdb749 100644
--- a/superset/sqllab/utils.py
+++ b/superset/sqllab/utils.py
@@ -90,6 +90,9 @@ def bootstrap_sqllab_data(user_id: int | None) -> dict[str,
Any]:
}
databases[database.id]["backend"] = database.backend
databases[database.id]["allow_multi_catalog"] =
database.allow_multi_catalog
+ databases[database.id]["allows_virtual_table_explore"] = (
+ database.allows_virtual_table_explore
+ )
# These are unnecessary if sqllab backend persistence is disabled
if is_feature_enabled("SQLLAB_BACKEND_PERSISTENCE"):