From 93cdf60920dc6234771876a195838c6458b80e3d Mon Sep 17 00:00:00 2001
From: timifasubaa <30888507+timifasubaa@users.noreply.github.com>
Date: Tue, 19 Jun 2018 20:33:24 -0700
Subject: [PATCH] [sqllab] Fix sql lab resolution link (#5216)
* pass link
* update frontend to show link differently
* nits
---
superset/assets/src/SqlLab/actions.js | 16 ++++++++++++----
.../assets/src/SqlLab/components/ResultSet.jsx | 6 +++++-
.../assets/src/SqlLab/components/SouthPane.jsx | 1 -
superset/assets/src/SqlLab/reducers.js | 7 ++++++-
superset/sql_lab.py | 5 ++---
5 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/superset/assets/src/SqlLab/actions.js b/superset/assets/src/SqlLab/actions.js
index 644947023b..540bfe7b03 100644
--- a/superset/assets/src/SqlLab/actions.js
+++ b/superset/assets/src/SqlLab/actions.js
@@ -78,8 +78,8 @@ export function querySuccess(query, results) {
return { type: QUERY_SUCCESS, query, results };
}
-export function queryFailed(query, msg) {
- return { type: QUERY_FAILED, query, msg };
+export function queryFailed(query, msg, link) {
+ return { type: QUERY_FAILED, query, msg, link };
}
export function stopQuery(query) {
@@ -98,6 +98,14 @@ export function requestQueryResults(query) {
return { type: REQUEST_QUERY_RESULTS, query };
}
+function getErrorLink(err) {
+ let link = '';
+ if (err.responseJSON && err.responseJSON.link) {
+ link = err.responseJSON.link;
+ }
+ return link;
+}
+
export function fetchQueryResults(query) {
return function (dispatch) {
dispatch(requestQueryResults(query));
@@ -114,7 +122,7 @@ export function fetchQueryResults(query) {
if (err.responseJSON && err.responseJSON.error) {
msg = err.responseJSON.error;
}
- dispatch(queryFailed(query, msg));
+ dispatch(queryFailed(query, msg, getErrorLink(err)));
},
});
};
@@ -166,7 +174,7 @@ export function runQuery(query) {
if (msg.indexOf('CSRF token') > 0) {
msg = COMMON_ERR_MESSAGES.SESSION_TIMED_OUT;
}
- dispatch(queryFailed(query, msg));
+ dispatch(queryFailed(query, msg, getErrorLink(msg)));
},
});
};
diff --git a/superset/assets/src/SqlLab/components/ResultSet.jsx b/superset/assets/src/SqlLab/components/ResultSet.jsx
index f36a1640c7..49599214e5 100644
--- a/superset/assets/src/SqlLab/components/ResultSet.jsx
+++ b/superset/assets/src/SqlLab/components/ResultSet.jsx
@@ -155,7 +155,11 @@ export default class ResultSet extends React.PureComponent {
if (query.state === 'stopped') {
return