From cfc8ce9ad19dd5455fc0bb56633114798b85913a Mon Sep 17 00:00:00 2001 From: AmyangXYZ Date: Sun, 4 Feb 2024 17:16:12 -0500 Subject: [PATCH] fix pkt filter --- src/components/PacketSniffer.vue | 10 +++++++--- src/components/TopoEditToolbox.vue | 12 ++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/components/PacketSniffer.vue b/src/components/PacketSniffer.vue index b49b6eb..fcd5ea6 100644 --- a/src/components/PacketSniffer.vue +++ b/src/components/PacketSniffer.vue @@ -7,9 +7,13 @@ import { Filter } from '@element-plus/icons-vue' const filterRules = ref() -function filterFunc(pkt: Packet) { +function filterFunc(pkt: Packet): boolean { if (filterRules.value == undefined) return true - return eval(filterRules.value) + try { + return eval(filterRules.value) + } catch (error) { + return pkt != undefined + } } const columns: any = [ @@ -111,7 +115,7 @@ Row.inheritAttrs = false diff --git a/src/components/TopoEditToolbox.vue b/src/components/TopoEditToolbox.vue index 60764d4..9e147fe 100644 --- a/src/components/TopoEditToolbox.vue +++ b/src/components/TopoEditToolbox.vue @@ -1,7 +1,7 @@