Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add basic redux architecture, convert eventlog to redux
- Loading branch information
Showing
9 changed files
with
2,274 additions
and
812 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import {combineReducers} from 'redux' | ||
import {TOGGLE_EVENTLOG_FILTER} from "../reduxActions" | ||
|
||
const defaultVisibility = { | ||
"debug": false, | ||
"info": true, | ||
"web": true | ||
}; | ||
|
||
const visibilityFilter = (state = defaultVisibility, action) => { | ||
switch (action.type) { | ||
case TOGGLE_EVENTLOG_FILTER: | ||
return Object.assign({}, state, { | ||
[action.filter]: !state[action.filter] | ||
}); | ||
default: | ||
return state; | ||
} | ||
}; | ||
|
||
const entries = (state = [], action) => { | ||
return state; | ||
}; | ||
|
||
const eventLog = combineReducers({ | ||
visibilityFilter, | ||
entries | ||
}); | ||
|
||
export default eventLog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { combineReducers } from 'redux'; | ||
import eventLog from './eventlog' | ||
|
||
const mitmproxyApp = combineReducers({ | ||
eventLog | ||
}); | ||
|
||
export default mitmproxyApp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export const TOGGLE_EVENTLOG_FILTER = 'TOGGLE_EVENTLOG_FILTER'; | ||
export const HIDE_EVENTLOG = 'HIDE_EVENTLOG'; | ||
export const SHOW_EVENTLOG = 'SHOW_EVENTLOG'; | ||
|
||
export const EventLogFilters = { | ||
DEBUG: 'debug', | ||
INFO: 'info', | ||
WEB: 'web' | ||
}; | ||
|
||
export function toggleEventLogFilter(filter) { | ||
return {type: TOGGLE_EVENTLOG_FILTER, filter} | ||
} | ||
|
||
export function hideEventLog() { | ||
return {type: HIDE_EVENTLOG} | ||
} | ||
export function showEventLog() { | ||
return {type: SHOW_EVENTLOG} | ||
} |