MCPcopy
hub / github.com/mitmproxy/mitmproxy / FlowView

Function FlowView

web/src/js/components/FlowView.tsx:67–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65}
66
67export default function FlowView() {
68 const dispatch = useAppDispatch();
69 const flow = useAppSelector((state) => state.flows.selected[0]);
70 let active = useAppSelector((state) => state.ui.flow.tab);
71
72 if (flow == undefined) {
73 return <></>;
74 }
75
76 const tabs = tabsForFlow(flow);
77
78 if (tabs.indexOf(active) < 0) {
79 if (active === "response" && flow.error) {
80 active = "error";
81 } else if (active === "error" && "response" in flow) {
82 active = "response";
83 } else {
84 active = tabs[0];
85 }
86 }
87 const Tab = allTabs[active];
88
89 return (
90 <div className="flow-detail">
91 <nav className="nav-tabs nav-tabs-sm">
92 <button
93 data-testid="close-button-id"
94 className="close-button"
95 onClick={() => dispatch(flowsActions.select([]))}
96 >
97 <i className="fa fa-times-circle"></i>
98 </button>
99 {tabs.map((tabId) => (
100 <a
101 key={tabId}
102 href="#"
103 className={classnames({ active: active === tabId })}
104 onClick={(event) => {
105 event.preventDefault();
106 dispatch(selectTab(tabId));
107 }}
108 >
109 {allTabs[tabId].displayName}
110 </a>
111 ))}
112 </nav>
113 <Tab flow={flow} />
114 </div>
115 );
116}

Callers

nothing calls this directly

Calls 6

useAppDispatchFunction · 0.90
selectTabFunction · 0.90
tabsForFlowFunction · 0.85
dispatchFunction · 0.85
selectMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…