mirror of
https://github.com/apache/superset.git
synced 2026-07-18 20:55:47 +00:00
fix(sqllab): collapse left sidebar shows compact db selector in top bar (#41898)
This commit is contained in:
@@ -956,12 +956,24 @@ export function setActiveSouthPaneTab(tabId: string): SqlLabAction {
|
||||
return { type: SET_ACTIVE_SOUTHPANE_TAB, tabId };
|
||||
}
|
||||
|
||||
export function toggleLeftBar(queryEditor: QueryEditor): SqlLabAction {
|
||||
const hideLeftBar = !queryEditor.hideLeftBar;
|
||||
return {
|
||||
type: QUERY_EDITOR_TOGGLE_LEFT_BAR,
|
||||
queryEditor,
|
||||
hideLeftBar,
|
||||
export function toggleLeftBar(shouldHide: boolean): SqlLabThunkAction {
|
||||
return (dispatch: AppDispatch, getState: GetState) => {
|
||||
const { sqlLab } = getState();
|
||||
const id = sqlLab.tabHistory.slice(-1)[0];
|
||||
if (!id) return;
|
||||
const qe = sqlLab.queryEditors.find(e => e.id === id);
|
||||
const merged =
|
||||
qe && sqlLab.unsavedQueryEditor?.id === id
|
||||
? { ...qe, ...sqlLab.unsavedQueryEditor }
|
||||
: qe;
|
||||
if (!merged) return;
|
||||
const isCurrentlyHidden = Boolean(merged.hideLeftBar);
|
||||
if (shouldHide === isCurrentlyHidden) return;
|
||||
dispatch({
|
||||
type: QUERY_EDITOR_TOGGLE_LEFT_BAR,
|
||||
queryEditorId: id,
|
||||
hideLeftBar: shouldHide,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user