You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by gr...@apache.org on 2018/03/05 19:44:05 UTC

[incubator-superset] branch master updated: Pass datasource as form_data param (#4538)

This is an automated email from the ASF dual-hosted git repository.

graceguo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 007ad35  Pass datasource as form_data param (#4538)
007ad35 is described below

commit 007ad351cf8d27e1218ecc5f1619701a18787241
Author: Riku Pelkonen <ri...@gmail.com>
AuthorDate: Mon Mar 5 21:43:59 2018 +0200

    Pass datasource as form_data param (#4538)
    
    * Pass datasource as form_data param
    
    * add comma after datasource
    
    * change test to match new addSlice
---
 superset/assets/javascripts/addSlice/AddSliceContainer.jsx          | 6 +++++-
 .../assets/spec/javascripts/addSlice/AddSliceContainer_spec.jsx     | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/superset/assets/javascripts/addSlice/AddSliceContainer.jsx b/superset/assets/javascripts/addSlice/AddSliceContainer.jsx
index 48b31eb..0516934 100644
--- a/superset/assets/javascripts/addSlice/AddSliceContainer.jsx
+++ b/superset/assets/javascripts/addSlice/AddSliceContainer.jsx
@@ -23,7 +23,11 @@ export default class AddSliceContainer extends React.PureComponent {
   }
 
   exploreUrl() {
-    const formData = encodeURIComponent(JSON.stringify({ viz_type: this.state.visType }));
+    const formData = encodeURIComponent(
+      JSON.stringify({
+        viz_type: this.state.visType,
+        datasource: this.state.datasourceValue,
+      }));
     return `/superset/explore/?form_data=${formData}`;
   }
 
diff --git a/superset/assets/spec/javascripts/addSlice/AddSliceContainer_spec.jsx b/superset/assets/spec/javascripts/addSlice/AddSliceContainer_spec.jsx
index 2a1f09b..f91b301 100644
--- a/superset/assets/spec/javascripts/addSlice/AddSliceContainer_spec.jsx
+++ b/superset/assets/spec/javascripts/addSlice/AddSliceContainer_spec.jsx
@@ -53,7 +53,7 @@ describe('AddSliceContainer', () => {
       datasourceId: datasourceValue.split('__')[0],
       datasourceType: datasourceValue.split('__')[1],
     });
-    const formattedUrl = '/superset/explore/?form_data=%7B%22viz_type%22%3A%22table%22%7D';
+    const formattedUrl = '/superset/explore/?form_data=%7B%22viz_type%22%3A%22table%22%2C%22datasource%22%3A%221__table%22%7D';
     expect(wrapper.instance().exploreUrl()).to.equal(formattedUrl);
   });
 });

-- 
To stop receiving notification emails like this one, please contact
graceguo@apache.org.