mirror of
https://github.com/brianshea2/meshmap.net.git
synced 2025-03-05 21:00:01 -08:00
parse mqtt topic into reporting node and root topic
This commit is contained in:
parent
12e7815bd6
commit
b2021f7b31
|
@ -251,23 +251,18 @@
|
||||||
}
|
}
|
||||||
</tbody></table>
|
</tbody></table>
|
||||||
<table><thead>
|
<table><thead>
|
||||||
<tr><th>Last seen</th><th>On MQTT topic</th></tr>
|
<tr><th>Last seen</th><th>via</th><th>on root topic</th></tr>
|
||||||
</thead><tbody>
|
</thead><tbody>
|
||||||
${Object.entries(seenBy).sort((a, b) => b[1] - a[1]).map(([topic, seen]) => {
|
${Object.entries(seenBy).sort((a, b) => b[1] - a[1]).map(([topic, seen]) => `
|
||||||
topic = html(topic).replace(/\/!([0-9a-f]+)$/, (match, reporterId) => {
|
<tr>
|
||||||
const reporterNum = Number(`0x${reporterId}`)
|
<td>${since(seen)}</td>
|
||||||
if (data[reporterNum] === undefined) {
|
<td>${topic.endsWith('/2/map/') ? 'map report' : topic.endsWith(`/${id}`) ? 'self' : topic.replace(/^.*\/(![0-9a-f]+)$/, (_, reporterId) => {
|
||||||
return match
|
const reporterNum = Number(`0x${reporterId.slice(1)}`)
|
||||||
}
|
return data[reporterNum] ? nodeLink(reporterNum, reporterId) : reporterId
|
||||||
return `/${nodeLink(reporterNum, `!${reporterId}`)}`
|
})}</td>
|
||||||
})
|
<td class="break">${html(topic.replace(/\/2\/e\/[^\/]+\/[^\/]+$|\/2\/map\/$/, ''))}</td>
|
||||||
return `
|
</tr>
|
||||||
<tr>
|
`).join('')}
|
||||||
<td>${since(seen)}</td>
|
|
||||||
<td class="break">${topic}</td>
|
|
||||||
</tr>
|
|
||||||
`
|
|
||||||
}).join('')}
|
|
||||||
</tbody></table>
|
</tbody></table>
|
||||||
`
|
`
|
||||||
const populateDetailsLayer = () => {
|
const populateDetailsLayer = () => {
|
||||||
|
|
Loading…
Reference in a new issue