summaryrefslogtreecommitdiff
path: root/app/client/system/system.actions.js
blob: 9e4f178f7f335e4b219fabaf7608039b734b674a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import socket from '../socket'
import types from '../types'

export const run = (cmd) => (dispatch) => {
  dispatch({ type: types.system.running_command, cmd })
  socket.actions.run_system_command(cmd)
  .then(data => {
    dispatch({
      type: types.system.command_output,
      data: data,
    })
  })
}

export const listDirectory = (opt) => (dispatch) => {
  dispatch({ type: types.system.listing_directory, opt })
  socket.actions.list_directory(opt)
  .then(data => {
    dispatch({
      type: types.system.list_directory,
      data: data,
    })
  })
}

export const changeTool = (tool) => {
  return { type: types.app.change_tool, tool }
}