You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2022/04/27 03:12:56 UTC
[superset] branch master updated: feat: Update ShortKey for stop query running in SqlLab editor (#19692)
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 60e06c1692 feat: Update ShortKey for stop query running in SqlLab editor (#19692)
60e06c1692 is described below
commit 60e06c1692651d5434b69427843e2539f13f4431
Author: Smart-Codi <co...@gmail.com>
AuthorDate: Tue Apr 26 23:12:47 2022 -0400
feat: Update ShortKey for stop query running in SqlLab editor (#19692)
* feat: Update shortkey for stop query running in sqllab editor
* resolve comment
* fix invalid import useMemo
---
.../src/SqlLab/components/RunQueryActionButton/index.tsx | 15 +++++++++++++--
.../src/SqlLab/components/SqlEditor/index.jsx | 2 +-
superset/translations/de/LC_MESSAGES/messages.json | 1 +
superset/translations/en/LC_MESSAGES/messages.json | 1 +
superset/translations/es/LC_MESSAGES/messages.json | 1 +
superset/translations/fr/LC_MESSAGES/messages.json | 1 +
superset/translations/it/LC_MESSAGES/messages.json | 1 +
superset/translations/ja/LC_MESSAGES/messages.json | 1 +
superset/translations/ko/LC_MESSAGES/messages.json | 1 +
superset/translations/nl/LC_MESSAGES/messages.json | 1 +
superset/translations/pt/LC_MESSAGES/message.json | 1 +
superset/translations/pt_BR/LC_MESSAGES/messages.json | 1 +
superset/translations/ru/LC_MESSAGES/messages.json | 1 +
superset/translations/sk/LC_MESSAGES/messages.json | 1 +
superset/translations/sl/LC_MESSAGES/messages.json | 1 +
superset/translations/zh/LC_MESSAGES/messages.json | 1 +
16 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/superset-frontend/src/SqlLab/components/RunQueryActionButton/index.tsx b/superset-frontend/src/SqlLab/components/RunQueryActionButton/index.tsx
index 2a9e0fbaf8..9da467685b 100644
--- a/superset-frontend/src/SqlLab/components/RunQueryActionButton/index.tsx
+++ b/superset-frontend/src/SqlLab/components/RunQueryActionButton/index.tsx
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-import React from 'react';
+import React, { useMemo } from 'react';
import { t, styled, useTheme } from '@superset-ui/core';
import { Menu } from 'src/components/Menu';
@@ -26,6 +26,7 @@ import {
DropdownButton,
DropdownButtonProps,
} from 'src/components/DropdownButton';
+import { detectOS } from 'src/utils/common';
interface Props {
allowAsync: boolean;
@@ -95,6 +96,8 @@ const RunQueryActionButton = ({
}: Props) => {
const theme = useTheme();
+ const userOS = detectOS();
+
const shouldShowStopBtn =
!!queryState && ['running', 'pending'].indexOf(queryState) > -1;
@@ -104,6 +107,14 @@ const RunQueryActionButton = ({
const isDisabled = !sql.trim();
+ const stopButtonTooltipText = useMemo(
+ () =>
+ userOS === 'MacOS'
+ ? t('Stop running (Ctrl + x)')
+ : t('Stop running (Ctrl + e)'),
+ [userOS],
+ );
+
return (
<StyledButton>
<ButtonComponent
@@ -114,7 +125,7 @@ const RunQueryActionButton = ({
tooltip={
(!isDisabled &&
(shouldShowStopBtn
- ? t('Stop running (Ctrl + x)')
+ ? stopButtonTooltipText
: t('Run query (Ctrl + Return)'))) as string
}
cta
diff --git a/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx b/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
index df1a9a77c5..76f54696d8 100644
--- a/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
+++ b/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
@@ -357,7 +357,7 @@ class SqlEditor extends React.PureComponent {
},
{
name: 'stopQuery',
- key: 'ctrl+x',
+ key: userOS === 'MacOS' ? 'ctrl+x' : 'ctrl+e',
descr: t('Stop query'),
func: this.stopQuery,
},
diff --git a/superset/translations/de/LC_MESSAGES/messages.json b/superset/translations/de/LC_MESSAGES/messages.json
index 81b02949dd..98cd4e6947 100644
--- a/superset/translations/de/LC_MESSAGES/messages.json
+++ b/superset/translations/de/LC_MESSAGES/messages.json
@@ -3653,6 +3653,7 @@
"Stop": ["Stopp"],
"Stop query": ["Abfrage anhalten"],
"Stop running (Ctrl + x)": ["Ausführung abbrechen (Strg + x)"],
+ "Stop running (Ctrl + e)": ["Ausführung abbrechen (Strg + e)"],
"Stopped an unsafe database connection": [
"Eine unsichere Datenbankverbindung wurde beendet"
],
diff --git a/superset/translations/en/LC_MESSAGES/messages.json b/superset/translations/en/LC_MESSAGES/messages.json
index 7e74c204af..912c9fde70 100644
--- a/superset/translations/en/LC_MESSAGES/messages.json
+++ b/superset/translations/en/LC_MESSAGES/messages.json
@@ -985,6 +985,7 @@
"Run selection": [""],
"Run": [""],
"Stop running (Ctrl + x)": [""],
+ "Stop running (Ctrl + e)": [""],
"Run query (Ctrl + Return)": [""],
"Save & Explore": [""],
"Overwrite & Explore": [""],
diff --git a/superset/translations/es/LC_MESSAGES/messages.json b/superset/translations/es/LC_MESSAGES/messages.json
index ba0f1642f6..a7f2a4738b 100644
--- a/superset/translations/es/LC_MESSAGES/messages.json
+++ b/superset/translations/es/LC_MESSAGES/messages.json
@@ -1432,6 +1432,7 @@
"Run selection": ["Probar Conexión"],
"Run": ["Ejecutar"],
"Stop running (Ctrl + x)": ["Detener (Ctrl + x)"],
+ "Stop running (Ctrl + e)": ["Detener (Ctrl + e)"],
"Run query (Ctrl + Return)": ["Ejecutar consulta (Ctrl + Enter)"],
"Save & Explore": ["Guardar y Explorar"],
"Overwrite & Explore": ["Sobreescribir y Explorar"],
diff --git a/superset/translations/fr/LC_MESSAGES/messages.json b/superset/translations/fr/LC_MESSAGES/messages.json
index 1652dc82f9..ddcf3d746d 100644
--- a/superset/translations/fr/LC_MESSAGES/messages.json
+++ b/superset/translations/fr/LC_MESSAGES/messages.json
@@ -1898,6 +1898,7 @@
"Run selection": ["Exécuter la sélection"],
"Run": ["Exécuter"],
"Stop running (Ctrl + x)": ["Arrêter l'exécution (Ctrl + x)"],
+ "Stop running (Ctrl + e)": ["Arrêter l'exécution (Ctrl + e)"],
"Run query (Ctrl + Return)": ["Exécuter la requête (Ctrl + Return)"],
"Save & Explore": ["Sauver et explorer"],
"Overwrite & Explore": ["Modifier et explorer"],
diff --git a/superset/translations/it/LC_MESSAGES/messages.json b/superset/translations/it/LC_MESSAGES/messages.json
index 17573079b2..3ae239dce5 100644
--- a/superset/translations/it/LC_MESSAGES/messages.json
+++ b/superset/translations/it/LC_MESSAGES/messages.json
@@ -1066,6 +1066,7 @@
"Run selection": ["Seleziona una colonna"],
"Run": [""],
"Stop running (Ctrl + x)": [""],
+ "Stop running (Ctrl + e)": [""],
"Run query (Ctrl + Return)": [""],
"Save & Explore": ["Salva una slice"],
"Overwrite & Explore": ["Sovrascrivi la slice %s"],
diff --git a/superset/translations/ja/LC_MESSAGES/messages.json b/superset/translations/ja/LC_MESSAGES/messages.json
index ac886ef463..d0f2f9b93f 100644
--- a/superset/translations/ja/LC_MESSAGES/messages.json
+++ b/superset/translations/ja/LC_MESSAGES/messages.json
@@ -1300,6 +1300,7 @@
"Run selection": [""],
"Run": ["実行"],
"Stop running (Ctrl + x)": ["実行を停止 (Ctrl + x)"],
+ "Stop running (Ctrl + e)": ["実行を停止 (Ctrl + e)"],
"Run query (Ctrl + Return)": ["クエリを実行 (Ctrl + Return)"],
"Save & Explore": [""],
"Overwrite & Explore": [""],
diff --git a/superset/translations/ko/LC_MESSAGES/messages.json b/superset/translations/ko/LC_MESSAGES/messages.json
index 04b4f191a0..3949e99ed6 100644
--- a/superset/translations/ko/LC_MESSAGES/messages.json
+++ b/superset/translations/ko/LC_MESSAGES/messages.json
@@ -1105,6 +1105,7 @@
"Run selection": [""],
"Run": [""],
"Stop running (Ctrl + x)": [""],
+ "Stop running (Ctrl + e)": [""],
"Run query (Ctrl + Return)": [""],
"Save & Explore": [""],
"Overwrite & Explore": [""],
diff --git a/superset/translations/nl/LC_MESSAGES/messages.json b/superset/translations/nl/LC_MESSAGES/messages.json
index 5f0f985132..19ab66a085 100644
--- a/superset/translations/nl/LC_MESSAGES/messages.json
+++ b/superset/translations/nl/LC_MESSAGES/messages.json
@@ -3065,6 +3065,7 @@
"Run selection": ["Selectie uitvoeren"],
"Run": ["Uitvoeren"],
"Stop running (Ctrl + x)": ["Stop de uitvoering (Ctrl + x)"],
+ "Stop running (Ctrl + e)": ["Stop de uitvoering (Ctrl + e)"],
"Run query (Ctrl + Return)": ["Query uitvoeren (Ctrl + Return)"],
"Save & Explore": ["Opslaan en verkennen"],
"Overwrite & Explore": ["Overschrijven en verkennen"],
diff --git a/superset/translations/pt/LC_MESSAGES/message.json b/superset/translations/pt/LC_MESSAGES/message.json
index 491bf8a5e7..9ea04398fb 100644
--- a/superset/translations/pt/LC_MESSAGES/message.json
+++ b/superset/translations/pt/LC_MESSAGES/message.json
@@ -1148,6 +1148,7 @@
"Run Selection": ["Executar a query selecionada"],
"Run": [""],
"Stop running (Ctrl + x)": [""],
+ "Stop running (Ctrl + e)": [""],
"Run query (Ctrl + Return)": [""],
"Save & Explore": ["Grave uma visualização"],
"Overwrite & Explore": ["Substitua a visualização %s"],
diff --git a/superset/translations/pt_BR/LC_MESSAGES/messages.json b/superset/translations/pt_BR/LC_MESSAGES/messages.json
index 5dd86d91c1..370a179c4d 100644
--- a/superset/translations/pt_BR/LC_MESSAGES/messages.json
+++ b/superset/translations/pt_BR/LC_MESSAGES/messages.json
@@ -1445,6 +1445,7 @@
"Run selection": ["Executar seleção"],
"Run": ["Executar"],
"Stop running (Ctrl + x)": ["Parar execução (Ctrl + x)"],
+ "Stop running (Ctrl + e)": ["Parar execução (Ctrl + e)"],
"Run query (Ctrl + Return)": ["Executar query (Ctrl + Return)"],
"Save & Explore": ["Salvar e explorar"],
"Overwrite & Explore": ["Sobrescrever & explorar"],
diff --git a/superset/translations/ru/LC_MESSAGES/messages.json b/superset/translations/ru/LC_MESSAGES/messages.json
index 713ea6c2da..c100ba7f66 100644
--- a/superset/translations/ru/LC_MESSAGES/messages.json
+++ b/superset/translations/ru/LC_MESSAGES/messages.json
@@ -1347,6 +1347,7 @@
"Run selection": ["Выполнить выбранный запрос"],
"Run": ["Выполнить"],
"Stop running (Ctrl + x)": ["Остановить (Ctrl + x)"],
+ "Stop running (Ctrl + e)": ["Остановить (Ctrl + e)"],
"Run query (Ctrl + Return)": ["Выполнить запрос (Ctrl + Return)"],
"Save & Explore": ["Сохранить и исследовать"],
"Overwrite & Explore": ["Перезаписать и исследовать"],
diff --git a/superset/translations/sk/LC_MESSAGES/messages.json b/superset/translations/sk/LC_MESSAGES/messages.json
index b47c025ea0..ba2b175e20 100644
--- a/superset/translations/sk/LC_MESSAGES/messages.json
+++ b/superset/translations/sk/LC_MESSAGES/messages.json
@@ -1146,6 +1146,7 @@
"Run selection": [""],
"Run": [""],
"Stop running (Ctrl + x)": [""],
+ "Stop running (Ctrl + e)": [""],
"Run query (Ctrl + Return)": [""],
"Save & Explore": [""],
"Overwrite & Explore": [""],
diff --git a/superset/translations/sl/LC_MESSAGES/messages.json b/superset/translations/sl/LC_MESSAGES/messages.json
index 7c43418105..c5ac73ad0c 100644
--- a/superset/translations/sl/LC_MESSAGES/messages.json
+++ b/superset/translations/sl/LC_MESSAGES/messages.json
@@ -1858,6 +1858,7 @@
"Run selection": ["Zaženi izbrano"],
"Run": ["Zaženi"],
"Stop running (Ctrl + x)": ["Ustavi (Ctrl + x)"],
+ "Stop running (Ctrl + e)": ["Ustavi (Ctrl + e)"],
"Run query (Ctrl + Return)": ["Zaženi poizvedbo (Ctrl + Return)"],
"Save & Explore": ["Shrani & Razišči"],
"Overwrite & Explore": ["Prepiši & Razišči"],
diff --git a/superset/translations/zh/LC_MESSAGES/messages.json b/superset/translations/zh/LC_MESSAGES/messages.json
index 3c09c4a3d5..8d803b45ab 100644
--- a/superset/translations/zh/LC_MESSAGES/messages.json
+++ b/superset/translations/zh/LC_MESSAGES/messages.json
@@ -1204,6 +1204,7 @@
"Run selection": ["运行选定的查询"],
"Run": ["执行"],
"Stop running (Ctrl + x)": ["停止运行 (Ctrl + x)"],
+ "Stop running (Ctrl + e)": ["停止运行 (Ctrl + e)"],
"Run query (Ctrl + Return)": ["执行运行 (Ctrl + Return)"],
"Save & Explore": ["保存和浏览"],
"Overwrite & Explore": ["覆写和浏览"],