diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-05 20:11:11 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-05 20:11:11 +0200 |
| commit | 18321f234e5261af43624b67c99a4dee3c060ed8 (patch) | |
| tree | 12268da123e441d07e7d15f6c24210bc3f594522 /app/client/modules/samplernn/samplernn.datasets.js | |
| parent | 24ec0726bf254f4e4398cf2bfa0c794978367744 (diff) | |
move views into own folder and begin prising away dataset code
Diffstat (limited to 'app/client/modules/samplernn/samplernn.datasets.js')
| -rw-r--r-- | app/client/modules/samplernn/samplernn.datasets.js | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/app/client/modules/samplernn/samplernn.datasets.js b/app/client/modules/samplernn/samplernn.datasets.js index 607f041..f8cba29 100644 --- a/app/client/modules/samplernn/samplernn.datasets.js +++ b/app/client/modules/samplernn/samplernn.datasets.js @@ -14,31 +14,6 @@ import Loading from '../../common/loading.component' import samplernnModule from './samplernn.module' class SampleRNNDatasets extends Component { - constructor(props){ - super(props) - this.pickFile = this.pickFile.bind(this) - } - componentWillMount(){ - const id = this.props.id - console.log('load dataset:', id, this.props.id) - const { match, samplernn, actions } = this.props - if (id === 'new') return - if (id) { - if (parseInt(id)) localStorage.setItem('samplernn.last_id', id) - if (! samplernn.folder || samplernn.folder.id !== id) { - actions.load_directories(id) - } - } - } - pickFile(file){ - console.log('pick', file) - } - onDeleteFile(file){ - const yes = confirm('Are you sure you want to delete this file?') - if (yes) { - actions.file.destroy(file) - } - } render(){ const { samplernn, folder, match, history } = this.props if (samplernn.loading) { @@ -128,16 +103,27 @@ class SampleRNNDatasets extends Component { }) return datasets } + onDeleteFile(file){ + const yes = confirm('Are you sure you want to delete this file?') + if (yes) { + console.log('delete: confirmed') + if (this.props.onDeleteFile) { + console.log('calling custom deletefile function') + this.props.onDeleteFile(file) + } else { + actions.file.destroy(file) + } + } + } } const mapStateToProps = state => ({ samplernn: state.module.samplernn, runner: state.system.runner, - task: state.task, }) const mapDispatchToProps = (dispatch, ownProps) => ({ - actions: bindActionCreators(samplernnActions, dispatch), + samplernnActions: bindActionCreators(samplernnActions, dispatch), }) export default connect(mapStateToProps, mapDispatchToProps)(SampleRNNDatasets) |
