summaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
author汐殇 <[email protected]>2023-06-29 15:39:01 +0800
committerGitHub <[email protected]>2023-06-29 15:39:01 +0800
commita0435f9f1293d65e4c43226136d8bfe7871eb377 (patch)
treeddda19a3292f570e8984b337c72db3107ce30fdc /src/components
parentd497b15bedae37abb105d750ef1dfe16f6a7e05d (diff)
parent45b9e9029e250e28d91d255488db0805b61cf9c2 (diff)
Merge pull request #65 from Zephyruso/fix-source-ip-all
fix: source ip all
Diffstat (limited to 'src/components')
-rw-r--r--src/components/Connections.tsx7
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) => {