From 96e19464f98b868bd93b76ac842ec5b32a17cfb6 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 26 May 2018 15:58:21 +0200 Subject: means to run remote commands and get output --- app/client/system/system.reducer.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (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 bc19fd1..e581813 100644 --- a/app/client/system/system.reducer.js +++ b/app/client/system/system.reducer.js @@ -1,3 +1,4 @@ +import types from '../types' import moment from 'moment' let FileSaver = require('file-saver') @@ -8,6 +9,15 @@ const systemInitialState = { site: { name: 'Lens Cortex', }, + cmd: { + loading: false, + loaded: false, + name: null, + error: null, + stdout: null, + stderr: null, + }, + currentTask: { id: 1072, activity: 'train', @@ -29,6 +39,9 @@ const systemInitialState = { { url: 'https://s3.amazonaws.com/i.asdf.us/bucky/data/4282/woodscaled_4_true_20180521_2150.png', }, + { + url: 'https://s3.amazonaws.com/i.asdf.us/bucky/data/4282/woodscaled_4_true_20180521_2146%20(1).png', + }, ], tasks: [ { @@ -98,6 +111,30 @@ const systemInitialState = { const systemReducer = (state = systemInitialState, action) => { switch(action.type) { + case types.system.running_command: + return { + ...state, + cmd: { + loading: true, + loaded: false, + name: action.cmd, + error: null, + stdout: null, + stderr: null, + } + } + case types.system.command_output: + return { + ...state, + cmd: { + loading: false, + loaded: true, + name: action.data.cmd, + error: action.data.error, + stdout: action.data.stdout, + stderr: action.data.stderr, + } + } default: return state } -- cgit v1.2.3-70-g09d2