summaryrefslogtreecommitdiff
path: root/public/bundle.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-06-04 03:52:59 +0200
committerJules Laplace <julescarbon@gmail.com>2018-06-04 03:52:59 +0200
commit57726902fe70f6c051c20f7104a9b78687c15479 (patch)
tree50e70dc944f96f5466b785a70ed330bb647368d0 /public/bundle.js
parent94f083788d58bccb09f775ef731827d29d719d43 (diff)
progress barz
Diffstat (limited to 'public/bundle.js')
-rw-r--r--public/bundle.js146
1 files changed, 134 insertions, 12 deletions
diff --git a/public/bundle.js b/public/bundle.js
index 7372568..f9ed14c 100644
--- a/public/bundle.js
+++ b/public/bundle.js
@@ -1534,6 +1534,43 @@ exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(
/***/ }),
+/***/ "./app/client/common/loading.component.js":
+/*!************************************************!*\
+ !*** ./app/client/common/loading.component.js ***!
+ \************************************************/
+/*! no static exports found */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = Loading;
+
+var _preact = __webpack_require__(/*! preact */ "./node_modules/preact/dist/preact.esm.js");
+
+var _progress = __webpack_require__(/*! ./progress.component */ "./app/client/common/progress.component.js");
+
+var _progress2 = _interopRequireDefault(_progress);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function Loading(_ref) {
+ var progress = _ref.progress;
+
+ return (0, _preact.h)(
+ 'div',
+ { className: 'loading' },
+ 'Loading',
+ (0, _preact.h)('br', null),
+ (0, _preact.h)(_progress2.default, { progress: progress })
+ );
+}
+
+/***/ }),
+
/***/ "./app/client/common/param.component.js":
/*!**********************************************!*\
!*** ./app/client/common/param.component.js ***!
@@ -1734,6 +1771,41 @@ exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(
/***/ }),
+/***/ "./app/client/common/progress.component.js":
+/*!*************************************************!*\
+ !*** ./app/client/common/progress.component.js ***!
+ \*************************************************/
+/*! no static exports found */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = Progress;
+
+var _preact = __webpack_require__(/*! preact */ "./node_modules/preact/dist/preact.esm.js");
+
+function Progress(_ref) {
+ var progress = _ref.progress;
+ var i = progress.i,
+ n = progress.n;
+
+ var a = [];
+ for (var j = 0; j < n; j++) {
+ a.push((0, _preact.h)('div', { key: j, className: j < i ? 'x' : 'o' }));
+ }
+ return (0, _preact.h)(
+ 'div',
+ { className: 'progress' },
+ a
+ );
+}
+
+/***/ }),
+
/***/ "./app/client/common/select.component.js":
/*!***********************************************!*\
!*** ./app/client/common/select.component.js ***!
@@ -4639,6 +4711,7 @@ var load_directories = exports.load_directories = function load_directories(id)
// console.log(actions)
(0, _util.allProgress)([_actions2.default.folder.index({ module: 'samplernn' }), _actions2.default.file.index({ module: 'samplernn' }), _actions2.default.task.index({ module: 'samplernn' }), _actions2.default.socket.list_directory({ module: 'samplernn', dir: 'datasets' }), _actions2.default.socket.list_directory({ module: 'samplernn', dir: 'results' }), _actions2.default.socket.list_directory({ module: 'samplernn', dir: 'output' }), load_loss()(dispatch)], function (percent, i, n) {
console.log(percent + "%");
+ dispatch({ type: _types2.default.app.load_progress, progress: { i: i, n: n } });
}).then(function (res) {
// console.log(res)
var _res = _slicedToArray(res, 7),
@@ -4930,12 +5003,13 @@ var fetch_url = exports.fetch_url = function fetch_url(url) {
};
var train_task_now = exports.train_task_now = function train_task_now(dataset) {
+ var epochs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
return function (dispatch) {
var task = {
module: 'samplernn',
activity: 'train',
dataset: dataset,
- epochs: 6,
+ epochs: epochs,
opt: {
sample_length: 44100 * 5,
n_samples: 6,
@@ -4988,6 +5062,10 @@ var _dataset4 = _interopRequireDefault(_dataset3);
var _fileList = __webpack_require__(/*! ../../common/fileList.component */ "./app/client/common/fileList.component.js");
+var _loading = __webpack_require__(/*! ../../common/loading.component */ "./app/client/common/loading.component.js");
+
+var _loading2 = _interopRequireDefault(_loading);
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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; } }
@@ -5089,11 +5167,8 @@ var SampleRNNDatasets = function (_Component) {
if (samplernn.loading) {
// console.log('loading')
- return (0, _preact.h)(
- 'span',
- null,
- 'Loading'
- );
+ console.log(samplernn.loading);
+ return (0, _preact.h)(_loading2.default, { progress: samplernn.progress });
}
if (!samplernn.data.folders.length) {
console.log('no folders, redirect to /new');
@@ -5134,7 +5209,8 @@ var SampleRNNDatasets = function (_Component) {
var _props3 = this.props,
samplernn = _props3.samplernn,
- onPickDataset = _props3.onPickDataset;
+ onPickDataset = _props3.onPickDataset,
+ actions = _props3.actions;
var folder = samplernn.folder;
@@ -5147,7 +5223,7 @@ var SampleRNNDatasets = function (_Component) {
return (0, _preact.h)(
'div',
{ className: 'row dataset', onClick: function onClick() {
- return onPickDataset(dataset);
+ return onPickDataset && onPickDataset(dataset);
} },
_this3.props.beforeRow && _this3.props.beforeRow(dataset),
(0, _preact.h)(
@@ -5163,11 +5239,50 @@ var SampleRNNDatasets = function (_Component) {
),
(0, _preact.h)(
'div',
- { className: 'col quiet' },
+ { className: 'col quiet hiddenActions' },
(0, _preact.h)(
'div',
- null,
+ { 'class': 'subtext' },
dataset.isBuilt ? 'cached' : ''
+ ),
+ (0, _preact.h)(
+ 'div',
+ { 'class': 'actions' },
+ (0, _preact.h)(
+ 'span',
+ { 'class': 'link', onClick: function onClick() {
+ return actions.train_task_now(dataset, 1);
+ } },
+ 'train'
+ ),
+ (0, _preact.h)(
+ 'span',
+ { 'class': 'link', onClick: function onClick() {
+ return actions.train_task_now(dataset, 2);
+ } },
+ '2x'
+ ),
+ (0, _preact.h)(
+ 'span',
+ { 'class': 'link', onClick: function onClick() {
+ return actions.train_task_now(dataset, 4);
+ } },
+ '4x'
+ ),
+ (0, _preact.h)(
+ 'span',
+ { 'class': 'link', onClick: function onClick() {
+ return actions.train_task_now(dataset, 6);
+ } },
+ '6x'
+ ),
+ (0, _preact.h)(
+ 'span',
+ { 'class': 'link', onClick: function onClick() {
+ return actions.train_task_now(dataset, 18);
+ } },
+ '18x'
+ )
)
),
(0, _preact.h)(
@@ -5981,6 +6096,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
var samplernnInitialState = {
loading: true,
+ progress: { i: 0, n: 0 },
error: null,
folders: [],
folder: {},
@@ -6068,6 +6184,11 @@ var samplernnReducer = function samplernnReducer() {
lossReport: action.lossReport
});
+ case _types2.default.app.load_progress:
+ return _extends({}, state, {
+ progress: action.progress
+ });
+
default:
return state;
}
@@ -7776,7 +7897,8 @@ exports.default = (_system$app$folder$fi = {
stderr: 'SYSTEM_STDERR'
},
app: {
- change_tool: "APP_CHANGE_TOOL"
+ change_tool: "APP_CHANGE_TOOL",
+ load_progress: "APP_LOAD_PROGRESS"
},
folder: (0, _crud.crud_type)('folder', []),
file: (0, _crud.crud_type)('file', []),
@@ -7917,7 +8039,7 @@ var allProgress = exports.allProgress = function allProgress(promises, progress_
promises.forEach(function (p) {
p.then(function (s) {
d += 1;
- progress_cb(d * 100 / promises.length, d, promises.length);
+ progress_cb(Math.floor(d * 100 / promises.length), d, promises.length);
return s;
});
});