summaryrefslogtreecommitdiff
path: root/public/bundle.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/bundle.js')
-rw-r--r--public/bundle.js97
1 files changed, 81 insertions, 16 deletions
diff --git a/public/bundle.js b/public/bundle.js
index da96b1f..2394646 100644
--- a/public/bundle.js
+++ b/public/bundle.js
@@ -263,7 +263,7 @@ var as_type = exports.as_type = function as_type(a, b) {
var crud_type = exports.crud_type = function crud_type(type) {
var actions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
- return actions.concat(['index_loading', 'index', 'index_error', 'show_loading', 'show', 'show_error', 'create_loading', 'create', 'create_error', 'update_loading', 'update', 'update_error', 'destroy_loading', 'destroy', 'destroy_error', 'upload_loading', 'upload_progress', 'upload_complete', 'upload_error', 'sort']).reduce(function (a, b) {
+ return actions.concat(['index_loading', 'index', 'index_error', 'show_loading', 'show', 'show_error', 'create_loading', 'create', 'create_error', 'update_loading', 'update', 'update_error', 'destroy_loading', 'destroy', 'destroy_error', 'upload_loading', 'upload_progress', 'upload_waiting', 'upload_complete', 'upload_error', 'sort']).reduce(function (a, b) {
return (a[b] = as_type(type, b)) && a;
}, {});
};
@@ -314,10 +314,18 @@ function crud_upload(type, fd, data, dispatch) {
function uploadProgress(e) {
if (e.lengthComputable) {
- dispatch && dispatch(_defineProperty({
- type: (0, _crud.as_type)(type, 'upload_progress'),
- percent: Math.round(e.loaded * 100 / e.total) || 0
- }, type, id));
+ var percent = Math.round(e.loaded * 100 / e.total) || 0;
+ if (percent > 99) {
+ dispatch && dispatch(_defineProperty({
+ type: (0, _crud.as_type)(type, 'upload_waiting'),
+ percent: percent
+ }, type, id));
+ } else {
+ dispatch && dispatch(_defineProperty({
+ type: (0, _crud.as_type)(type, 'upload_progress'),
+ percent: percent
+ }, type, id));
+ }
} else {
dispatch && dispatch(_defineProperty({
type: (0, _crud.as_type)(type, 'upload_error'),
@@ -433,6 +441,12 @@ htmlClassList.remove('loading');
// window.debug = false
+function randint(n) {
+ return Math.floor(Math.random() * n);
+}
+
+document.body.style.background = 'linear-gradient(' + (randint(40) + 40) + 'deg, #fde, #ffe)';
+
/***/ }),
/***/ "./app/client/common/button.component.js":
@@ -549,6 +563,8 @@ 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 _reactRouterDom = __webpack_require__(/*! react-router-dom */ "./node_modules/react-router-dom/es/index.js");
+
var _moment = __webpack_require__(/*! moment */ "./node_modules/moment/moment.js");
var _moment2 = _interopRequireDefault(_moment);
@@ -581,7 +597,9 @@ var FileList = function (_Component) {
value: function render() {
var _this2 = this;
- var files = this.props.files;
+ var _props = this.props,
+ files = _props.files,
+ linkFiles = _props.linkFiles;
var fileList = files.map(function (file) {
return (0, _preact.h)(
@@ -589,8 +607,12 @@ var FileList = function (_Component) {
{ 'class': 'row file', key: file.name },
(0, _preact.h)(
'div',
- { className: 'filename' },
- file.name || file.url
+ { className: 'filename', title: file.name || file.url },
+ linkFiles && file.url ? (0, _preact.h)(
+ 'a',
+ { target: '_blank', href: file.url },
+ file.name || file.url
+ ) : file.name || file.url
),
(0, _preact.h)(
'div',
@@ -600,12 +622,12 @@ var FileList = function (_Component) {
(0, _preact.h)(
'div',
{ className: 'date' },
- (0, _moment2.default)(file.created_at).format("YYYY-MM-DD H:mm")
+ (0, _moment2.default)(file.created_at).format("YYYY-MM-DD h:mm a")
),
(0, _preact.h)(
'div',
{ className: 'epoch' },
- file.epoch > 0 ? 'epoch ' + file.epoch : ''
+ file.epoch > 0 ? 'epoch ' + file.epoch : ' '
),
(0, _preact.h)(
'div',
@@ -3701,7 +3723,8 @@ var SampleRNNDatasets = function (_Component) {
),
(0, _preact.h)(_fileList2.default, {
files: samplernn.files,
- options: this.fileOptions
+ options: this.fileOptions,
+ linkFiles: true
})
)
);
@@ -3826,7 +3849,11 @@ var samplernnInitialState = {
folder: {},
folders: [],
files: [],
- results: []
+ results: [],
+ upload: {
+ loading: true,
+ status: 'Loading...'
+ }
};
var samplernnReducer = function samplernnReducer() {
@@ -3861,15 +3888,53 @@ var samplernnReducer = function samplernnReducer() {
files: [action.data].concat(undefined.files)
});
return;
+ case _types2.default.folder.upload_loading:
+ return _extends({}, state, {
+ upload: {
+ loading: true,
+ status: 'Loading...'
+ }
+ });
case _types2.default.folder.upload_error:
- console.log(action);
- return state;
+ return _extends({}, state, {
+ upload: {
+ loading: false,
+ status: 'Error uploading :('
+ }
+ });
case _types2.default.folder.upload_progress:
console.log(action);
- return state;
+ return _extends({}, state, {
+ upload: {
+ loading: true,
+ status: 'Upload progress ' + action.percent + '%'
+ }
+ });
+ case _types2.default.folder.upload_waiting:
+ console.log(action);
+ return _extends({}, state, {
+ upload: {
+ loading: true,
+ status: 'Waiting for server to finish processing...'
+ }
+ });
case _types2.default.folder.upload_complete:
console.log(action);
- return state;
+ if (state.folder.id === action.folder) {
+ return _extends({}, state, {
+ files: state.files.concat(state.file), // sort here also
+ upload: {
+ loading: false
+ }
+ });
+ } else {
+ return _extends({}, state, {
+ upload: {
+ loading: false,
+ status: 'Upload complete'
+ }
+ });
+ }
case _types2.default.socket.status:
return samplernnSocket(state, action.data);
default: