mirror of
https://github.com/apache/superset.git
synced 2026-04-21 17:14:57 +00:00
fix: sql lab ctrl t behaved differently from clicking (#19420)
* initial approach To have consistent behaviour when creating a new tab with ctrl+t * consistent behaviour when creating tabs * fixed bug and added tests * updates to pass checks
This commit is contained in:
@@ -75,6 +75,7 @@ import ShareSqlLabQuery from '../ShareSqlLabQuery';
|
||||
import SqlEditorLeftBar from '../SqlEditorLeftBar';
|
||||
import AceEditorWrapper from '../AceEditorWrapper';
|
||||
import RunQueryActionButton from '../RunQueryActionButton';
|
||||
import { newQueryTabName } from '../../utils/newQueryTabName';
|
||||
|
||||
const LIMIT_DROPDOWN = [10, 100, 1000, 10000, 100000];
|
||||
const SQL_EDITOR_PADDING = 10;
|
||||
@@ -333,10 +334,10 @@ class SqlEditor extends React.PureComponent {
|
||||
key: userOS === 'Windows' ? 'ctrl+q' : 'ctrl+t',
|
||||
descr: t('New tab'),
|
||||
func: () => {
|
||||
const title = newQueryTabName(this.props.queryEditors || []);
|
||||
this.props.addQueryEditor({
|
||||
...this.props.queryEditor,
|
||||
title: t('Untitled query'),
|
||||
sql: '',
|
||||
title,
|
||||
});
|
||||
},
|
||||
},
|
||||
@@ -804,13 +805,12 @@ class SqlEditor extends React.PureComponent {
|
||||
SqlEditor.defaultProps = defaultProps;
|
||||
SqlEditor.propTypes = propTypes;
|
||||
|
||||
function mapStateToProps(state, props) {
|
||||
const { sqlLab } = state;
|
||||
function mapStateToProps({ sqlLab }, props) {
|
||||
const queryEditor = sqlLab.queryEditors.find(
|
||||
editor => editor.id === props.queryEditorId,
|
||||
);
|
||||
|
||||
return { sqlLab, ...props, queryEditor };
|
||||
return { sqlLab, ...props, queryEditor, queryEditors: sqlLab.queryEditors };
|
||||
}
|
||||
|
||||
function mapDispatchToProps(dispatch) {
|
||||
|
||||
Reference in New Issue
Block a user