diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-05-29 19:27:20 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-05-29 19:27:20 +0200 |
| commit | 24135cf037085f2ae7d70e48f023614435e29b3f (patch) | |
| tree | 50e4532300cfa990f37c945bb88c15b34104f569 /app/client/modules/samplernn | |
| parent | fe8cef1b709f09f508f17d0d6d06f204dd44a8bb (diff) | |
le file list
Diffstat (limited to 'app/client/modules/samplernn')
| -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: |
