Get sections to render when switching datasource (#1660)

* Get sections to render when switching datasource
 - Move sectionsToRender in store and use is for defaultFormData
 - Change some SelectField to FreeFormSelect according to forms.py

* Solved the css not found problem in staging

* Fixed js tests
This commit is contained in:
vera-liu
2016-11-22 14:55:32 -08:00
committed by GitHub
parent bdae570a69
commit 6b80f5bb35
7 changed files with 45 additions and 38 deletions

View File

@@ -4,7 +4,7 @@ import { bindActionCreators } from 'redux';
import * as actions from '../actions/exploreActions';
import { connect } from 'react-redux';
import { Panel, Alert } from 'react-bootstrap';
import { visTypes, commonControlPanelSections } from '../stores/store';
import { visTypes, sectionsToRender } from '../stores/store';
import ControlPanelSection from './ControlPanelSection';
import FieldSetRow from './FieldSetRow';
@@ -37,17 +37,11 @@ class ControlPanelsContainer extends React.Component {
}
onChange(name, value, label) {
this.props.actions.setFieldValue(name, value, label);
this.props.actions.setFieldValue(this.props.datasource_type, name, value, label);
}
sectionsToRender() {
const viz = visTypes[this.props.form_data.viz_type];
const timeSection = this.props.datasource_type === 'table' ?
commonControlPanelSections.sqlaTimeSeries : commonControlPanelSections.druidTimeSeries;
const { datasourceAndVizType, sqlClause } = commonControlPanelSections;
const sectionsToRender = [datasourceAndVizType].concat(
viz.controlPanelSections, timeSection, sqlClause);
return sectionsToRender;
return sectionsToRender(this.props.form_data.viz_type, this.props.datasource_type);
}
fieldOverrides() {