diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-05-29 04:05:11 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-05-29 04:05:11 +0200 |
| commit | 953027ccdfb34c83a6d301401ccb47ec43b86825 (patch) | |
| tree | 4d8adef283de22e7c41ec3abe5805d0d06130ce8 /public/bundle.js | |
| parent | 59d22800576541b46a3004086835f8cc304927f5 (diff) | |
file list
Diffstat (limited to 'public/bundle.js')
| -rw-r--r-- | public/bundle.js | 554 |
1 files changed, 304 insertions, 250 deletions
diff --git a/public/bundle.js b/public/bundle.js index d327fb8..00767f0 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -484,6 +484,133 @@ exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)( /***/ }), +/***/ "./app/client/common/fileList.component.js": +/*!*************************************************!*\ + !*** ./app/client/common/fileList.component.js ***! + \*************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _preact = __webpack_require__(/*! preact */ "./node_modules/preact/dist/preact.esm.js"); + +var _redux = __webpack_require__(/*! redux */ "./node_modules/redux/es/redux.js"); + +var _reactRedux = __webpack_require__(/*! react-redux */ "./node_modules/react-redux/es/index.js"); + +var _moment = __webpack_require__(/*! moment */ "./node_modules/moment/moment.js"); + +var _moment2 = _interopRequireDefault(_moment); + +var _util = __webpack_require__(/*! ../util */ "./app/client/util.js"); + +var util = _interopRequireWildcard(_util); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var FileList = function (_Component) { + _inherits(FileList, _Component); + + function FileList(props) { + _classCallCheck(this, FileList); + + return _possibleConstructorReturn(this, (FileList.__proto__ || Object.getPrototypeOf(FileList)).call(this)); + } + + _createClass(FileList, [{ + key: 'render', + value: function render() { + var _this2 = this; + + var files = this.props.files; + + var fileList = files.map(function (file) { + return (0, _preact.h)( + 'div', + { 'class': 'row', key: file.name }, + (0, _preact.h)( + 'div', + { className: 'filename' }, + file.name || file.url + ), + (0, _preact.h)( + 'div', + { className: 'size' }, + file.size || '' + ), + (0, _preact.h)( + 'div', + { className: 'date' }, + (0, _moment2.default)(file.created_at).format("YYYY-MM-DD H:mm") + ), + file.epoch && (0, _preact.h)( + 'div', + { className: 'epoch' }, + 'epoch ', + file.epoch + ), + (0, _preact.h)( + 'div', + { className: 'activity' }, + file.activity || '', + ' ', + file.module || '' + ), + _this2.props.options && _this2.props.options(file), + file.epochs && (0, _preact.h)( + 'div', + { className: 'epochs' }, + file.epochs, + ' ep.' + ), + file.eta && (0, _preact.h)( + 'div', + { className: 'eta' }, + file.eta + ) + ); + }); + return (0, _preact.h)( + 'div', + { className: 'filelist rows' }, + fileList + ); + } + }]); + + return FileList; +}(_preact.Component); + +var mapStateToProps = function mapStateToProps(state) { + return {}; +}; + +var mapDispatchToProps = function mapDispatchToProps(dispatch, ownProps) { + return { + // actions: bindActionCreators(liveActions, dispatch) + }; +}; + +exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(FileList); + +/***/ }), + /***/ "./app/client/common/fileUpload.component.js": /*!***************************************************!*\ !*** ./app/client/common/fileUpload.component.js ***! @@ -561,6 +688,82 @@ exports.default = FileUpload; /***/ }), +/***/ "./app/client/common/gallery.component.js": +/*!************************************************!*\ + !*** ./app/client/common/gallery.component.js ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _preact = __webpack_require__(/*! preact */ "./node_modules/preact/dist/preact.esm.js"); + +var _redux = __webpack_require__(/*! redux */ "./node_modules/redux/es/redux.js"); + +var _reactRedux = __webpack_require__(/*! react-redux */ "./node_modules/react-redux/es/index.js"); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var Gallery = function (_Component) { + _inherits(Gallery, _Component); + + function Gallery(props) { + _classCallCheck(this, Gallery); + + return _possibleConstructorReturn(this, (Gallery.__proto__ || Object.getPrototypeOf(Gallery)).call(this)); + } + + _createClass(Gallery, [{ + key: 'render', + value: function render() { + var _props = this.props, + title = _props.title, + images = _props.images; + + var imageList = images.map(function (image) { + return (0, _preact.h)( + 'div', + null, + (0, _preact.h)('img', { src: image.url }) + ); + }); + return (0, _preact.h)( + 'div', + { 'class': 'gallery' }, + imageList + ); + } + }]); + + return Gallery; +}(_preact.Component); + +var mapStateToProps = function mapStateToProps(state) { + return {}; +}; + +var mapDispatchToProps = function mapDispatchToProps(dispatch, ownProps) { + return { + // actions: bindActionCreators(liveActions, dispatch) + }; +}; + +exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(Gallery); + +/***/ }), + /***/ "./app/client/common/group.component.js": /*!**********************************************!*\ !*** ./app/client/common/group.component.js ***! @@ -1262,7 +1465,8 @@ var TextInput = function (_Component) { type: 'text', value: this.props.value, onInput: this.handleInput, - onKeydown: this.handleKeydown + onKeydown: this.handleKeydown, + placeholder: this.props.placeholder }) ) ); @@ -1344,11 +1548,11 @@ var _tasklist = __webpack_require__(/*! ./tasklist.component */ "./app/client/da var _tasklist2 = _interopRequireDefault(_tasklist); -var _filelist = __webpack_require__(/*! ./filelist.component */ "./app/client/dashboard/filelist.component.js"); +var _fileList = __webpack_require__(/*! ../common/fileList.component */ "./app/client/common/fileList.component.js"); -var _filelist2 = _interopRequireDefault(_filelist); +var _fileList2 = _interopRequireDefault(_fileList); -var _gallery = __webpack_require__(/*! ./gallery.component */ "./app/client/dashboard/gallery.component.js"); +var _gallery = __webpack_require__(/*! ../common/gallery.component */ "./app/client/common/gallery.component.js"); var _gallery2 = _interopRequireDefault(_gallery); @@ -1418,17 +1622,17 @@ var Dashboard = function (_Component) { (0, _preact.h)( _group2.default, { title: 'Your Datasets' }, - (0, _preact.h)(_filelist2.default, { files: files }) + (0, _preact.h)(_fileList2.default, { files: files }) ), (0, _preact.h)( _group2.default, { title: 'Results' }, - (0, _preact.h)(_filelist2.default, { files: files }) + (0, _preact.h)(_fileList2.default, { files: files }) ), (0, _preact.h)( _group2.default, { title: 'Audio Player' }, - (0, _preact.h)(_filelist2.default, { files: files }) + (0, _preact.h)(_fileList2.default, { files: files }) ) ) ), @@ -1627,203 +1831,6 @@ exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)( /***/ }), -/***/ "./app/client/dashboard/filelist.component.js": -/*!****************************************************!*\ - !*** ./app/client/dashboard/filelist.component.js ***! - \****************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _preact = __webpack_require__(/*! preact */ "./node_modules/preact/dist/preact.esm.js"); - -var _redux = __webpack_require__(/*! redux */ "./node_modules/redux/es/redux.js"); - -var _reactRedux = __webpack_require__(/*! react-redux */ "./node_modules/react-redux/es/index.js"); - -var _util = __webpack_require__(/*! ../util */ "./app/client/util.js"); - -var util = _interopRequireWildcard(_util); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var FileList = function (_Component) { - _inherits(FileList, _Component); - - function FileList(props) { - _classCallCheck(this, FileList); - - return _possibleConstructorReturn(this, (FileList.__proto__ || Object.getPrototypeOf(FileList)).call(this)); - } - - _createClass(FileList, [{ - key: 'render', - value: function render() { - var files = this.props.files; - - var time = 0; - var fileList = files.map(function (file) { - var eta = time + file.epochs * 180 / 60 + " min."; - time += file.epochs * 180 / 60; - var dataset_type = void 0, - dataset_name = void 0; - if (file.dataset.indexOf('/') !== -1) { - var _file$dataset$split = file.dataset.split('/'); - - var _file$dataset$split2 = _slicedToArray(_file$dataset$split, 2); - - dataset_type = _file$dataset$split2[0]; - dataset_name = _file$dataset$split2[1]; - } else { - dataset_name = file.dataset; - } - return (0, _preact.h)( - 'div', - { 'class': 'row' }, - (0, _preact.h)( - 'div', - { 'class': 'activity' }, - file.activity, - ' ', - file.library, - ' ', - dataset_type - ), - (0, _preact.h)( - 'div', - { 'class': 'dataset' }, - dataset_name - ), - (0, _preact.h)( - 'div', - { 'class': 'epochs' }, - file.epochs, - ' ep.' - ), - (0, _preact.h)( - 'div', - { 'class': 'eta' }, - eta - ) - ); - }); - return (0, _preact.h)( - 'div', - { 'class': 'filelist rows' }, - fileList - ); - } - }]); - - return FileList; -}(_preact.Component); - -var mapStateToProps = function mapStateToProps(state) { - return {}; -}; - -var mapDispatchToProps = function mapDispatchToProps(dispatch, ownProps) { - return { - // actions: bindActionCreators(liveActions, dispatch) - }; -}; - -exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(FileList); - -/***/ }), - -/***/ "./app/client/dashboard/gallery.component.js": -/*!***************************************************!*\ - !*** ./app/client/dashboard/gallery.component.js ***! - \***************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _preact = __webpack_require__(/*! preact */ "./node_modules/preact/dist/preact.esm.js"); - -var _redux = __webpack_require__(/*! redux */ "./node_modules/redux/es/redux.js"); - -var _reactRedux = __webpack_require__(/*! react-redux */ "./node_modules/react-redux/es/index.js"); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Gallery = function (_Component) { - _inherits(Gallery, _Component); - - function Gallery(props) { - _classCallCheck(this, Gallery); - - return _possibleConstructorReturn(this, (Gallery.__proto__ || Object.getPrototypeOf(Gallery)).call(this)); - } - - _createClass(Gallery, [{ - key: 'render', - value: function render() { - var _props = this.props, - title = _props.title, - images = _props.images; - - var imageList = images.map(function (image) { - return (0, _preact.h)( - 'div', - null, - (0, _preact.h)('img', { src: image.url }) - ); - }); - return (0, _preact.h)( - 'div', - { 'class': 'gallery' }, - imageList - ); - } - }]); - - return Gallery; -}(_preact.Component); - -var mapStateToProps = function mapStateToProps(state) { - return {}; -}; - -var mapDispatchToProps = function mapDispatchToProps(dispatch, ownProps) { - return { - // actions: bindActionCreators(liveActions, dispatch) - }; -}; - -exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(Gallery); - -/***/ }), - /***/ "./app/client/dashboard/tasklist.component.js": /*!****************************************************!*\ !*** ./app/client/dashboard/tasklist.component.js ***! @@ -3392,6 +3399,10 @@ var _button = __webpack_require__(/*! ../../common/button.component */ "./app/cl var _button2 = _interopRequireDefault(_button); +var _fileList = __webpack_require__(/*! ../../common/fileList.component */ "./app/client/common/fileList.component.js"); + +var _fileList2 = _interopRequireDefault(_fileList); + var _fileUpload = __webpack_require__(/*! ../../common/fileUpload.component */ "./app/client/common/fileUpload.component.js"); var _fileUpload2 = _interopRequireDefault(_fileUpload); @@ -3426,6 +3437,7 @@ var SampleRNNDatasets = function (_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' }); return _this; @@ -3435,32 +3447,93 @@ var SampleRNNDatasets = function (_Component) { key: 'handleName', value: function handleName(name) { var 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: name }); } else { this.props.actions.folder.update({ id: folder.id, module: 'samplernn', + activity: 'dataset', + datatype: 'audio', name: name }); } } }, { key: 'handleUpload', - value: function handleUpload(file) {} + value: function handleUpload(file) { + var 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: url + }); + } }, { key: 'handleURL', - value: function handleURL(url) {} + value: function handleURL(url) { + // name url + // mime datatype + // duration analysis + // size activity + // opt created_at updated_at + var 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: url + }); + } + }, { + key: 'fileOptions', + value: function fileOptions(file) { + var _this2 = this; + + console.log(file); + if (file.activity === 'url' && !file.dataset) { + return (0, _preact.h)( + 'div', + { className: 'gray' }, + 'fetching...' + ); + } + return (0, _preact.h)( + 'div', + null, + (0, _preact.h)( + 'div', + { className: 'link', onClick: function onClick() { + return _this2.train(file); + } }, + 'train' + ), + file.epoch == 0 && (0, _preact.h)( + 'div', + { className: 'epochs' }, + file.epochs, + ' ep.' + ) + ); + } }, { key: 'render', value: function render() { var samplernn = this.props.samplernn; - console.log(samplernn); return (0, _preact.h)( 'div', { className: 'app' }, @@ -3487,12 +3560,13 @@ var SampleRNNDatasets = function (_Component) { value: samplernn.folder.name, onSave: this.handleName }), - (0, _preact.h)(_fileUpload2.default, { + samplernn.folder.id && (0, _preact.h)(_fileUpload2.default, { title: 'Upload a file', onChange: this.handleUpload }), - (0, _preact.h)(_textInput2.default, { + samplernn.folder.id && (0, _preact.h)(_textInput2.default, { title: 'Fetch a URL', + placeholder: 'http://', onSave: this.handleURL }) ) @@ -3500,45 +3574,20 @@ var SampleRNNDatasets = function (_Component) { ), (0, _preact.h)( 'div', - { className: 'params row' }, - (0, _preact.h)( + { className: 'params col' }, + samplernn.files.length ? (0, _preact.h)( 'h3', null, 'Files' + ) : (0, _preact.h)( + 'h4', + null, + 'No files' ), - (0, _preact.h)( - 'div', - { className: 'media' }, - (0, _preact.h)( - 'div', - { 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' - ) - ) - ) + (0, _preact.h)(_fileList2.default, { + files: samplernn.files, + options: this.fileOptions + }) ) ); } @@ -3658,6 +3707,7 @@ var samplernnInitialState = { error: null, folder: {}, folders: [], + files: [], results: [] }; @@ -3677,19 +3727,23 @@ var samplernnReducer = function samplernnReducer() { return _extends({}, state); case _types2.default.folder.index: console.log(action); - return { + return _extends({}, state, { folders: action.data, folder: action.data[0] - }; - return; + }); case _types2.default.folder.update: console.log(action); - return; + return state; case _types2.default.file.index: console.log(action); - return; + return _extends({}, state, { + files: action.data + }); case _types2.default.file.create: console.log(action); + return _extends({}, state, { + files: [action.data].concat(undefined.files) + }); return; default: return state; |
