diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-06-03 18:38:03 -0700 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-06-03 18:38:25 -0700 |
commit | 1b327f34c30e490e6f26ec1ee4e6cfe7b40a47eb (patch) | |
tree | 2bd7c0a01e4b6a9104162c164b7c156bf1f41ebb /web/src/js/ducks/eventLog.js | |
parent | ff9cc8b28393f6beba1ed42ade074672183313e9 (diff) | |
download | mitmproxy-1b327f34c30e490e6f26ec1ee4e6cfe7b40a47eb.tar.gz mitmproxy-1b327f34c30e490e6f26ec1ee4e6cfe7b40a47eb.tar.bz2 mitmproxy-1b327f34c30e490e6f26ec1ee4e6cfe7b40a47eb.zip |
web: add redux list views
Diffstat (limited to 'web/src/js/ducks/eventLog.js')
-rw-r--r-- | web/src/js/ducks/eventLog.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/web/src/js/ducks/eventLog.js b/web/src/js/ducks/eventLog.js index 081a2276..883f537c 100644 --- a/web/src/js/ducks/eventLog.js +++ b/web/src/js/ducks/eventLog.js @@ -1,4 +1,5 @@ import makeList, {ADD} from "./utils/list" +import {updateViewFilter, updateViewList} from "./utils/view" const TOGGLE_FILTER = 'TOGGLE_EVENTLOG_FILTER' const TOGGLE_VISIBILITY = 'TOGGLE_EVENTLOG_VISIBILITY' @@ -11,7 +12,6 @@ const { fetchList, } = makeList(UPDATE_LOG, "/events"); -export {updateList as updateLogEntries, fetchList as fetchLogEntries} const defaultState = { visible: false, @@ -34,7 +34,10 @@ export default function reducer(state = defaultState, action) { return { ...state, filter, - filteredEvents: state.events.list.filter(x => filter[x.level]) + filteredEvents: updateViewFilter( + state.events.list, + x => filter[x.level] + ) } case TOGGLE_VISIBILITY: return { @@ -46,7 +49,11 @@ export default function reducer(state = defaultState, action) { return { ...state, events, - filteredEvents: events.list.filter(x => state.filter[x.level]) + filteredEvents: updateViewList( + state.filteredEvents, + events, action, + x => state.filter[x.level] + ) } default: return state @@ -67,4 +74,5 @@ export function addLogEntry(message, level = "web") { level, id: `log-${id++}` }) -}
\ No newline at end of file +} +export {updateList as updateLogEntries, fetchList as fetchLogEntries}
\ No newline at end of file |