diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-04 03:13:46 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-04 03:13:46 +0200 |
| commit | 94f083788d58bccb09f775ef731827d29d719d43 (patch) | |
| tree | 0bc188ef302ddfc69365521d743cb9f6293ab327 /app/client/modules | |
| parent | 2f22fd5e4a558ed9b2379565be88b9d1e1b9b7c5 (diff) | |
promises progress
Diffstat (limited to 'app/client/modules')
| -rw-r--r-- | app/client/modules/samplernn/index.js | 2 | ||||
| -rw-r--r-- | app/client/modules/samplernn/samplernn.actions.js | 8 | ||||
| -rw-r--r-- | app/client/modules/samplernn/samplernn.datasets.js | 5 | ||||
| -rw-r--r-- | app/client/modules/samplernn/samplernn.show.js | 6 |
4 files changed, 12 insertions, 9 deletions
diff --git a/app/client/modules/samplernn/index.js b/app/client/modules/samplernn/index.js index d8ea9f8..9efb6de 100644 --- a/app/client/modules/samplernn/index.js +++ b/app/client/modules/samplernn/index.js @@ -15,7 +15,7 @@ function router () { <Route exact path='/samplernn/graph/' component={SampleRNNLoss} /> <Route exact path='/samplernn/inspect/' component={SampleRNNInspect} /> <Route exact path='/samplernn/import/' component={SampleRNNImport} /> - <Route exact path='/samplernn/datasets/' component={SampleRNNDatasets} /> + <Route exact path='/samplernn/datasets/' component={SampleRNNShow} /> <Route exact path='/samplernn/datasets/:id/' component={SampleRNNShow} /> <Route exact path='/samplernn/results/' component={SampleRNNResults} /> </section> diff --git a/app/client/modules/samplernn/samplernn.actions.js b/app/client/modules/samplernn/samplernn.actions.js index 30620a7..343550e 100644 --- a/app/client/modules/samplernn/samplernn.actions.js +++ b/app/client/modules/samplernn/samplernn.actions.js @@ -3,9 +3,11 @@ import types from '../../types' import actions from '../../actions' +import { allProgress } from '../../util' + export const load_directories = (id) => (dispatch) => { // console.log(actions) - Promise.all([ + allProgress([ actions.folder.index({ module: 'samplernn' }), actions.file.index({ module: 'samplernn' }), actions.task.index({ module: 'samplernn' }), @@ -13,7 +15,9 @@ export const load_directories = (id) => (dispatch) => { actions.socket.list_directory({ module: 'samplernn', dir: 'results' }), actions.socket.list_directory({ module: 'samplernn', dir: 'output' }), load_loss()(dispatch), - ]).then(res => { + ], (percent, i, n) => { + console.log(percent + "%") + }).then(res => { // console.log(res) const [folders, files, tasks, datasets, results, output, lossReport] = res diff --git a/app/client/modules/samplernn/samplernn.datasets.js b/app/client/modules/samplernn/samplernn.datasets.js index 0b7ccb8..683d44a 100644 --- a/app/client/modules/samplernn/samplernn.datasets.js +++ b/app/client/modules/samplernn/samplernn.datasets.js @@ -21,8 +21,8 @@ class SampleRNNDatasets extends Component { this.pickFile = this.pickFile.bind(this) } componentWillMount(){ - const id = this.props.id || this.props.match.params.id || localStorage.getItem('samplernn.last_id') - console.log('load dataset:', id) + 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) { @@ -60,7 +60,6 @@ class SampleRNNDatasets extends Component { } render(){ const { samplernn, match, history } = this.props - const id = this.props.id || localStorage.getItem('samplernn.last_id') if (samplernn.loading) { // console.log('loading') return <span>Loading</span> diff --git a/app/client/modules/samplernn/samplernn.show.js b/app/client/modules/samplernn/samplernn.show.js index f16758a..8e271fc 100644 --- a/app/client/modules/samplernn/samplernn.show.js +++ b/app/client/modules/samplernn/samplernn.show.js @@ -20,13 +20,12 @@ class SampleRNNShow extends Component { render(){ const { samplernn, match, history } = this.props const { folder } = samplernn || {} - console.log(folder) return ( <div className='app'> <div class='heading'> <h1>{folder ? folder.name : 'Loading...'}</h1> </div> - {folder && folder.name !== 'unsorted' && + {folder && folder.name && folder.name !== 'unsorted' && <DatasetForm title='Add Files' module={samplernnModule} @@ -35,7 +34,7 @@ class SampleRNNShow extends Component { /> } <SampleRNNDatasets - id={this.props.match.params.id} + id={this.props.match.params.id || localStorage.getItem('samplernn.last_id')} /> </div> ) @@ -44,6 +43,7 @@ class SampleRNNShow extends Component { const mapStateToProps = state => ({ samplernn: state.module.samplernn, + dataset: state.dataset, }) const mapDispatchToProps = (dispatch, ownProps) => ({ |
