You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ju...@apache.org on 2023/11/14 18:27:51 UTC
(superset) branch master updated: fix(sqllab): Allow router navigation to explore (#25941)
This is an automated email from the ASF dual-hosted git repository.
justinpark 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 f18fb24b3d fix(sqllab): Allow router navigation to explore (#25941)
f18fb24b3d is described below
commit f18fb24b3df0a618c57f9b0225494bf13f0ec1c8
Author: JUST.in DO IT <ju...@airbnb.com>
AuthorDate: Tue Nov 14 10:27:44 2023 -0800
fix(sqllab): Allow router navigation to explore (#25941)
---
superset-frontend/src/SqlLab/components/ResultSet/index.tsx | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/superset-frontend/src/SqlLab/components/ResultSet/index.tsx b/superset-frontend/src/SqlLab/components/ResultSet/index.tsx
index 35eac78044..58e55a1df7 100644
--- a/superset-frontend/src/SqlLab/components/ResultSet/index.tsx
+++ b/superset-frontend/src/SqlLab/components/ResultSet/index.tsx
@@ -18,6 +18,7 @@
*/
import React, { useCallback, useEffect, useState } from 'react';
import { useDispatch } from 'react-redux';
+import { useHistory } from 'react-router-dom';
import ButtonGroup from 'src/components/ButtonGroup';
import Alert from 'src/components/Alert';
import Button from 'src/components/Button';
@@ -161,6 +162,7 @@ const ResultSet = ({
const [showSaveDatasetModal, setShowSaveDatasetModal] = useState(false);
const [alertIsOpen, setAlertIsOpen] = useState(false);
+ const history = useHistory();
const dispatch = useDispatch();
const reRunQueryIfSessionTimeoutErrorOnMount = useCallback(() => {
@@ -215,9 +217,11 @@ const ResultSet = ({
setSearchText(event.target.value);
};
- const createExploreResultsOnClick = async () => {
+ const createExploreResultsOnClick = async (clickEvent: React.MouseEvent) => {
const { results } = query;
+ const openInNewWindow = clickEvent.metaKey;
+
if (results?.query_id) {
const key = await postFormData(results.query_id, 'query', {
...EXPLORE_CHART_DEFAULT,
@@ -229,7 +233,11 @@ const ResultSet = ({
const url = mountExploreUrl(null, {
[URL_PARAMS.formDataKey.name]: key,
});
- window.open(url, '_blank', 'noreferrer');
+ if (openInNewWindow) {
+ window.open(url, '_blank', 'noreferrer');
+ } else {
+ history.push(url);
+ }
} else {
addDangerToast(t('Unable to create chart without a query id.'));
}