MCPcopy
hub / github.com/mitmproxy/mitmproxy / selectRange

Function selectRange

web/src/js/ducks/flows/index.ts:378–397  ·  view source on GitHub ↗
(flow: Flow)

Source from the content-addressed store, hash-verified

376
377/** Select a range of flows with shift + click. */
378export function selectRange(flow: Flow) {
379 return (dispatch: AppDispatch, getState: () => RootState) => {
380 const { flows } = getState();
381 const prev = flows.selected[flows.selected.length - 1];
382
383 const thisIndex = flows._viewIndex.get(flow.id);
384 const prevIndex = flows._viewIndex.get(prev?.id);
385 if (thisIndex === undefined || prevIndex === undefined) {
386 return dispatch(select([flow]));
387 }
388 let newSelection: Flow[];
389 if (thisIndex <= prevIndex) {
390 newSelection = flows.view.slice(thisIndex, prevIndex + 1);
391 } else {
392 newSelection = flows.view.slice(prevIndex + 1, thisIndex + 1);
393 newSelection.push(prev); // Keep this at the end if the user shift-clicks again.
394 }
395 return dispatch(select(newSelection));
396 };
397}

Callers 1

FlowRow.tsxFile · 0.90

Calls 4

dispatchFunction · 0.85
getMethod · 0.45
sliceMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…