You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@superset.apache.org by GitBox <gi...@apache.org> on 2017/10/24 03:29:53 UTC

[GitHub] graceguo-supercat closed pull request #3698: fixing the datasource inconsistence bug in visualize flow

graceguo-supercat closed pull request #3698: fixing the datasource inconsistence bug in visualize flow
URL: https://github.com/apache/incubator-superset/pull/3698
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/superset/assets/javascripts/SqlLab/components/VisualizeModal.jsx b/superset/assets/javascripts/SqlLab/components/VisualizeModal.jsx
index 965718df78..7c8b66511d 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 41c23bb9a0..56af8de45e 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', () => {


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services