From c34ecb4aacb1d27913088ff2b4546f1504d8dd86 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 3 Jun 2018 21:05:52 +0200 Subject: import form --- app/client/common/select.component.js | 15 ++++--- app/client/modules/pix2pix/live.component.js | 1 + app/client/modules/samplernn/samplernn.datasets.js | 5 --- app/client/modules/samplernn/samplernn.import.js | 51 +++++++++++++++++++--- 4 files changed, 53 insertions(+), 19 deletions(-) (limited to 'app') diff --git a/app/client/common/select.component.js b/app/client/common/select.component.js index 90bc6dc..3147dc4 100644 --- a/app/client/common/select.component.js +++ b/app/client/common/select.component.js @@ -1,7 +1,6 @@ import { h, Component } from 'preact' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' -import * as liveActions from '../live/live.actions' class Select extends Component { constructor(props){ @@ -11,14 +10,17 @@ class Select extends Component { handleChange(e){ clearTimeout(this.timeout) let new_value = e.target.value - this.props.actions.set_param(this.props.name, new_value) - this.props.onChange && this.props.onChange(new_value) + this.props.onChange && this.props.onChange(this.props.name, new_value) } render() { const value = this.props.opt[this.props.name] const options = (this.props.options || []).map((key,i) => { let name, value - if (typeof key == 'string') { + if (typeof key === 'object' && key.length) { + [name, value] = key + console.log(name, value) + } + else if (typeof key === 'string') { name = key.length < 4 ? key.toUpperCase() : key value = key } else { @@ -53,12 +55,11 @@ function capitalize(s){ return (s || "").replace(/(?:^|\s)\S/g, function(a) { return a.toUpperCase(); }); } -const mapStateToProps = state => ({ - opt: state.live.opt, +const mapStateToProps = (state, props) => ({ + opt: props.opt || state.live.opt, }) const mapDispatchToProps = (dispatch, ownProps) => ({ - actions: bindActionCreators(liveActions, dispatch) }) export default connect(mapStateToProps, mapDispatchToProps)(Select) diff --git a/app/client/modules/pix2pix/live.component.js b/app/client/modules/pix2pix/live.component.js index c1f2b51..9aef297 100644 --- a/app/client/modules/pix2pix/live.component.js +++ b/app/client/modules/pix2pix/live.component.js @@ -73,6 +73,7 @@ class LivePix2Pix extends Component { name='send_image' title='view mode' options={['a','b','sequence','recursive']} + onChange={this.props.actions.set_param} /> this.setState({ folder: value })} + /> + this.setState({ url_base: value })} + /> + this.beforeRow(row)} + beforeRow={dataset => this.beforeRow(dataset)} + afterRow={dataset => this.afterRow(dataset)} /> ) } - beforeRow(row){ - console.log(row) + beforeRow(dataset){ + // console.log(dataset) + return null + } + afterRow(dataset){ + return null } } -- cgit v1.2.3-70-g09d2