Skip to content

Commit

Permalink
fix: frame details
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed May 14, 2024
1 parent f22e628 commit 99eacd1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 25 deletions.
12 changes: 4 additions & 8 deletions src/components/custom/FrameDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</tr>
<tr>
<td>Region</td>
<td>{{ getRegion(value.region) }}</td>
<td>{{ getRegion(value) }}</td>
</tr>
<tr>
<td>RSSI</td>
Expand All @@ -46,14 +46,10 @@
<td>{{ value.homeId?.toString(16) }}</td>
</tr>
<tr>
<td>Source Node ID</td>
<td>{{ value.sourceNodeId }}</td>
</tr>
<tr>
<td>Destination Node ID</td>
<td>{{ value.destinationNodeId }}</td>
<td>Route</td>
<td>{{ getRepeaters(value) }}</td>
</tr>
<tr>
<tr v-if="value.ackRequested !== undefined">
<td>Ack Requested</td>
<td>{{ value.ackRequested }}</td>
</tr>
Expand Down
35 changes: 20 additions & 15 deletions src/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,26 +215,31 @@ export function getProtocolColor(node) {
}
}

export function getRegion(region) {
export function getRegion(item) {
return (
znifferRegions.find((r) => r.value === region)?.text ||
`Unknown region ${region}`
znifferRegions.find((r) => r.value === item?.region)?.text ||
`Unknown region ${item?.region}`
)
}
export function getRepeaters(item) {
const repRSSI = item.repeaterRSSI || []
return item.repeaters?.length > 0
? item.repeaters
.map(
(r, i) =>
`${r}${
repRSSI[i] && !isRssiError(repRSSI[i])
? ` (${rssiToString(repRSSI[i])})`
: ''
}`,
)
.join(', ')
: 'None, direct connection'
const repeatersString =
item.repeaters?.length > 0
? item.repeaters
.map(
(r, i) =>
`${r}${
repRSSI[i] && !isRssiError(repRSSI[i])
? ` (${rssiToString(repRSSI[i])})`
: ''
}`,
)
.join(' > ')
: ''

return `${item.sourceNodeId} >${
repeatersString ? ' ' + repeatersString + ' ' : ''
}> ${item.destinationNodeId}`
}
export function getType(item) {
return getEnumMemberName(ZWaveFrameType, item.type)
Expand Down
2 changes: 0 additions & 2 deletions src/views/Zniffer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ import { inboundEvents as socketActions } from '@server/lib/SocketEvents'
import { znifferRegions } from '../lib/items.js'
import {
uuid,
getRegion,
getRepeaters,
getType,
getRssi,
Expand Down Expand Up @@ -475,7 +474,6 @@ export default {
const ms = date.getMilliseconds()
return `${date.toTimeString().split(' ')[0]}.${ms}`
},
getRegion,
getRepeaters,
getType,
getRssi,
Expand Down

0 comments on commit 99eacd1

Please sign in to comment.