From 4bc41e2c2a8b3fc8b22226a7f3ec6cc1e1a275b6 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 21 May 2018 17:58:04 +0200 Subject: more dropdowns --- app/client/common/select.component.js | 15 +++++-- app/client/live/actions.js | 5 +++ app/client/live/index.js | 26 +++++++++++- app/client/live/reducer.js | 7 ++++ app/client/socket.js | 15 ++++++- public/assets/css/css.css | 9 +++-- public/bundle.js | 76 +++++++++++++++++++++++++++++++---- public/bundle.js.map | 2 +- 8 files changed, 136 insertions(+), 19 deletions(-) diff --git a/app/client/common/select.component.js b/app/client/common/select.component.js index 9ff60ce..3b008a3 100644 --- a/app/client/common/select.component.js +++ b/app/client/common/select.component.js @@ -15,10 +15,19 @@ class Select extends Component { } render() { const value = this.props.opt[this.props.name] - const options = this.props.options.map((key,i) => { + const options = (this.props.options || []).map((key,i) => { + let name, value + if (typeof key == 'string') { + name = key.length < 4 ? key.toUpperCase() : key + value = key + } else { + let frames = Math.round(key.count / 30) + ' s.' + name = key.name.replace(/_/g, ' ') + ' (' + frames + ')' + value = key.name + } return ( - ) }) diff --git a/app/client/live/actions.js b/app/client/live/actions.js index 5ee030a..026788d 100644 --- a/app/client/live/actions.js +++ b/app/client/live/actions.js @@ -16,6 +16,11 @@ export const list_checkpoints = () => { return { type: 'LOADING_CHECKPOINTS', } } +export const list_epochs = (path) => { + socket.list_epochs(path) + return { type: 'LOADING_EPOCHS', } +} + export const list_sequences = () => { socket.list_sequences() return { type: 'LOADING_SEQUENCES', } diff --git a/app/client/live/index.js b/app/client/live/index.js index c438e4b..5699266 100644 --- a/app/client/live/index.js +++ b/app/client/live/index.js @@ -16,8 +16,13 @@ class App extends Component { props.actions.list_checkpoints() props.actions.list_sequences() } + componentWillUpdate(nextProps) { + console.log('willupdate', nextProps.opt) + if (nextProps.opt.checkpoint_name !== this.props.opt.checkpoint_name) { + this.props.actions.list_epochs(nextProps.opt.checkpoint_name) + } + } render(){ - const props = this.props return (
@@ -32,6 +37,21 @@ class App extends Component { title='view mode' options={['a','b','sequence','recursive']} /> + +