mirror of
https://github.com/apache/superset.git
synced 2026-04-10 20:06:13 +00:00
Caching wasn't working after deprecate_v1, this addresses it. Also surfacing whether the data is served from cache in explore view and a way to force run the query bypassing the cache.
27 lines
857 B
JavaScript
27 lines
857 B
JavaScript
/* eslint camelcase: 0 */
|
|
export function getExploreUrl(form_data, endpoint = 'base', force = false) {
|
|
if (!form_data.datasource) {
|
|
return null;
|
|
}
|
|
const [datasource_id, datasource_type] = form_data.datasource.split('__');
|
|
let params = `${datasource_type}/${datasource_id}/`;
|
|
params += '?form_data=' + encodeURIComponent(JSON.stringify(form_data));
|
|
if (force) {
|
|
params += '&force=true';
|
|
}
|
|
switch (endpoint) {
|
|
case 'base':
|
|
return `/superset/explore/${params}`;
|
|
case 'json':
|
|
return `/superset/explore_json/${params}`;
|
|
case 'csv':
|
|
return `/superset/explore_json/${params}&csv=true`;
|
|
case 'standalone':
|
|
return `/superset/explore/${params}&standalone=true`;
|
|
case 'query':
|
|
return `/superset/explore_json/${params}&query=true`;
|
|
default:
|
|
return `/superset/explore/${params}`;
|
|
}
|
|
}
|