aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/ducks/eventLog.js
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-10-31 05:30:32 -0700
committerMaximilian Hils <git@maximilianhils.com>2016-11-08 17:54:27 +0100
commit85476d9915f23fc45e64b5242e804623f50cd20a (patch)
tree9fdca1d74c1bcf3f9dafc26cd4d2786c3ae8b81e /web/src/js/ducks/eventLog.js
parent62ca89649237cb0aff63b1fd3d7729b42134bdd1 (diff)
downloadmitmproxy-85476d9915f23fc45e64b5242e804623f50cd20a.tar.gz
mitmproxy-85476d9915f23fc45e64b5242e804623f50cd20a.tar.bz2
mitmproxy-85476d9915f23fc45e64b5242e804623f50cd20a.zip
clean up mitmweb
Diffstat (limited to 'web/src/js/ducks/eventLog.js')
-rw-r--r--web/src/js/ducks/eventLog.js65
1 files changed, 8 insertions, 57 deletions
diff --git a/web/src/js/ducks/eventLog.js b/web/src/js/ducks/eventLog.js
index f72d7bd6..76572a5d 100644
--- a/web/src/js/ducks/eventLog.js
+++ b/web/src/js/ducks/eventLog.js
@@ -1,17 +1,12 @@
import reduceList, * as listActions from './utils/list'
import reduceView, * as viewActions from './utils/view'
-import * as websocketActions from './websocket'
-import * as msgQueueActions from './msgQueue'
-export const MSG_TYPE = 'UPDATE_EVENTLOG'
-export const DATA_URL = '/events'
-
-export const ADD = 'EVENTLOG_ADD'
-export const RECEIVE = 'EVENTLOG_RECEIVE'
-export const TOGGLE_VISIBILITY = 'EVENTLOG_TOGGLE_VISIBILITY'
-export const TOGGLE_FILTER = 'EVENTLOG_TOGGLE_FILTER'
-export const UNKNOWN_CMD = 'EVENTLOG_UNKNOWN_CMD'
-export const FETCH_ERROR = 'EVENTLOG_FETCH_ERROR'
+export const ADD = 'EVENTS_ADD'
+export const RECEIVE = 'EVENTS_RECEIVE'
+export const TOGGLE_VISIBILITY = 'EVENTS_TOGGLE_VISIBILITY'
+export const TOGGLE_FILTER = 'EVENTS_TOGGLE_FILTER'
+export const UNKNOWN_CMD = 'EVENTS_UNKNOWN_CMD'
+export const FETCH_ERROR = 'EVENTS_FETCH_ERROR'
const defaultState = {
logId: 0,
@@ -54,8 +49,8 @@ export default function reduce(state = defaultState, action) {
case RECEIVE:
return {
...state,
- list: reduceList(state.list, listActions.receive(action.list)),
- view: reduceView(state.view, viewActions.receive(action.list, log => state.filters[log.level])),
+ list: reduceList(state.list, listActions.receive(action.events)),
+ view: reduceView(state.view, viewActions.receive(action.events, log => state.filters[log.level])),
}
default:
@@ -63,58 +58,14 @@ export default function reduce(state = defaultState, action) {
}
}
-/**
- * @public
- */
export function toggleFilter(filter) {
return { type: TOGGLE_FILTER, filter }
}
-/**
- * @public
- *
- * @todo move to ui?
- */
export function toggleVisibility() {
return { type: TOGGLE_VISIBILITY }
}
-/**
- * @public
- */
export function add(message, level = 'web') {
return { type: ADD, message, level }
}
-
-/**
- * This action creater takes all WebSocket events
- *
- * @public websocket
- */
-export function handleWsMsg(msg) {
- switch (msg.cmd) {
-
- case websocketActions.CMD_ADD:
- return add(msg.data.message, msg.data.level)
-
- case websocketActions.CMD_RESET:
- return fetchData()
-
- default:
- return { type: UNKNOWN_CMD, msg }
- }
-}
-
-/**
- * @public websocket
- */
-export function fetchData() {
- return msgQueueActions.fetchData(MSG_TYPE)
-}
-
-/**
- * @public msgQueue
- */
-export function receiveData(list) {
- return { type: RECEIVE, list }
-}