diff options
Diffstat (limited to 'public/bundle.js')
| -rw-r--r-- | public/bundle.js | 104 |
1 files changed, 77 insertions, 27 deletions
diff --git a/public/bundle.js b/public/bundle.js index 4c841f9..d327fb8 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -3423,13 +3423,33 @@ var SampleRNNDatasets = function (_Component) { // fetch file list var _this = _possibleConstructorReturn(this, (SampleRNNDatasets.__proto__ || Object.getPrototypeOf(SampleRNNDatasets)).call(this)); + _this.handleName = _this.handleName.bind(_this); _this.handleUpload = _this.handleUpload.bind(_this); _this.handleURL = _this.handleURL.bind(_this); props.actions.folder.index({ module: 'samplernn' }); + props.actions.file.index({ module: 'samplernn' }); return _this; } _createClass(SampleRNNDatasets, [{ + key: 'handleName', + value: function handleName(name) { + var folder = this.props.samplernn.folder; + console.log(name); + if (!folder.id) { + this.props.actions.folder.create({ + module: 'samplernn', + name: name + }); + } else { + this.props.actions.folder.update({ + id: folder.id, + module: 'samplernn', + name: name + }); + } + } + }, { key: 'handleUpload', value: function handleUpload(file) {} }, { @@ -3438,6 +3458,9 @@ var SampleRNNDatasets = function (_Component) { }, { key: 'render', value: function render() { + var samplernn = this.props.samplernn; + + console.log(samplernn); return (0, _preact.h)( 'div', { className: 'app' }, @@ -3458,7 +3481,12 @@ var SampleRNNDatasets = function (_Component) { { className: 'column' }, (0, _preact.h)( _group2.default, - { title: 'Create Dataset' }, + { title: 'Dataset' }, + (0, _preact.h)(_textInput2.default, { + title: 'Dataset name', + value: samplernn.folder.name, + onSave: this.handleName + }), (0, _preact.h)(_fileUpload2.default, { title: 'Upload a file', onChange: this.handleUpload @@ -3476,35 +3504,39 @@ var SampleRNNDatasets = function (_Component) { (0, _preact.h)( 'h3', null, - 'Datasets' + 'Files' ), (0, _preact.h)( 'div', { className: 'media' }, (0, _preact.h)( 'div', - { className: 'filename' }, - 'foo.mp3' - ), - (0, _preact.h)( - 'div', - { className: 'size' }, - '1.2 mb' - ), - (0, _preact.h)( - 'div', - { className: 'date' }, - '30 May 2018' - ), - (0, _preact.h)( - 'div', - { className: 'epoch' }, - 'epoch 30' - ), - (0, _preact.h)( - 'div', - { className: 'options' }, - 'delete' + { className: 'row' }, + (0, _preact.h)( + 'div', + { className: 'filename' }, + 'foo.mp3' + ), + (0, _preact.h)( + 'div', + { className: 'size' }, + '1.2 mb' + ), + (0, _preact.h)( + 'div', + { className: 'date' }, + '30 May 2018' + ), + (0, _preact.h)( + 'div', + { className: 'epoch' }, + 'epoch 30' + ), + (0, _preact.h)( + 'div', + { className: 'options' }, + 'delete' + ) ) ) ) @@ -3516,13 +3548,17 @@ var SampleRNNDatasets = function (_Component) { }(_preact.Component); var mapStateToProps = function mapStateToProps(state) { - return {}; + return { + samplernn: state.module.samplernn + }; }; var mapDispatchToProps = function mapDispatchToProps(dispatch, ownProps) { return { actions: { - folder: (0, _redux.bindActionCreators)(_api.actions.folder, dispatch) + folder: (0, _redux.bindActionCreators)(_api.actions.folder, dispatch), + file: (0, _redux.bindActionCreators)(_api.actions.file, dispatch), + task: (0, _redux.bindActionCreators)(_api.actions.task, dispatch) } }; }; @@ -3620,7 +3656,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de var samplernnInitialState = { loading: false, error: null, - datasets: [], + folder: {}, + folders: [], results: [] }; @@ -3640,6 +3677,19 @@ var samplernnReducer = function samplernnReducer() { return _extends({}, state); case _types2.default.folder.index: console.log(action); + return { + folders: action.data, + folder: action.data[0] + }; + return; + case _types2.default.folder.update: + console.log(action); + return; + case _types2.default.file.index: + console.log(action); + return; + case _types2.default.file.create: + console.log(action); return; default: return state; |
