Vliu put datasource in store (#1610)

* Move datasource from global store object to form_data

* Moved datasource_id  and datasource_name to form_data

* Refetch defaultFormData when switching datasource

* Fixed js tests
This commit is contained in:
vera-liu
2016-11-17 09:26:25 -08:00
committed by GitHub
parent ab5da5ba28
commit 4f7f437527
9 changed files with 76 additions and 48 deletions

View File

@@ -31,7 +31,11 @@ export default class SelectField extends React.Component {
if (this.props.multi) {
optionValue = opt ? opt.map((o) => o.value) : null;
}
this.props.onChange(this.props.name, optionValue);
if (this.props.name === 'datasource' && optionValue !== null) {
this.props.onChange(this.props.name, optionValue, opt.label);
} else {
this.props.onChange(this.props.name, optionValue);
}
}
render() {
const options = this.props.choices.map((c) => ({ value: c[0], label: c[1] }));