diff --git a/superset/assets/src/SqlLab/components/TabbedSqlEditors.jsx b/superset/assets/src/SqlLab/components/TabbedSqlEditors.jsx index da0d9d127..73c744822 100644 --- a/superset/assets/src/SqlLab/components/TabbedSqlEditors.jsx +++ b/superset/assets/src/SqlLab/components/TabbedSqlEditors.jsx @@ -41,6 +41,10 @@ class TabbedSqlEditors extends React.PureComponent { dataPreviewQueries: [], hideLeftBar: false, }; + this.removeQueryEditor = this.removeQueryEditor.bind(this); + this.renameTab = this.renameTab.bind(this); + this.toggleLeftBar = this.toggleLeftBar.bind(this); + this.removeAllOtherQueryEditors = this.removeAllOtherQueryEditors.bind(this); } componentDidMount() { const query = URI(window.location).search(true); @@ -152,6 +156,10 @@ class TabbedSqlEditors extends React.PureComponent { removeQueryEditor(qe) { this.props.actions.removeQueryEditor(qe); } + removeAllOtherQueryEditors(cqe) { + this.props.queryEditors + .forEach(qe => qe !== cqe && this.removeQueryEditor(qe)); + } toggleLeftBar() { this.setState({ hideLeftBar: !this.state.hideLeftBar }); } @@ -171,7 +179,7 @@ class TabbedSqlEditors extends React.PureComponent { const tabTitle = (