From 98dc65722ca6f45358a5a68a91af46420207d12e Mon Sep 17 00:00:00 2001 From: Kasia Kucharczyk <2536609+kkucharc@users.noreply.github.com> Date: Fri, 4 Dec 2020 19:45:43 +0100 Subject: [PATCH] Added check if SQL query is empty and disable shortcut for run query (#11877) --- .../src/SqlLab/components/SqlEditor.jsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/SqlLab/components/SqlEditor.jsx b/superset-frontend/src/SqlLab/components/SqlEditor.jsx index 689c4c46f3..044fee86ae 100644 --- a/superset-frontend/src/SqlLab/components/SqlEditor.jsx +++ b/superset-frontend/src/SqlLab/components/SqlEditor.jsx @@ -199,13 +199,21 @@ class SqlEditor extends React.PureComponent { name: 'runQuery1', key: 'ctrl+r', descr: t('Run query'), - func: this.runQuery, + func: () => { + if (this.state.sql.trim() !== '') { + this.runQuery(); + } + }, }, { name: 'runQuery2', key: 'ctrl+enter', descr: t('Run query'), - func: this.runQuery, + func: () => { + if (this.state.sql.trim() !== '') { + this.runQuery(); + } + }, }, { name: 'newTab',