From 2b837a59ac17a0178e7ea2644d69c083682622f9 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 9 Jan 2020 21:24:47 +0100 Subject: receive updates from app --- app/client/live/live.reducer.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'app/client/live') 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, -- cgit v1.2.3-70-g09d2