diff options
| author | Zephyruso <[email protected]> | 2023-06-29 15:15:29 +0800 |
|---|---|---|
| committer | Zephyruso <[email protected]> | 2023-06-29 15:36:57 +0800 |
| commit | 45b9e9029e250e28d91d255488db0805b61cf9c2 (patch) | |
| tree | ddda19a3292f570e8984b337c72db3107ce30fdc /src/components | |
| parent | d497b15bedae37abb105d750ef1dfe16f6a7e05d (diff) | |
fix: source ip all
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/Connections.tsx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/components/Connections.tsx b/src/components/Connections.tsx index 9cf4b8b..cff9a26 100644 --- a/src/components/Connections.tsx +++ b/src/components/Connections.tsx @@ -24,6 +24,7 @@ import { connect } from './StateProvider'; import SvgYacd from './SvgYacd'; const { useEffect, useState, useRef, useCallback } = React; +const ALL_SOURCE_IP = 'ALL_SOURCE_IP'; const sourceMapInit = localStorage.getItem('sourceMap') ? JSON.parse(localStorage.getItem('sourceMap')) @@ -89,7 +90,7 @@ function filterConns(conns: FormattedConn[], keyword: string, sourceIp: string) }) ); } - if (sourceIp !== '') { + if (sourceIp !== ALL_SOURCE_IP) { result = filterConnIps(result, sourceIp); } @@ -268,14 +269,14 @@ function Conn({ apiConfig }) { const [closedConns, setClosedConns] = useState([]); const [filterKeyword, setFilterKeyword] = useState(''); - const [filterSourceIpStr, setFilterSourceIpStr] = useState(''); + const [filterSourceIpStr, setFilterSourceIpStr] = useState(ALL_SOURCE_IP); const filteredConns = filterConns(conns, filterKeyword, filterSourceIpStr); const filteredClosedConns = filterConns(closedConns, filterKeyword, filterSourceIpStr); const getConnIpList = (conns: FormattedConn[]) => { return [ - ['', t('All')], + [ALL_SOURCE_IP, t('All')], ...Array.from(new Set(conns.map((x) => x.sourceIP))) .sort() .map((value) => { |
