diff --git a/superset/assets/spec/javascripts/sqllab/actions/sqlLab_spec.js b/superset/assets/spec/javascripts/sqllab/actions/sqlLab_spec.js index cb8c3b491ca..306a5f9777a 100644 --- a/superset/assets/spec/javascripts/sqllab/actions/sqlLab_spec.js +++ b/superset/assets/spec/javascripts/sqllab/actions/sqlLab_spec.js @@ -278,7 +278,7 @@ describe('async actions', () => { id: 'abcd', }, }]; - return store.dispatch(actions.cloneQueryToNewTab(query)).then(() => { + return store.dispatch(actions.cloneQueryToNewTab(query, true)).then(() => { expect(store.getActions()).toEqual(expectedActions); }); }); diff --git a/superset/assets/src/SqlLab/actions/sqlLab.js b/superset/assets/src/SqlLab/actions/sqlLab.js index 25f882df572..b1d8c7d6ec4 100644 --- a/superset/assets/src/SqlLab/actions/sqlLab.js +++ b/superset/assets/src/SqlLab/actions/sqlLab.js @@ -445,7 +445,7 @@ export function addQueryEditor(queryEditor) { }; } -export function cloneQueryToNewTab(query) { +export function cloneQueryToNewTab(query, autorun) { return function (dispatch, getState) { const state = getState(); const { queryEditors, tabHistory } = state.sqlLab; @@ -454,7 +454,7 @@ export function cloneQueryToNewTab(query) { title: t('Copy of %s', sourceQueryEditor.title), dbId: query.dbId ? query.dbId : null, schema: query.schema ? query.schema : null, - autorun: true, + autorun, sql: query.sql, queryLimit: sourceQueryEditor.queryLimit, maxRow: sourceQueryEditor.maxRow, diff --git a/superset/assets/src/SqlLab/components/QueryTable.jsx b/superset/assets/src/SqlLab/components/QueryTable.jsx index 983d8cfcca4..67a10042b5c 100644 --- a/superset/assets/src/SqlLab/components/QueryTable.jsx +++ b/superset/assets/src/SqlLab/components/QueryTable.jsx @@ -80,7 +80,7 @@ class QueryTable extends React.PureComponent { } openQueryInNewTab(query) { - this.props.actions.cloneQueryToNewTab(query); + this.props.actions.cloneQueryToNewTab(query, true); } openAsyncResults(query, displayLimit) { this.props.actions.fetchQueryResults(query, displayLimit); diff --git a/superset/assets/src/SqlLab/components/TabbedSqlEditors.jsx b/superset/assets/src/SqlLab/components/TabbedSqlEditors.jsx index 0ee19ffb617..90f6eb9db9c 100644 --- a/superset/assets/src/SqlLab/components/TabbedSqlEditors.jsx +++ b/superset/assets/src/SqlLab/components/TabbedSqlEditors.jsx @@ -218,7 +218,7 @@ class TabbedSqlEditors extends React.PureComponent { .forEach(qe => qe !== cqe && this.removeQueryEditor(qe)); } duplicateQueryEditor(qe) { - this.props.actions.cloneQueryToNewTab(qe); + this.props.actions.cloneQueryToNewTab(qe, false); } toggleLeftBar() { this.setState({ hideLeftBar: !this.state.hideLeftBar });