Do not autorun query on tab duplicate (#8577)

* Pass autorun argument to cloneQueryToNewTab

* Accept autorun argument

* Fix unit test
This commit is contained in:
Beto Dealmeida 2019-11-14 17:08:03 -08:00 committed by GitHub
parent 26c55bd57a
commit 9044f210ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View File

@ -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);
});
});

View File

@ -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,

View File

@ -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);

View File

@ -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 });