mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
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
This commit is contained in:
parent
1d043e53d0
commit
60e06c1692
@ -16,7 +16,7 @@
|
|||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import React from 'react';
|
import React, { useMemo } from 'react';
|
||||||
import { t, styled, useTheme } from '@superset-ui/core';
|
import { t, styled, useTheme } from '@superset-ui/core';
|
||||||
|
|
||||||
import { Menu } from 'src/components/Menu';
|
import { Menu } from 'src/components/Menu';
|
||||||
@ -26,6 +26,7 @@ import {
|
|||||||
DropdownButton,
|
DropdownButton,
|
||||||
DropdownButtonProps,
|
DropdownButtonProps,
|
||||||
} from 'src/components/DropdownButton';
|
} from 'src/components/DropdownButton';
|
||||||
|
import { detectOS } from 'src/utils/common';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
allowAsync: boolean;
|
allowAsync: boolean;
|
||||||
@ -95,6 +96,8 @@ const RunQueryActionButton = ({
|
|||||||
}: Props) => {
|
}: Props) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
|
const userOS = detectOS();
|
||||||
|
|
||||||
const shouldShowStopBtn =
|
const shouldShowStopBtn =
|
||||||
!!queryState && ['running', 'pending'].indexOf(queryState) > -1;
|
!!queryState && ['running', 'pending'].indexOf(queryState) > -1;
|
||||||
|
|
||||||
@ -104,6 +107,14 @@ const RunQueryActionButton = ({
|
|||||||
|
|
||||||
const isDisabled = !sql.trim();
|
const isDisabled = !sql.trim();
|
||||||
|
|
||||||
|
const stopButtonTooltipText = useMemo(
|
||||||
|
() =>
|
||||||
|
userOS === 'MacOS'
|
||||||
|
? t('Stop running (Ctrl + x)')
|
||||||
|
: t('Stop running (Ctrl + e)'),
|
||||||
|
[userOS],
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledButton>
|
<StyledButton>
|
||||||
<ButtonComponent
|
<ButtonComponent
|
||||||
@ -114,7 +125,7 @@ const RunQueryActionButton = ({
|
|||||||
tooltip={
|
tooltip={
|
||||||
(!isDisabled &&
|
(!isDisabled &&
|
||||||
(shouldShowStopBtn
|
(shouldShowStopBtn
|
||||||
? t('Stop running (Ctrl + x)')
|
? stopButtonTooltipText
|
||||||
: t('Run query (Ctrl + Return)'))) as string
|
: t('Run query (Ctrl + Return)'))) as string
|
||||||
}
|
}
|
||||||
cta
|
cta
|
||||||
|
@ -357,7 +357,7 @@ class SqlEditor extends React.PureComponent {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'stopQuery',
|
name: 'stopQuery',
|
||||||
key: 'ctrl+x',
|
key: userOS === 'MacOS' ? 'ctrl+x' : 'ctrl+e',
|
||||||
descr: t('Stop query'),
|
descr: t('Stop query'),
|
||||||
func: this.stopQuery,
|
func: this.stopQuery,
|
||||||
},
|
},
|
||||||
|
@ -3653,6 +3653,7 @@
|
|||||||
"Stop": ["Stopp"],
|
"Stop": ["Stopp"],
|
||||||
"Stop query": ["Abfrage anhalten"],
|
"Stop query": ["Abfrage anhalten"],
|
||||||
"Stop running (Ctrl + x)": ["Ausführung abbrechen (Strg + x)"],
|
"Stop running (Ctrl + x)": ["Ausführung abbrechen (Strg + x)"],
|
||||||
|
"Stop running (Ctrl + e)": ["Ausführung abbrechen (Strg + e)"],
|
||||||
"Stopped an unsafe database connection": [
|
"Stopped an unsafe database connection": [
|
||||||
"Eine unsichere Datenbankverbindung wurde beendet"
|
"Eine unsichere Datenbankverbindung wurde beendet"
|
||||||
],
|
],
|
||||||
|
@ -985,6 +985,7 @@
|
|||||||
"Run selection": [""],
|
"Run selection": [""],
|
||||||
"Run": [""],
|
"Run": [""],
|
||||||
"Stop running (Ctrl + x)": [""],
|
"Stop running (Ctrl + x)": [""],
|
||||||
|
"Stop running (Ctrl + e)": [""],
|
||||||
"Run query (Ctrl + Return)": [""],
|
"Run query (Ctrl + Return)": [""],
|
||||||
"Save & Explore": [""],
|
"Save & Explore": [""],
|
||||||
"Overwrite & Explore": [""],
|
"Overwrite & Explore": [""],
|
||||||
|
@ -1432,6 +1432,7 @@
|
|||||||
"Run selection": ["Probar Conexión"],
|
"Run selection": ["Probar Conexión"],
|
||||||
"Run": ["Ejecutar"],
|
"Run": ["Ejecutar"],
|
||||||
"Stop running (Ctrl + x)": ["Detener (Ctrl + x)"],
|
"Stop running (Ctrl + x)": ["Detener (Ctrl + x)"],
|
||||||
|
"Stop running (Ctrl + e)": ["Detener (Ctrl + e)"],
|
||||||
"Run query (Ctrl + Return)": ["Ejecutar consulta (Ctrl + Enter)"],
|
"Run query (Ctrl + Return)": ["Ejecutar consulta (Ctrl + Enter)"],
|
||||||
"Save & Explore": ["Guardar y Explorar"],
|
"Save & Explore": ["Guardar y Explorar"],
|
||||||
"Overwrite & Explore": ["Sobreescribir y Explorar"],
|
"Overwrite & Explore": ["Sobreescribir y Explorar"],
|
||||||
|
@ -1898,6 +1898,7 @@
|
|||||||
"Run selection": ["Exécuter la sélection"],
|
"Run selection": ["Exécuter la sélection"],
|
||||||
"Run": ["Exécuter"],
|
"Run": ["Exécuter"],
|
||||||
"Stop running (Ctrl + x)": ["Arrêter l'exécution (Ctrl + x)"],
|
"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)"],
|
"Run query (Ctrl + Return)": ["Exécuter la requête (Ctrl + Return)"],
|
||||||
"Save & Explore": ["Sauver et explorer"],
|
"Save & Explore": ["Sauver et explorer"],
|
||||||
"Overwrite & Explore": ["Modifier et explorer"],
|
"Overwrite & Explore": ["Modifier et explorer"],
|
||||||
|
@ -1066,6 +1066,7 @@
|
|||||||
"Run selection": ["Seleziona una colonna"],
|
"Run selection": ["Seleziona una colonna"],
|
||||||
"Run": [""],
|
"Run": [""],
|
||||||
"Stop running (Ctrl + x)": [""],
|
"Stop running (Ctrl + x)": [""],
|
||||||
|
"Stop running (Ctrl + e)": [""],
|
||||||
"Run query (Ctrl + Return)": [""],
|
"Run query (Ctrl + Return)": [""],
|
||||||
"Save & Explore": ["Salva una slice"],
|
"Save & Explore": ["Salva una slice"],
|
||||||
"Overwrite & Explore": ["Sovrascrivi la slice %s"],
|
"Overwrite & Explore": ["Sovrascrivi la slice %s"],
|
||||||
|
@ -1300,6 +1300,7 @@
|
|||||||
"Run selection": [""],
|
"Run selection": [""],
|
||||||
"Run": ["実行"],
|
"Run": ["実行"],
|
||||||
"Stop running (Ctrl + x)": ["実行を停止 (Ctrl + x)"],
|
"Stop running (Ctrl + x)": ["実行を停止 (Ctrl + x)"],
|
||||||
|
"Stop running (Ctrl + e)": ["実行を停止 (Ctrl + e)"],
|
||||||
"Run query (Ctrl + Return)": ["クエリを実行 (Ctrl + Return)"],
|
"Run query (Ctrl + Return)": ["クエリを実行 (Ctrl + Return)"],
|
||||||
"Save & Explore": [""],
|
"Save & Explore": [""],
|
||||||
"Overwrite & Explore": [""],
|
"Overwrite & Explore": [""],
|
||||||
|
@ -1105,6 +1105,7 @@
|
|||||||
"Run selection": [""],
|
"Run selection": [""],
|
||||||
"Run": [""],
|
"Run": [""],
|
||||||
"Stop running (Ctrl + x)": [""],
|
"Stop running (Ctrl + x)": [""],
|
||||||
|
"Stop running (Ctrl + e)": [""],
|
||||||
"Run query (Ctrl + Return)": [""],
|
"Run query (Ctrl + Return)": [""],
|
||||||
"Save & Explore": [""],
|
"Save & Explore": [""],
|
||||||
"Overwrite & Explore": [""],
|
"Overwrite & Explore": [""],
|
||||||
|
@ -3065,6 +3065,7 @@
|
|||||||
"Run selection": ["Selectie uitvoeren"],
|
"Run selection": ["Selectie uitvoeren"],
|
||||||
"Run": ["Uitvoeren"],
|
"Run": ["Uitvoeren"],
|
||||||
"Stop running (Ctrl + x)": ["Stop de uitvoering (Ctrl + x)"],
|
"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)"],
|
"Run query (Ctrl + Return)": ["Query uitvoeren (Ctrl + Return)"],
|
||||||
"Save & Explore": ["Opslaan en verkennen"],
|
"Save & Explore": ["Opslaan en verkennen"],
|
||||||
"Overwrite & Explore": ["Overschrijven en verkennen"],
|
"Overwrite & Explore": ["Overschrijven en verkennen"],
|
||||||
|
@ -1148,6 +1148,7 @@
|
|||||||
"Run Selection": ["Executar a query selecionada"],
|
"Run Selection": ["Executar a query selecionada"],
|
||||||
"Run": [""],
|
"Run": [""],
|
||||||
"Stop running (Ctrl + x)": [""],
|
"Stop running (Ctrl + x)": [""],
|
||||||
|
"Stop running (Ctrl + e)": [""],
|
||||||
"Run query (Ctrl + Return)": [""],
|
"Run query (Ctrl + Return)": [""],
|
||||||
"Save & Explore": ["Grave uma visualização"],
|
"Save & Explore": ["Grave uma visualização"],
|
||||||
"Overwrite & Explore": ["Substitua a visualização %s"],
|
"Overwrite & Explore": ["Substitua a visualização %s"],
|
||||||
|
@ -1445,6 +1445,7 @@
|
|||||||
"Run selection": ["Executar seleção"],
|
"Run selection": ["Executar seleção"],
|
||||||
"Run": ["Executar"],
|
"Run": ["Executar"],
|
||||||
"Stop running (Ctrl + x)": ["Parar execução (Ctrl + x)"],
|
"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)"],
|
"Run query (Ctrl + Return)": ["Executar query (Ctrl + Return)"],
|
||||||
"Save & Explore": ["Salvar e explorar"],
|
"Save & Explore": ["Salvar e explorar"],
|
||||||
"Overwrite & Explore": ["Sobrescrever & explorar"],
|
"Overwrite & Explore": ["Sobrescrever & explorar"],
|
||||||
|
@ -1347,6 +1347,7 @@
|
|||||||
"Run selection": ["Выполнить выбранный запрос"],
|
"Run selection": ["Выполнить выбранный запрос"],
|
||||||
"Run": ["Выполнить"],
|
"Run": ["Выполнить"],
|
||||||
"Stop running (Ctrl + x)": ["Остановить (Ctrl + x)"],
|
"Stop running (Ctrl + x)": ["Остановить (Ctrl + x)"],
|
||||||
|
"Stop running (Ctrl + e)": ["Остановить (Ctrl + e)"],
|
||||||
"Run query (Ctrl + Return)": ["Выполнить запрос (Ctrl + Return)"],
|
"Run query (Ctrl + Return)": ["Выполнить запрос (Ctrl + Return)"],
|
||||||
"Save & Explore": ["Сохранить и исследовать"],
|
"Save & Explore": ["Сохранить и исследовать"],
|
||||||
"Overwrite & Explore": ["Перезаписать и исследовать"],
|
"Overwrite & Explore": ["Перезаписать и исследовать"],
|
||||||
|
@ -1146,6 +1146,7 @@
|
|||||||
"Run selection": [""],
|
"Run selection": [""],
|
||||||
"Run": [""],
|
"Run": [""],
|
||||||
"Stop running (Ctrl + x)": [""],
|
"Stop running (Ctrl + x)": [""],
|
||||||
|
"Stop running (Ctrl + e)": [""],
|
||||||
"Run query (Ctrl + Return)": [""],
|
"Run query (Ctrl + Return)": [""],
|
||||||
"Save & Explore": [""],
|
"Save & Explore": [""],
|
||||||
"Overwrite & Explore": [""],
|
"Overwrite & Explore": [""],
|
||||||
|
@ -1858,6 +1858,7 @@
|
|||||||
"Run selection": ["Zaženi izbrano"],
|
"Run selection": ["Zaženi izbrano"],
|
||||||
"Run": ["Zaženi"],
|
"Run": ["Zaženi"],
|
||||||
"Stop running (Ctrl + x)": ["Ustavi (Ctrl + x)"],
|
"Stop running (Ctrl + x)": ["Ustavi (Ctrl + x)"],
|
||||||
|
"Stop running (Ctrl + e)": ["Ustavi (Ctrl + e)"],
|
||||||
"Run query (Ctrl + Return)": ["Zaženi poizvedbo (Ctrl + Return)"],
|
"Run query (Ctrl + Return)": ["Zaženi poizvedbo (Ctrl + Return)"],
|
||||||
"Save & Explore": ["Shrani & Razišči"],
|
"Save & Explore": ["Shrani & Razišči"],
|
||||||
"Overwrite & Explore": ["Prepiši & Razišči"],
|
"Overwrite & Explore": ["Prepiši & Razišči"],
|
||||||
|
@ -1204,6 +1204,7 @@
|
|||||||
"Run selection": ["运行选定的查询"],
|
"Run selection": ["运行选定的查询"],
|
||||||
"Run": ["执行"],
|
"Run": ["执行"],
|
||||||
"Stop running (Ctrl + x)": ["停止运行 (Ctrl + x)"],
|
"Stop running (Ctrl + x)": ["停止运行 (Ctrl + x)"],
|
||||||
|
"Stop running (Ctrl + e)": ["停止运行 (Ctrl + e)"],
|
||||||
"Run query (Ctrl + Return)": ["执行运行 (Ctrl + Return)"],
|
"Run query (Ctrl + Return)": ["执行运行 (Ctrl + Return)"],
|
||||||
"Save & Explore": ["保存和浏览"],
|
"Save & Explore": ["保存和浏览"],
|
||||||
"Overwrite & Explore": ["覆写和浏览"],
|
"Overwrite & Explore": ["覆写和浏览"],
|
||||||
|
Loading…
Reference in New Issue
Block a user