Skip to content

Commit

Permalink
fix pkt filter
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyangXYZ committed Feb 4, 2024
1 parent 1bf13c2 commit cfc8ce9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
10 changes: 7 additions & 3 deletions src/components/PacketSniffer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -111,7 +115,7 @@ Row.inheritAttrs = false
<el-input
v-model="filterRules"
class="filter-input"
placeholder="pkt.src == 1 && pkt.type != ACK"
placeholder="pkt.mac_src == 1 && pkt.type != ACK"
:suffix-icon="Filter"
/>
</div>
Expand Down
12 changes: 6 additions & 6 deletions src/components/TopoEditToolbox.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { ref } from 'vue'
import { Network, SignalEditTopology, SignalAddNode, SignalUpdateLinks } from '@/hooks/useStates'
import { Check, Plus, Switch, Sort, Share, Download } from '@element-plus/icons-vue'
import { Check, Plus, Switch, Sort, Download } from '@element-plus/icons-vue'
import { NODE_TYPE } from '@/core/typedefs'
const nodeType = ref(0)
Expand Down Expand Up @@ -60,11 +60,11 @@ const exportTopo = () => {
</script>

<template>
<el-card >
<el-row :gutter="10" align="middle" >
<el-card>
<el-row :gutter="10" align="middle">
<el-col :span="6"> Load: </el-col>
<el-col :span="18">
<el-select v-model="Network.SelectedTopo.value" style="width: 100%; text-align-last: center">
<el-select v-model="Network.SelectedTopo.value" style="width: 100%; text-align-last: center">
<el-option v-for="(_, name) in Network.PresetTopos" :key="name" :label="name" :value="name" />
</el-select>
</el-col>
Expand All @@ -87,8 +87,8 @@ const exportTopo = () => {
<el-row :gutter="10" align="middle" class="row">
<el-col :span="6"> Connect: </el-col>
<el-col :span="15">
<el-row justify="space-between" >
<el-col :span="11" >
<el-row justify="space-between">
<el-col :span="11">
<el-input input-style="text-align=center" type="number" min="1" v-model="v1" />
</el-col>
<el-col :span="11">
Expand Down

0 comments on commit cfc8ce9

Please sign in to comment.