fixing the datasource inconsistence but in visualize flow (#3698)

datasource in landing explore view is not the datasource created in sal lab.
This commit is contained in:
Grace Guo 2017-10-23 20:29:49 -07:00 committed by GitHub
parent 58ea736ed6
commit 18e9640d99
2 changed files with 5 additions and 2 deletions

View File

@ -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',

View File

@ -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', () => {