Skip to content

Commit

Permalink
Pass datasource as form_data param (apache#4538)
Browse files Browse the repository at this point in the history
* Pass datasource as form_data param

* add comma after datasource

* change test to match new addSlice
  • Loading branch information
Pek1s authored and Grace Guo committed Mar 5, 2018
1 parent 4135854 commit 007ad35
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion superset/assets/javascripts/addSlice/AddSliceContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});

0 comments on commit 007ad35

Please sign in to comment.