diff options
Diffstat (limited to 'app/client/modules')
| -rw-r--r-- | app/client/modules/samplernn/datasets.component.js | 1 | ||||
| -rw-r--r-- | app/client/modules/samplernn/samplernn.reducer.js | 56 |
2 files changed, 53 insertions, 4 deletions
diff --git a/app/client/modules/samplernn/datasets.component.js b/app/client/modules/samplernn/datasets.component.js index 533b108..8f0d59a 100644 --- a/app/client/modules/samplernn/datasets.component.js +++ b/app/client/modules/samplernn/datasets.component.js @@ -155,6 +155,7 @@ class SampleRNNDatasets extends Component { <FileList files={samplernn.files} options={this.fileOptions} + linkFiles /> </div> </div> diff --git a/app/client/modules/samplernn/samplernn.reducer.js b/app/client/modules/samplernn/samplernn.reducer.js index 6a461a4..ba429ee 100644 --- a/app/client/modules/samplernn/samplernn.reducer.js +++ b/app/client/modules/samplernn/samplernn.reducer.js @@ -7,6 +7,10 @@ const samplernnInitialState = { folders: [], files: [], results: [], + upload: { + loading: true, + status: 'Loading...', + }, } const samplernnReducer = (state = samplernnInitialState, action) => { @@ -47,15 +51,59 @@ const samplernnReducer = (state = samplernnInitialState, action) => { files: [action.data].concat(this.files) } return + case types.folder.upload_loading: + return { + ...state, + upload: { + loading: true, + status: 'Loading...', + }, + } case types.folder.upload_error: - console.log(action) - return state + return { + ...state, + upload: { + loading: false, + status: 'Error uploading :(', + }, + } case types.folder.upload_progress: console.log(action) - return state + return { + ...state, + upload: { + loading: true, + status: 'Upload progress ' + action.percent + '%', + }, + } + case types.folder.upload_waiting: + console.log(action) + return { + ...state, + upload: { + loading: true, + status: 'Waiting for server to finish processing...', + }, + } case types.folder.upload_complete: console.log(action) - return state + if (state.folder.id === action.folder) { + return { + ...state, + files: state.files.concat(state.file), // sort here also + upload: { + loading: false, + }, + } + } else { + return { + ...state, + upload: { + loading: false, + status: 'Upload complete', + }, + } + } case types.socket.status: return samplernnSocket(state, action.data) default: |
