diff options
Diffstat (limited to 'app/client/modules/samplernn/datasets.component.js')
| -rw-r--r-- | app/client/modules/samplernn/datasets.component.js | 92 |
1 files changed, 67 insertions, 25 deletions
diff --git a/app/client/modules/samplernn/datasets.component.js b/app/client/modules/samplernn/datasets.component.js index 5f45cf2..86ecc21 100644 --- a/app/client/modules/samplernn/datasets.component.js +++ b/app/client/modules/samplernn/datasets.component.js @@ -14,6 +14,7 @@ import Group from '../../common/group.component' import Slider from '../../common/slider.component' import Select from '../../common/select.component' import Button from '../../common/button.component' +import FileList from '../../common/fileList.component' import FileUpload from '../../common/fileUpload.component' import TextInput from '../../common/textInput.component' @@ -24,34 +25,75 @@ class SampleRNNDatasets extends Component { this.handleName = this.handleName.bind(this) this.handleUpload = this.handleUpload.bind(this) this.handleURL = this.handleURL.bind(this) + this.fileOptions = this.fileOptions.bind(this) props.actions.folder.index({ module: 'samplernn' }) props.actions.file.index({ module: 'samplernn' }) } handleName(name) { const folder = this.props.samplernn.folder - console.log(name) if (! folder.id) { this.props.actions.folder.create({ + // username... should get added inside the API module: 'samplernn', + activity: 'dataset', + datatype: 'audio', name }) } else { this.props.actions.folder.update({ id: folder.id, module: 'samplernn', + activity: 'dataset', + datatype: 'audio', name }) } } handleUpload(file) { - + const folder = this.props.samplernn.folder + this.props.actions.file.create({ + folder_id: folder.id, + module: 'samplernn', + activity: 'url', + epoch: 0, + processed: false, + generated: false, + url + }) } handleURL(url) { - + // name url + // mime datatype + // duration analysis + // size activity + // opt created_at updated_at + const folder = this.props.samplernn.folder + this.props.actions.file.create({ + folder_id: folder.id, + module: 'samplernn', + activity: 'url', + epoch: 0, + processed: false, + generated: false, + url + }) + } + fileOptions(file){ + console.log(file) + if (file.activity === 'url' && !file.dataset) { + return ( + <div className='gray'>fetching...</div> + ) + } + return ( + <div> + <div className='link' onClick={() => this.train(file)}>train</div> + {file.epoch == 0 && <div className='epochs'>{file.epochs} ep.</div>} + </div> + ) } render(){ const { samplernn } = this.props - console.log(samplernn) return ( <div className='app'> <div className='heading'> @@ -65,30 +107,30 @@ class SampleRNNDatasets extends Component { value={samplernn.folder.name} onSave={this.handleName} /> - <FileUpload - title='Upload a file' - onChange={this.handleUpload} - /> - <TextInput - title='Fetch a URL' - onSave={this.handleURL} - /> + {samplernn.folder.id && + <FileUpload + title='Upload a file' + onChange={this.handleUpload} + /> + } + {samplernn.folder.id && + <TextInput + title='Fetch a URL' + placeholder='http://' + onSave={this.handleURL} + /> + } </Group> </div> </div> - <div className='params row'> - <h3>Files</h3> - <div className="media"> - <div className="row"> - <div className="filename">foo.mp3</div> - <div className="size">1.2 mb</div> - <div className="date">30 May 2018</div> - <div className="epoch">epoch 30</div> - <div className="options"> - delete - </div> - </div> - </div> + <div className='params col'> + {samplernn.files.length ? + <h3>Files</h3> : + <h4>No files</h4>} + <FileList + files={samplernn.files} + options={this.fileOptions} + /> </div> </div> ) |
