williaster commented on a change in pull request #3993: [Explore view] Use POST
method for charting requests
URL:
https://github.com/apache/incubator-superset/pull/3993#discussion_r156470728
##########
File path: superset/assets/javascripts/explore/exploreUtils.js
##########
@@ -1,7 +1,34 @@
/* eslint camelcase: 0 */
import URI from 'urijs';
-export function getExploreUrl(form_data, endpointType = 'base', force = false,
+export function getURIDirectory(form_data, endpointType = 'base') {
+ // Building the directory part of the URI
+ let directory = '/superset/explore/';
+ if (['json', 'csv', 'query'].indexOf(endpointType) >= 0) {
+ directory = '/superset/explore_json/';
+ }
+ const [datasource_id, datasource_type] = form_data.datasource.split('__');
+ directory += `${datasource_type}/${datasource_id}/`;
+
+ return directory;
+}
+
+export function getExploreLongUrl(form_data, endpointType) {
+ if (!form_data.datasource) {
+ return null;
+ }
+
+ const uri = new URI('/');
+ const directory = getURIDirectory(form_data, endpointType);
+ const search = uri.search(true);
+ search.form_data = JSON.stringify(form_data);
+ if (endpointType === 'standalone') {
+ search.standalone = 'true';
+ }
+ return uri.directory(directory).search(search).toString();
+}
+
+export function createExplore(form_data, endpointType = 'base', force = false,
Review comment:
could we make this method name more clear? like `getExploreUrlAndPayload` it
took me a while to understand what `getExplore` meant.
----------------------------------------------------------------
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