summaryrefslogtreecommitdiff
path: root/app/client/dashboard/dashboard.component.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-06-16 15:16:13 +0200
committerJules Laplace <julescarbon@gmail.com>2018-06-16 15:16:13 +0200
commitf6c930431fff255935c8fd5dc22a95ef5db9fc34 (patch)
tree3ef8b0d53de9921e8b0a4c4470501270b7eb5e4f /app/client/dashboard/dashboard.component.js
parent3504248ae4db51380413c45699e4453efb314561 (diff)
dashboard stuff
Diffstat (limited to 'app/client/dashboard/dashboard.component.js')
-rw-r--r--app/client/dashboard/dashboard.component.js49
1 files changed, 44 insertions, 5 deletions
diff --git a/app/client/dashboard/dashboard.component.js b/app/client/dashboard/dashboard.component.js
index 58808a3..5d874c8 100644
--- a/app/client/dashboard/dashboard.component.js
+++ b/app/client/dashboard/dashboard.component.js
@@ -1,5 +1,6 @@
import { h, Component } from 'preact'
import { bindActionCreators } from 'redux'
+import { Link } from 'react-router-dom'
import { connect } from 'react-redux'
import Player from '../common/player.component'
@@ -10,10 +11,11 @@ import Button from '../common/button.component'
import DashboardHeader from './dashboardheader.component'
import TaskList from './tasklist.component'
-import { FileList } from '../common'
+import { FolderList, FileList } from '../common'
import Gallery from '../common/gallery.component'
import * as dashboardActions from './dashboard.actions'
+import * as audioPlayerActions from '../common/audioPlayer/audioPlayer.actions'
import modules from '../modules'
import actions from '../actions'
@@ -28,16 +30,48 @@ class Dashboard extends Component {
// this.props.actions.list_epochs(nextProps.opt.checkpoint_name)
}
render(){
- const { site, foldersByModule, queue, images } = this.props
+ const { site, foldersByModule, sampleRNNrenders, queue, images } = this.props
const { tasks } = queue
const folders = foldersByModule && Object.keys(modules).sort().map(key => {
console.log(key)
console.log(foldersByModule[key])
+ if (! foldersByModule[key]) return null
+ const path = key === 'samplernn' ? '/samplernn/datasets/' : '/' + key + '/sequences/'
+ const folders = foldersByModule[key].map(folder => {
+ return (
+ <div key={folder.id}>
+ <Link to={path + folder.id + '/'}>{folder.name}</Link>
+ </div>
+ )
+ })
+ const files = key === 'samplernn' && (
+ <FileList
+ files={sampleRNNrenders}
+ orderBy='date desc'
+ fields={'name date epoch size'}
+ onClick={(file, e) => {
+ e.preventDefault()
+ e.stopPropagation()
+ console.log('picked a file', file)
+ this.handlePick(file)
+ }}
+ />
+ )
+
return (
- <div>
+ <div className='dashboardModule' key={key}>
+ <div className='row moduleHeading'>
+ <h3>{key}</h3>
+ <div>
+ <Link to={'/' + key + '/new/'}>new</Link>
+ </div>
+ {folders}
+ </div>
+ {files}
</div>
)
- })
+ }).filter(a => !!a)
+ console.log(sampleRNNrenders)
return (
<div className='app dashboard'>
<DashboardHeader />
@@ -61,17 +95,22 @@ class Dashboard extends Component {
</div>
)
}
+ handlePick(file){
+ this.props.audioPlayer.play(file)
+ }
}
const mapStateToProps = state => ({
site: state.system.site,
foldersByModule: state.dashboard.data.foldersByModule,
+ sampleRNNrenders: state.dashboard.data.sampleRNNrenders,
images: state.dashboard.images,
files: state.dashboard.files,
queue: state.queue,
})
const mapDispatchToProps = (dispatch, ownProps) => ({
- actions: bindActionCreators(dashboardActions, dispatch)
+ actions: bindActionCreators(dashboardActions, dispatch),
+ audioPlayer: bindActionCreators(audioPlayerActions, dispatch),
})
export default connect(mapStateToProps, mapDispatchToProps)(Dashboard)