diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-01-03 15:35:26 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-01-03 15:35:26 +0100 |
| commit | ee2471bb4ad8e190c1f2c1c47817046a2c4d6b30 (patch) | |
| tree | 8ca5338987e5777a598b0a0d0eebbfc3625f7272 /app/client/modules/biggan/views/biggan.results.js | |
| parent | d6bed4f04c5bba402ae2aa0b15dddfb98c5b3bf1 (diff) | |
adding biggan dataset stuff
Diffstat (limited to 'app/client/modules/biggan/views/biggan.results.js')
| -rw-r--r-- | app/client/modules/biggan/views/biggan.results.js | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/app/client/modules/biggan/views/biggan.results.js b/app/client/modules/biggan/views/biggan.results.js new file mode 100644 index 0000000..d76b301 --- /dev/null +++ b/app/client/modules/biggan/views/biggan.results.js @@ -0,0 +1,105 @@ +import { h, Component } from 'preact' +import { bindActionCreators } from 'redux' +import { Link } from 'react-router-dom'; +import { connect } from 'react-redux' +import util from '../../../util' + +import actions from '../../../actions' + +import * as bigganActions from '../biggan.actions' +import * as bigganTasks from '../biggan.tasks' + +import Loading from '../../../common/loading.component' +import { FileList, FileRow } from '../../../common/fileList.component' + +let yes_count = 0 + +class BigGANResults extends Component { + constructor(props){ + super() + if (!props.biggan.results) props.actions.load_results() + } + componentDidMount(){ + yes_count = 0 + } + render(){ + if (! this.props.biggan.results) return <Loading progress={this.props.biggan.progress} /> + + const { resultsFolder, results, renders, files } = this.props.biggan.results + // console.log(resultsFolder, results) + + return ( + <div className='app biggan'> + <div className='heading row middle'> + <h1>BigGAN Results</h1> + </div> + <div class='rows params renders'> + + <FileList + linkFiles + files={files} + orderBy='date desc' + fields={'name date size delete'} + onDelete={file => { + let yes; + if (yes_count < 3) { + yes = confirm('Are you sure you want to delete this file?') + } else { + yes = true + } + if (yes) { + yes_count += 1 + console.log('delete: confirmed') + actions.file.destroy(file) + } + }} + /> + <br /> + + <h3>renders on server</h3> + <FileList + files={renders} + orderBy='date desc' + fields={'name date size'} + onClick={(file, e) => { + e.preventDefault() + e.stopPropagation() + console.log('picked a result', file) + this.handlePick(file) + }} + /> + <br /> + + <h3>folders on server</h3> + <FileList + files={results} + orderBy='date desc' + fields={'name date count'} + onClick={(file, e) => { + e.preventDefault() + e.stopPropagation() + console.log('picked a result', file) + this.handlePick(file) + }} + /> + + </div> + </div> + ) + } + handlePick(file){ + // this.props.audioPlayer.play(file) + } +} + +const mapStateToProps = state => ({ + biggan: state.module.biggan, +}) + +const mapDispatchToProps = (dispatch, ownProps) => ({ + actions: bindActionCreators(bigganActions, dispatch), + remote: bindActionCreators(bigganTasks, dispatch), + // audioPlayer: bindActionCreators(audioPlayerActions, dispatch), +}) + +export default connect(mapStateToProps, mapDispatchToProps)(bigganResults) |
