diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-06 04:05:54 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-06 04:05:54 +0200 |
| commit | 2f4d1e9c43770ca4e72b736a08cd0e3b3945274f (patch) | |
| tree | 95881cf2020f636bf91cf98a560aa530328c3669 /app/client/modules | |
| parent | 563ca8019025dd1e1febc6179601eee0e1f62724 (diff) | |
form make more sense
Diffstat (limited to 'app/client/modules')
| -rw-r--r-- | app/client/modules/pix2wav/pix2wav.reducer.js | 8 | ||||
| -rw-r--r-- | app/client/modules/pix2wav/views/spectrogram.upload.js | 26 |
2 files changed, 21 insertions, 13 deletions
diff --git a/app/client/modules/pix2wav/pix2wav.reducer.js b/app/client/modules/pix2wav/pix2wav.reducer.js index 8db1046..def4f30 100644 --- a/app/client/modules/pix2wav/pix2wav.reducer.js +++ b/app/client/modules/pix2wav/pix2wav.reducer.js @@ -1,5 +1,6 @@ import types from '../../types' import datasetReducer from '../../dataset/dataset.reducer' +import util from '../../util' const pix2wavInitialState = { loading: true, @@ -25,7 +26,7 @@ const pix2wavReducer = (state = pix2wavInitialState, action) => { console.log(action) return { ...state, - status: 'Rendering frame /', + status: 'Rendering frame ' + action.count, } case types.wav2pix.draw_finish: return { @@ -37,6 +38,11 @@ const pix2wavReducer = (state = pix2wavInitialState, action) => { ...state, status: 'Built zip file', } + case types.wav2pix.uploading: + return { + ...state, + status: 'Uploading zip file (' + util.hush_size(action.size) + ')', + } default: return state } diff --git a/app/client/modules/pix2wav/views/spectrogram.upload.js b/app/client/modules/pix2wav/views/spectrogram.upload.js index fc469e1..0279e80 100644 --- a/app/client/modules/pix2wav/views/spectrogram.upload.js +++ b/app/client/modules/pix2wav/views/spectrogram.upload.js @@ -40,7 +40,7 @@ class SpectrogramUpload extends Component { this.audioElement.src = URL.createObjectURL(file) console.log(file.size) if (file.size < 2 << 20) { - console.log('booooooooo') + console.log('running le test!!!!!') this.props.wav2pix.renderFrames(file, {}) .then(frames => { console.log(frames) @@ -56,7 +56,7 @@ class SpectrogramUpload extends Component { const { file } = this.state this.props.wav2pix.buildZip(this.state.name, file, {}) .then(({ zip, count }) => { - this.props.datasetActions.uploadFile(pix2wavModule, this.props.pix2wav.folder_id, zip, { count }) + this.props.datasetActions.uploadFile(pix2wavModule, this.props.id, zip, { count }) }) } render(){ @@ -66,6 +66,7 @@ class SpectrogramUpload extends Component { // module={pix2wavModule} // data={pix2wav.data} // folder={folder} + console.log(this.props) const { file, frames } = this.state return ( <div className='row'> @@ -81,15 +82,6 @@ class SpectrogramUpload extends Component { mime='image.*' onUpload={file => this.pickFile(file)} /> - <TextInput - title='Dataset name' - onChange={e => this.setState({ name: e.target.value })} - value={this.state.name} - /> - <Button - onClick={() => this.buildZip()} - >Build Zip</Button> - <Progress /> {file && this.renderMetadata(file)} </Group> </div> @@ -112,7 +104,16 @@ class SpectrogramUpload extends Component { <Param title='Date'>{moment(file.lastModifiedDate).format("YYYY-MM-DD h:mm a")}</Param> <Param title='Duration'>{Math.floor(duration) + ' s.'}</Param> <br /> - <Param title='Status'>{this.props.pix2wav.status}</Param> + <Param title='Status'>{this.props.pix2wav.status}{this.props.upload.status}</Param> + <TextInput + title='Dataset name' + onChange={e => this.setState({ name: e.target.value })} + value={this.state.name} + /> + <Button + onClick={() => this.buildZip()} + >Build Zip</Button> + <Progress /> </div> ) } @@ -125,6 +126,7 @@ class SpectrogramUpload extends Component { const mapStateToProps = state => ({ pix2wav: state.module.pix2wav, + upload: state.upload, }) const mapDispatchToProps = (dispatch, ownProps) => ({ |
