summaryrefslogtreecommitdiff
path: root/app/client/live
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-05-21 18:36:36 +0200
committerJules Laplace <julescarbon@gmail.com>2018-05-21 18:36:36 +0200
commit71f3bffcd69b5aad4319b1362cf35c8efd51bc10 (patch)
tree2375dbed44d09f37f057354935ea9043b44028f3 /app/client/live
parent4bc41e2c2a8b3fc8b22226a7f3ec6cc1e1a275b6 (diff)
wooooord
Diffstat (limited to 'app/client/live')
-rw-r--r--app/client/live/actions.js10
-rw-r--r--app/client/live/index.js21
-rw-r--r--app/client/live/reducer.js9
3 files changed, 36 insertions, 4 deletions
diff --git a/app/client/live/actions.js b/app/client/live/actions.js
index 026788d..eb0a2ff 100644
--- a/app/client/live/actions.js
+++ b/app/client/live/actions.js
@@ -25,3 +25,13 @@ export const list_sequences = () => {
socket.list_sequences()
return { type: 'LOADING_SEQUENCES', }
}
+
+export const load_sequence = (sequence) => {
+ socket.load_sequence(sequence)
+ return { type: 'LOADING_SEQUENCE', }
+}
+
+export const load_epoch = (checkpoint, epoch) => {
+ socket.load_epoch(checkpoint, epoch)
+ return { type: 'LOADING_CHECKPOINT', }
+}
diff --git a/app/client/live/index.js b/app/client/live/index.js
index 5699266..44cc70b 100644
--- a/app/client/live/index.js
+++ b/app/client/live/index.js
@@ -15,12 +15,28 @@ class App extends Component {
props.actions.get_params()
props.actions.list_checkpoints()
props.actions.list_sequences()
+ this.changeCheckpoint = this.changeCheckpoint.bind(this)
+ this.changeEpoch = this.changeEpoch.bind(this)
+ this.changeSequence = this.changeSequence.bind(this)
}
componentWillUpdate(nextProps) {
console.log('willupdate', nextProps.opt)
- if (nextProps.opt.checkpoint_name !== this.props.opt.checkpoint_name) {
+ if (! nextProps.epochs || nextProps.opt.checkpoint_name !== this.props.opt.checkpoint_name) {
this.props.actions.list_epochs(nextProps.opt.checkpoint_name)
}
+ if (! nextProps.epochs || nextProps.opt.checkpoint_name !== this.props.opt.checkpoint_name) {
+ this.props.actions.list_epochs(nextProps.opt.checkpoint_name)
+ }
+ }
+ changeCheckpoint(checkpoint_name){
+ this.props.actions.load_epoch(checkpoint_name, 'latest')
+ }
+ changeEpoch(epoch_name){
+ this.props.actions.load_epoch(this.props.opt.checkpoint_name, epoch_name)
+ }
+ changeSequence(sequence){
+ console.log('got sequence', sequence)
+ this.props.actions.load_sequence(sequence)
}
render(){
return (
@@ -41,16 +57,19 @@ class App extends Component {
name='checkpoint_name'
title='checkpoint'
options={this.props.checkpoints}
+ onChange={this.changeCheckpoint}
/>
<Select
name='epoch'
title='epoch'
options={this.props.epochs}
+ onChange={this.changeEpoch}
/>
<Select
name='sequence_name'
title='sequence'
options={this.props.sequences}
+ onChange={this.changeSequence}
/>
</ParamGroup>
</div>
diff --git a/app/client/live/reducer.js b/app/client/live/reducer.js
index e14a039..f774d3e 100644
--- a/app/client/live/reducer.js
+++ b/app/client/live/reducer.js
@@ -37,13 +37,16 @@ const liveReducer = (state = liveInitialState, action) => {
return {
...state,
checkpoints: action.checkpoints,
+ epochs: [],
}
- case 'LIST_CHECKPOINT_DIR':
+ case 'LIST_EPOCHS':
return {
...state,
- checkpoint_dir: action.checkpoint_dir,
- }
+ epochs: action.epochs.map(a => [ a == 'latest' ? Infinity : a, a ])
+ .sort((a,b) => a[0] - b[0])
+ .map(a => a[1])
+ }
case 'LIST_SEQUENCES':
return {