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 2017/10/24 03:29:51 UTC

[incubator-superset] branch master updated: fixing the datasource inconsistence but in visualize flow (#3698)

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 18e9640  fixing the datasource inconsistence but in visualize flow (#3698)
18e9640 is described below

commit 18e9640d9976664b7e5681562cd2cbd5cc00055e
Author: Grace Guo <gr...@airbnb.com>
AuthorDate: Mon Oct 23 20:29:49 2017 -0700

    fixing the datasource inconsistence but in visualize flow (#3698)
    
    datasource in landing explore view is not the datasource created in sal lab.
---
 superset/assets/javascripts/SqlLab/components/VisualizeModal.jsx | 5 +++--
 superset/assets/spec/javascripts/sqllab/VisualizeModal_spec.jsx  | 2 ++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/superset/assets/javascripts/SqlLab/components/VisualizeModal.jsx b/superset/assets/javascripts/SqlLab/components/VisualizeModal.jsx
index 965718d..7c8b665 100644
--- a/superset/assets/javascripts/SqlLab/components/VisualizeModal.jsx
+++ b/superset/assets/javascripts/SqlLab/components/VisualizeModal.jsx
@@ -151,11 +151,12 @@ class VisualizeModal extends React.PureComponent {
   }
   visualize() {
     this.props.actions.createDatasource(this.buildVizOptions(), this)
-      .done(() => {
+      .done((resp) => {
         const columns = Object.keys(this.state.columns).map(k => this.state.columns[k]);
+        const data = JSON.parse(resp);
         const mainGroupBy = columns.filter(d => d.is_dim)[0];
         const formData = {
-          datasource: this.props.datasource,
+          datasource: `${data.table_id}__table`,
           viz_type: this.state.chartType.value,
           since: '100 years ago',
           limit: '0',
diff --git a/superset/assets/spec/javascripts/sqllab/VisualizeModal_spec.jsx b/superset/assets/spec/javascripts/sqllab/VisualizeModal_spec.jsx
index 41c23bb..56af8de 100644
--- a/superset/assets/spec/javascripts/sqllab/VisualizeModal_spec.jsx
+++ b/superset/assets/spec/javascripts/sqllab/VisualizeModal_spec.jsx
@@ -340,6 +340,8 @@ describe('VisualizeModal', () => {
       wrapper.setProps({ actions: { createDatasource: datasourceSpy } });
 
       wrapper.instance().visualize();
+      expect(exploreUtils.getExploreUrl.callCount).to.equal(1);
+      expect(exploreUtils.getExploreUrl.getCall(0).args[0].datasource).to.equal('107__table');
       expect(window.open.callCount).to.equal(1);
     });
     it('should notify error', () => {

-- 
To stop receiving notification emails like this one, please contact
['"commits@superset.apache.org" <co...@superset.apache.org>'].