summaryrefslogtreecommitdiff
path: root/app/client/system/system.reducer.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-05-26 15:58:21 +0200
committerJules Laplace <julescarbon@gmail.com>2018-05-26 15:58:21 +0200
commit96e19464f98b868bd93b76ac842ec5b32a17cfb6 (patch)
treea232cfecd631d49fae8d1402371a284296aeec87 /app/client/system/system.reducer.js
parent28f4bd59314df8162548a1100b280bd256436eaa (diff)
means to run remote commands and get output
Diffstat (limited to 'app/client/system/system.reducer.js')
-rw-r--r--app/client/system/system.reducer.js37
1 files changed, 37 insertions, 0 deletions
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
}