Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update ShortKey for stop query running in SqlLab editor #19692

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -26,6 +26,7 @@ import {
DropdownButton,
DropdownButtonProps,
} from 'src/components/DropdownButton';
import { detectOS } from 'src/utils/common';

interface Props {
allowAsync: boolean;
Expand Down Expand Up @@ -95,6 +96,8 @@ const RunQueryActionButton = ({
}: Props) => {
const theme = useTheme();

const userOS = detectOS();

const shouldShowStopBtn =
!!queryState && ['running', 'pending'].indexOf(queryState) > -1;

Expand All @@ -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
Expand All @@ -114,7 +125,7 @@ const RunQueryActionButton = ({
tooltip={
(!isDisabled &&
(shouldShowStopBtn
? t('Stop running (Ctrl + x)')
? stopButtonTooltipText
: t('Run query (Ctrl + Return)'))) as string
}
cta
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
1 change: 1 addition & 0 deletions superset/translations/de/LC_MESSAGES/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
],
Expand Down
1 change: 1 addition & 0 deletions superset/translations/en/LC_MESSAGES/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,7 @@
"Run selection": [""],
"Run": [""],
"Stop running (Ctrl + x)": [""],
"Stop running (Ctrl + e)": [""],
"Run query (Ctrl + Return)": [""],
"Save & Explore": [""],
"Overwrite & Explore": [""],
Expand Down
1 change: 1 addition & 0 deletions superset/translations/es/LC_MESSAGES/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
1 change: 1 addition & 0 deletions superset/translations/fr/LC_MESSAGES/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
1 change: 1 addition & 0 deletions superset/translations/it/LC_MESSAGES/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
1 change: 1 addition & 0 deletions superset/translations/ja/LC_MESSAGES/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [""],
Expand Down
1 change: 1 addition & 0 deletions superset/translations/ko/LC_MESSAGES/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,7 @@
"Run selection": [""],
"Run": [""],
"Stop running (Ctrl + x)": [""],
"Stop running (Ctrl + e)": [""],
"Run query (Ctrl + Return)": [""],
"Save & Explore": [""],
"Overwrite & Explore": [""],
Expand Down
1 change: 1 addition & 0 deletions superset/translations/nl/LC_MESSAGES/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
1 change: 1 addition & 0 deletions superset/translations/pt/LC_MESSAGES/message.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
1 change: 1 addition & 0 deletions superset/translations/pt_BR/LC_MESSAGES/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
1 change: 1 addition & 0 deletions superset/translations/ru/LC_MESSAGES/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": ["Перезаписать и исследовать"],
Expand Down
1 change: 1 addition & 0 deletions superset/translations/sk/LC_MESSAGES/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,7 @@
"Run selection": [""],
"Run": [""],
"Stop running (Ctrl + x)": [""],
"Stop running (Ctrl + e)": [""],
"Run query (Ctrl + Return)": [""],
"Save & Explore": [""],
"Overwrite & Explore": [""],
Expand Down
1 change: 1 addition & 0 deletions superset/translations/sl/LC_MESSAGES/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
1 change: 1 addition & 0 deletions superset/translations/zh/LC_MESSAGES/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": ["覆写和浏览"],
Expand Down