summaryrefslogtreecommitdiff
path: root/app/client/live
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-01-09 21:24:47 +0100
committerJules Laplace <julescarbon@gmail.com>2020-01-09 21:24:47 +0100
commit2b837a59ac17a0178e7ea2644d69c083682622f9 (patch)
treed15a2fa9932e2caf100d2541bb921a1d5ca0bf77 /app/client/live
parent7b031ee255679351249c8fb722645a030dc6e98a (diff)
receive updates from app
Diffstat (limited to 'app/client/live')
-rw-r--r--app/client/live/live.reducer.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/app/client/live/live.reducer.js b/app/client/live/live.reducer.js
index 8112d31..d352d25 100644
--- a/app/client/live/live.reducer.js
+++ b/app/client/live/live.reducer.js
@@ -23,7 +23,7 @@ const liveInitialState = {
}
const liveReducer = (state = liveInitialState, action) => {
- console.log(action)
+ // console.log(action)
let results;
switch(action.type) {
case types.socket.load_params:
@@ -110,6 +110,23 @@ const liveReducer = (state = liveInitialState, action) => {
case types.system.stdout:
if (action.data.processor === 'gpu') {
+ // receive parameter updates from the app
+ if (action.data.data.indexOf('set_opt') !== -1) {
+ const new_opt = action.data.data.trim().split('\n').reduce((a,b) => {
+ if (b.indexOf('set_opt') === 0) {
+ const terms = b.split(' ')
+ a[terms[1]] = terms[2]
+ }
+ return a
+ }, {})
+ return {
+ ...state,
+ opt: {
+ ...state.opt,
+ [line[1]]: line[2],
+ }
+ }
+ }
return {
...state,
last_message: action.data.data,