diff options
author | Aldo Cortesi <aldo@corte.si> | 2016-12-16 10:04:12 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-16 10:04:12 +1300 |
commit | 6b5673e84911f3e2b1599c22c9b4f482a55b9ef1 (patch) | |
tree | a6f54fdb9d9be4d6b061a3b30069b330d9325fd5 /web/src/js/ducks/flows.js | |
parent | 78c78ce651478072f3b0a4a7d18f2a8de3147d33 (diff) | |
parent | d854e08653ccee12119266e2cc3f5d6c279341e5 (diff) | |
download | mitmproxy-6b5673e84911f3e2b1599c22c9b4f482a55b9ef1.tar.gz mitmproxy-6b5673e84911f3e2b1599c22c9b4f482a55b9ef1.tar.bz2 mitmproxy-6b5673e84911f3e2b1599c22c9b4f482a55b9ef1.zip |
Merge pull request #1845 from mhils/mitmweb-improvements
Mitmweb Improvements
Diffstat (limited to 'web/src/js/ducks/flows.js')
-rw-r--r-- | web/src/js/ducks/flows.js | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/web/src/js/ducks/flows.js b/web/src/js/ducks/flows.js index d3717533..92408891 100644 --- a/web/src/js/ducks/flows.js +++ b/web/src/js/ducks/flows.js @@ -36,8 +36,29 @@ export default function reduce(state = defaultState, action) { makeFilter(state.filter), makeSort(state.sort) ) + + let selected = state.selected + if(action.type === REMOVE && state.selected.includes(action.data)) { + if(state.selected.length > 1){ + selected = selected.filter(x => x !== action.data) + } else { + selected = [] + if (action.data in state.viewIndex && state.view.length > 1) { + let currentIndex = state.viewIndex[action.data], + nextSelection + if(currentIndex === state.view.length -1){ // last row + nextSelection = state.view[currentIndex - 1] + } else { + nextSelection = state.view[currentIndex + 1] + } + selected.push(nextSelection.id) + } + } + } + return { ...state, + selected, ...reduceStore(state, storeAction) } @@ -48,6 +69,12 @@ export default function reduce(state = defaultState, action) { ...reduceStore(state, storeActions.setFilter(makeFilter(action.filter), makeSort(state.sort))) } + case SET_HIGHLIGHT: + return { + ...state, + highlight: action.highlight + } + case SET_SORT: return { ...state, @@ -144,14 +171,23 @@ export function selectRelative(shift) { } -export function accept(flow) { - return dispatch => fetchApi(`/flows/${flow.id}/accept`, { method: 'POST' }) +export function resume(flow) { + return dispatch => fetchApi(`/flows/${flow.id}/resume`, { method: 'POST' }) +} + +export function resumeAll() { + return dispatch => fetchApi('/flows/resume', { method: 'POST' }) +} + +export function kill(flow) { + return dispatch => fetchApi(`/flows/${flow.id}/kill`, { method: 'POST' }) } -export function acceptAll() { - return dispatch => fetchApi('/flows/accept', { method: 'POST' }) +export function killAll() { + return dispatch => fetchApi('/flows/kill', { method: 'POST' }) } + export function remove(flow) { return dispatch => fetchApi(`/flows/${flow.id}`, { method: 'DELETE' }) } |