diff options
Diffstat (limited to 'app/client/modules/samplernn/samplernn.reducer.js')
| -rw-r--r-- | app/client/modules/samplernn/samplernn.reducer.js | 113 |
1 files changed, 8 insertions, 105 deletions
diff --git a/app/client/modules/samplernn/samplernn.reducer.js b/app/client/modules/samplernn/samplernn.reducer.js index efd31f5..b3b58c3 100644 --- a/app/client/modules/samplernn/samplernn.reducer.js +++ b/app/client/modules/samplernn/samplernn.reducer.js @@ -3,23 +3,22 @@ import types from '../../types' const samplernnInitialState = { loading: false, error: null, - folder: {}, folders: [], - files: [], + datasets: [], results: [], - upload: { - loading: false, - status: '', + input: { + folder: {}, + files: [], + }, + output: { + folder: {}, + files: [], }, } const samplernnReducer = (state = samplernnInitialState, action) => { console.log(action) switch(action.type) { - case types.socket.connect: - return { - ...state, - } case types.task.task_begin: return { ...state, @@ -29,102 +28,6 @@ const samplernnReducer = (state = samplernnInitialState, action) => { ...state, } - case types.folder.index: - return { - ...state, - folders: action.data, - folder: action.data[0], - } - case types.folder.update: - return state - case types.file.index: - return { - ...state, - files: action.data - } - - case types.folder.upload_loading: - return { - ...state, - upload: { - loading: true, - status: 'Loading...', - }, - } - case types.folder.upload_error: - return { - ...state, - upload: { - loading: false, - status: 'Error uploading :(', - }, - } - case types.folder.upload_progress: - console.log(action) - 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.file.create_loading: - return { - ...state, - upload: { - loading: true, - status: 'Creating file...' - } - } - case types.file.create: - console.log('booo') - if (state.folder.id === action.data.folder_id) { - return { - ...state, - files: [action.data].concat(state.files), - upload: { - loading: false, - status: 'File created', - }, - } - } else { - return { - ...state, - upload: { - loading: false, - status: 'created', - }, - } - } - case types.folder.upload_complete: - console.log(action) - if (state.folder.id === action.folder) { - return { - ...state, - files: [action.files].concat(state.files), - upload: { - loading: false, - status: 'Upload complete', - }, - } - } else { - return { - ...state, - upload: { - loading: false, - status: 'Upload complete', - }, - } - } case types.socket.status: return samplernnSocket(state, action.data) default: |
