mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
chore(sqllab): refactor addQueryEditor for new tab (#21711)
This commit is contained in:
@@ -32,6 +32,7 @@ import {
|
||||
} from 'src/components/MessageToasts/actions';
|
||||
import { getClientErrorObject } from 'src/utils/getClientErrorObject';
|
||||
import COMMON_ERR_MESSAGES from 'src/utils/errorMessages';
|
||||
import { newQueryTabName } from '../utils/newQueryTabName';
|
||||
|
||||
export const RESET_STATE = 'RESET_STATE';
|
||||
export const ADD_QUERY_EDITOR = 'ADD_QUERY_EDITOR';
|
||||
@@ -590,6 +591,22 @@ export function addQueryEditor(queryEditor) {
|
||||
};
|
||||
}
|
||||
|
||||
export function addNewQueryEditor(queryEditor) {
|
||||
return function (dispatch, getState) {
|
||||
const {
|
||||
sqlLab: { queryEditors },
|
||||
} = getState();
|
||||
const name = newQueryTabName(queryEditors || []);
|
||||
|
||||
return dispatch(
|
||||
addQueryEditor({
|
||||
...queryEditor,
|
||||
name,
|
||||
}),
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
export function cloneQueryToNewTab(query, autorun) {
|
||||
return function (dispatch, getState) {
|
||||
const state = getState();
|
||||
|
||||
Reference in New Issue
Block a user