Skip to content

Commit

Permalink
feat(connection): allow filter out process name
Browse files Browse the repository at this point in the history
  • Loading branch information
greenhat616 committed Mar 3, 2024
1 parent 80fd7dd commit d277e47
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/pages/connections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useClashInfo } from "@/hooks/use-clash";
import { useWebsocket } from "@/hooks/use-websocket";
import { closeAllConnections } from "@/services/api";
import { atomConnectionSetting } from "@/services/states";
import { classNames } from "@/utils";
import parseTraffic from "@/utils/parse-traffic";
import {
ArrowDownward,
Expand All @@ -34,7 +35,6 @@ import { useTranslation } from "react-i18next";
import { Virtuoso } from "react-virtuoso";
import { useRecoilState } from "recoil";
import styles from "./connections..module.scss";
import { classNames } from "@/utils";

const initConn = { uploadTotal: 0, downloadTotal: 0, connections: [] };

Expand Down Expand Up @@ -65,8 +65,14 @@ export default function ConnectionsPage() {

const filterConn = useMemo(() => {
const orderFunc = orderOpts[curOrderOpt];
const connections = connData.connections.filter((conn) =>
(conn.metadata.host || conn.metadata.destinationIP)?.includes(filterText),
const connections = connData.connections.filter(
(conn) =>
(conn.metadata.host || conn.metadata.destinationIP)?.includes(
filterText,
) ||
(conn.metadata.process || conn.metadata.processPath)
?.toLowerCase()
.includes(filterText.toLowerCase()),
);

if (orderFunc) return orderFunc(connections);
Expand Down

0 comments on commit d277e47

Please sign in to comment.