mistercrunch commented on a change in pull request #5101: Explore to SQL Lab
URL:
https://github.com/apache/incubator-superset/pull/5101#discussion_r196296599
##########
File path: superset/assets/src/chart/chartAction.js
##########
@@ -186,3 +186,23 @@ export function runQuery(formData, force = false, timeout
= 60, key) {
]);
};
}
+
+export function redirectSQLLab(formData) {
+ return function () {
+ $.ajax({
+ type: 'GET',
+ url: `/superset/sql?form_data=${JSON.stringify(formData)}`,
+ success: (response) => {
+ const url = new URL(window.location);
+ url.pathname = '/superset/sqllab';
+ for (let k of url.searchParams.keys()) {
+ url.searchParams.delete(k);
+ }
+ url.searchParams.set('datasourceKey', formData.datasource);
+ url.searchParams.set('sql', response.query);
+ window.open(url.href, '_blank');
Review comment:
I think it's a bit the wild west in terms of URL composition in Superset at
the moment. It could be good to refactor a `src/utils/urls.js` module with
constants and utilities for all this.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]