summaryrefslogtreecommitdiff
path: root/app/client
diff options
context:
space:
mode:
Diffstat (limited to 'app/client')
-rw-r--r--app/client/live/live.actions.js22
-rw-r--r--app/client/socket/socket.live.js8
-rw-r--r--app/client/system/system.component.js11
3 files changed, 25 insertions, 16 deletions
diff --git a/app/client/live/live.actions.js b/app/client/live/live.actions.js
index e63854e..0bdd8d7 100644
--- a/app/client/live/live.actions.js
+++ b/app/client/live/live.actions.js
@@ -1,53 +1,53 @@
-import * as socket from '../socket'
+import socket from '../socket'
import types from '../types'
export const get_params = () => {
- socket.get_params()
+ socket.live.get_params()
return { type: types.player.get_params, }
}
export const set_param = (key, value) => {
console.log('set param', key, value)
- socket.set_param(key, value)
+ socket.live.set_param(key, value)
return { type: types.player.set_param, key, value, }
}
export const list_checkpoints = () => {
- socket.list_checkpoints()
+ socket.live.list_checkpoints()
return { type: types.player.loading_checkpoints, }
}
export const list_epochs = (path) => {
- socket.list_epochs(path)
+ socket.live.list_epochs(path)
return { type: types.player.loading_epochs, }
}
export const list_sequences = () => {
- socket.list_sequences()
+ socket.live.list_sequences()
return { type: types.player.loading_sequences }
}
export const load_sequence = (sequence) => {
- socket.load_sequence(sequence)
+ socket.live.load_sequence(sequence)
return { type: types.player.loading_sequence, }
}
export const load_epoch = (checkpoint, epoch) => {
- socket.load_epoch(checkpoint, epoch)
+ socket.live.load_epoch(checkpoint, epoch)
return { type: types.player.loading_checkpoint, }
}
export const seek = (frame) => {
- socket.seek(frame)
+ socket.live.seek(frame)
return { type: types.player.seeking, }
}
export const pause = (frame) => {
- socket.pause(pause)
+ socket.live.pause(pause)
return { type: types.player.pausing, }
}
export const play = (frame) => {
- socket.play()
+ socket.live.play()
return { type: types.player.playing, }
}
diff --git a/app/client/socket/socket.live.js b/app/client/socket/socket.live.js
index c55695f..867b391 100644
--- a/app/client/socket/socket.live.js
+++ b/app/client/socket/socket.live.js
@@ -15,25 +15,25 @@ socket.on('res', (data) => {
}
break
case 'get_params':
- store.dispatch({
+ dispatch({
type: types.socket.load_params,
opt: data.res,
})
break
case 'list_checkpoints':
- store.dispatch({
+ dispatch({
type: types.socket.list_checkpoints,
checkpoints: data.res,
})
break
case 'list_sequences':
- store.dispatch({
+ dispatch({
type: types.socket.list_sequences,
sequences: data.res,
})
break
case 'list_epochs':
- store.dispatch({
+ dispatch({
type: types.socket.list_epochs,
epochs: data.res,
})
diff --git a/app/client/system/system.component.js b/app/client/system/system.component.js
index 8c8767f..a663acf 100644
--- a/app/client/system/system.component.js
+++ b/app/client/system/system.component.js
@@ -6,6 +6,7 @@ import Group from '../common/group.component'
import Param from '../common/param.component'
import * as systemActions from './system.actions'
+import * as liveActions from '../live/live.actions'
import * as taskActions from '../task/task.actions'
const cpu_test_task = {
@@ -29,6 +30,8 @@ const live_test_task = {
epochs: 1,
opt: {}
}
+const fruits = ["apple","pear","banana","strawberry"]
+function choice(a){ return a[Math.floor(Math.random()*a.length)]}
class System extends Component {
constructor(props){
@@ -86,6 +89,10 @@ class System extends Component {
<button onClick={() => actions.task.start_task(live_test_task, { preempt: true, watch: true })}>Start</button>
<button onClick={() => actions.task.stop_task(live_test_task)}>Stop</button>
</Param>
+ <Param title='Test Live RPC'>
+ <button onClick={() => actions.live.get_params()}>Get</button>
+ <button onClick={() => actions.live.set_param('fruit', choice(fruits))}>Set</button>
+ </Param>
</Group>
</div>
{this.renderCommandOutput()}
@@ -135,13 +142,15 @@ class System extends Component {
}
}
const mapStateToProps = state => ({
- ...state.system
+ ...state.system,
+ ...state.live,
})
const mapDispatchToProps = (dispatch, ownProps) => ({
actions: {
system: bindActionCreators(systemActions, dispatch),
task: bindActionCreators(taskActions, dispatch),
+ live: bindActionCreators(liveActions, dispatch),
},
})