diff options
| author | Larvan2 <[email protected]> | 2023-06-12 22:56:11 +0800 |
|---|---|---|
| committer | Larvan2 <[email protected]> | 2023-06-12 22:56:11 +0800 |
| commit | 7af346fb01600e86efda68065e57d673f4290f9b (patch) | |
| tree | c40f839bcd9e4b65c1559cc10c30ab7f70a3e48f /src/components | |
| parent | d33452cf28edd071965090d5b18437c12f0e9ddb (diff) | |
chore: adjust conn table
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/Connections.tsx | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/src/components/Connections.tsx b/src/components/Connections.tsx index 60997ae..dca3c98 100644 --- a/src/components/Connections.tsx +++ b/src/components/Connections.tsx @@ -145,12 +145,12 @@ function modifyChains(chains: string[]): string { //倒序 if (chains.length === 2) { - return chains[1] + ' / ' + chains[0]; + return chains[1] + ' ->' + chains[0]; } const first = chains.pop(); const last = chains.shift(); - return `${first} / ${last}`; + return `${first} ->${last}`; } function renderTableOrPlaceholder(conns: FormattedConn[]) { @@ -180,7 +180,7 @@ function Conn({ apiConfig }) { const filteredClosedConns = filterConns(closedConns, filterKeyword, filterSourceIpStr); const connIpSet = getConnIpList(conns); - const ClosedConnIpSet = getConnIpList(closedConns); + // const ClosedConnIpSet = getConnIpList(closedConns); const [isCloseAllModalOpen, setIsCloseAllModalOpen] = useState(false); const openCloseAllModal = useCallback(() => setIsCloseAllModalOpen(true), []); @@ -253,7 +253,7 @@ function Conn({ apiConfig }) { style={{ display: 'flex', flexWrap: 'wrap', - justifyContent: 'space-between', + justifyContent: 'flex-start', }} > <TabList> @@ -272,6 +272,22 @@ function Conn({ apiConfig }) { </span> </Tab> </TabList> + + <div> + <Button onClick={() => setFilterSourceIpStr('')} kind="minimal"> + {t('All')} + </Button> + {connIpSet.map((value, k) => { + if (value) { + return ( + <Button key={k} onClick={() => setFilterSourceIpStr(value)} kind="minimal"> + {value} + </Button> + ); + } + })} + {/* {renderTableOrPlaceholder(filteredClosedConns)} */} + </div> </div> <div ref={refContainer} style={{ padding: 30, paddingBottom: 10, paddingTop: 10 }}> <div @@ -281,16 +297,6 @@ function Conn({ apiConfig }) { }} > <TabPanel> - <Button onClick={() => setFilterSourceIpStr('')} kind="minimal"> - {t('All')} - </Button> - {connIpSet.map((value, k) => { - return ( - <Button key={k} onClick={() => setFilterSourceIpStr(value)} kind="minimal"> - {value} - </Button> - ); - })} {renderTableOrPlaceholder(filteredConns)} <Fab icon={isRefreshPaused ? <Play size={16} /> : <Pause size={16} />} @@ -304,19 +310,7 @@ function Conn({ apiConfig }) { </Action> </Fab> </TabPanel> - <TabPanel> - <Button onClick={() => setFilterSourceIpStr('')} kind="minimal"> - {t('All')} - </Button> - {ClosedConnIpSet.map((value, k) => { - return ( - <Button key={k} onClick={() => setFilterSourceIpStr(value)} kind="minimal"> - {value} - </Button> - ); - })} - {renderTableOrPlaceholder(filteredClosedConns)} - </TabPanel> + <TabPanel>{renderTableOrPlaceholder(filteredClosedConns)}</TabPanel> </div> </div> <ModalCloseAllConnections |
