()
| 65 | } |
| 66 | |
| 67 | export 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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…