From 10eab813d70a203e5b81583eac165e33a1bf6f6d Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 27 May 2018 03:36:38 +0200 Subject: auto scroll to bottom --- app/client/system/system.reducer.js | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'app/client/system/system.reducer.js') diff --git a/app/client/system/system.reducer.js b/app/client/system/system.reducer.js index a7ae8d1..c29572e 100644 --- a/app/client/system/system.reducer.js +++ b/app/client/system/system.reducer.js @@ -22,8 +22,6 @@ const systemInitialState = { rpc: { connected: false, status: "unknown", - cpu_cmd: "unknown", - gpu_cmd: "unknown", error: null, }, cmd: { @@ -34,6 +32,10 @@ const systemInitialState = { stdout: "", stderr: "", }, + runner: { + cpu: { status: 'IDLE', task: {} }, + gpu: { status: 'IDLE', task: {} }, + }, stdout: "", stderr: "", } @@ -109,7 +111,8 @@ const systemReducer = (state = systemInitialState, action) => { status: 'connected', connected: true, error: null, - } + }, + runner: action.runner, } case types.system.rpc_connected: return { @@ -147,9 +150,30 @@ const systemReducer = (state = systemInitialState, action) => { case types.task.task_begin: return { ...state, + runner: { + ...state.runner, + [action.task.processor]: { status: 'RUNNING', task: action.task }, + }, + cmd: { + ...state.cmd, + loaded: false, + stdout: "", + stderr: "", + }, stdout: "", stderr: "", } + case types.task.task_finish: + if (state.runner[action.task.processor].task.uuid !== action.task.uuid) { + return state + } + return { + ...state, + runner: { + ...state.runner, + [action.task.processor]: { status: 'IDLE', task: {} }, + }, + } case types.system.stdout: return { ...state, -- cgit v1.2.3-70-g09d2