mirror of
https://github.com/apache/superset.git
synced 2026-04-22 01:24:43 +00:00
chore(sqllab): refactor addQueryEditor for new tab (#21711)
This commit is contained in:
@@ -37,7 +37,7 @@ import { Menu } from 'src/components/Menu';
|
||||
import Icons from 'src/components/Icons';
|
||||
import { detectOS } from 'src/utils/common';
|
||||
import {
|
||||
addQueryEditor,
|
||||
addNewQueryEditor,
|
||||
CtasEnum,
|
||||
estimateQueryCost,
|
||||
persistEditorHeight,
|
||||
@@ -84,7 +84,6 @@ import ShareSqlLabQuery from '../ShareSqlLabQuery';
|
||||
import SqlEditorLeftBar from '../SqlEditorLeftBar';
|
||||
import AceEditorWrapper from '../AceEditorWrapper';
|
||||
import RunQueryActionButton from '../RunQueryActionButton';
|
||||
import { newQueryTabName } from '../../utils/newQueryTabName';
|
||||
import QueryLimitSelect from '../QueryLimitSelect';
|
||||
|
||||
const appContainer = document.getElementById('app');
|
||||
@@ -179,8 +178,6 @@ const SqlEditor = ({
|
||||
},
|
||||
);
|
||||
|
||||
const queryEditors = useSelector(({ sqlLab }) => sqlLab.queryEditors);
|
||||
|
||||
const [height, setHeight] = useState(0);
|
||||
const [autorun, setAutorun] = useState(queryEditor.autorun);
|
||||
const [ctas, setCtas] = useState('');
|
||||
@@ -274,13 +271,7 @@ const SqlEditor = ({
|
||||
key: userOS === 'Windows' ? 'ctrl+q' : 'ctrl+t',
|
||||
descr: t('New tab'),
|
||||
func: () => {
|
||||
const name = newQueryTabName(queryEditors || []);
|
||||
dispatch(
|
||||
addQueryEditor({
|
||||
...queryEditor,
|
||||
name,
|
||||
}),
|
||||
);
|
||||
dispatch(addNewQueryEditor(queryEditor));
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user