mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-12-02 21:00:02 -05:00
tidy up code for interface stats
This commit is contained in:
parent
52e0c1b86a
commit
9e5f65c55f
1 changed files with 22 additions and 12 deletions
|
|
@ -707,9 +707,10 @@
|
|||
</button>
|
||||
|
||||
<!-- interface list -->
|
||||
<div v-for="(iface, interface_name) of interfaces" class="border rounded bg-white shadow overflow-hidden">
|
||||
<div v-for="iface of interfacesWithStats" class="border rounded bg-white shadow overflow-hidden">
|
||||
|
||||
<div v-if="findInterfaceStats(interface_name)?.ifac_signature != null" class="bg-gray-50 p-1 text-sm text-gray-500 space-x-1 border-b">
|
||||
<!-- IFAC info -->
|
||||
<div v-if="iface._stats?.ifac_signature != null" class="bg-gray-50 p-1 text-sm text-gray-500 space-x-1 border-b">
|
||||
<div class="flex text-sm">
|
||||
<div class="my-auto">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="size-4 text-green-500">
|
||||
|
|
@ -717,7 +718,7 @@
|
|||
</svg>
|
||||
</div>
|
||||
<span class="ml-1 my-auto">
|
||||
<span class="text-green-500">{{ findInterfaceStats(interface_name)?.ifac_size * 8 }}-bit IFAC</span> with sig <span @click="onIFACSignatureClick(findInterfaceStats(interface_name)?.ifac_signature)" class="cursor-pointer"><{{ findInterfaceStats(interface_name)?.ifac_signature?.slice(0, 6) }}...{{ findInterfaceStats(interface_name)?.ifac_signature?.slice(-6) }}></span>
|
||||
<span class="text-green-500">{{ iface._stats.ifac_size * 8 }}-bit IFAC</span> with sig <span @click="onIFACSignatureClick(iface._stats.ifac_signature)" class="cursor-pointer"><{{ iface._stats.ifac_signature.slice(0, 6) }}...{{ iface._stats.ifac_signature.slice(-6) }}></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -751,7 +752,7 @@
|
|||
|
||||
<!-- interface details -->
|
||||
<div>
|
||||
<div class="font-semibold leading-5">{{ interface_name }}</div>
|
||||
<div class="font-semibold leading-5">{{ iface._name }}</div>
|
||||
<div class="text-sm flex space-x-1">
|
||||
|
||||
<!-- auto interface -->
|
||||
|
|
@ -785,14 +786,14 @@
|
|||
|
||||
<!-- enable/disable interface button -->
|
||||
<div class="my-auto mr-1">
|
||||
<button v-if="isInterfaceEnabled(iface)" @click="disableInterface(interface_name)" type="button" class="cursor-pointer">
|
||||
<button v-if="isInterfaceEnabled(iface)" @click="disableInterface(iface._name)" type="button" class="cursor-pointer">
|
||||
<span class="flex text-gray-700 bg-gray-100 hover:bg-gray-200 p-2 rounded-full">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-5">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M5.636 5.636a9 9 0 1 0 12.728 0M12 3v9" />
|
||||
</svg>
|
||||
</span>
|
||||
</button>
|
||||
<button v-else @click="enableInterface(interface_name)" type="button" class="cursor-pointer">
|
||||
<button v-else @click="enableInterface(iface._name)" type="button" class="cursor-pointer">
|
||||
<span class="flex text-gray-700 bg-gray-100 hover:bg-gray-200 p-2 rounded-full">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-5">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M5.636 5.636a9 9 0 1 0 12.728 0M12 3v9" />
|
||||
|
|
@ -803,7 +804,7 @@
|
|||
|
||||
<!-- edit interface button -->
|
||||
<div class="my-auto mr-1">
|
||||
<button @click="editInterface(interface_name)" type="button" class="cursor-pointer">
|
||||
<button @click="editInterface(iface._name)" type="button" class="cursor-pointer">
|
||||
<span class="flex text-gray-700 bg-gray-100 hover:bg-gray-200 p-2 rounded-full">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-5">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125" />
|
||||
|
|
@ -814,7 +815,7 @@
|
|||
|
||||
<!-- delete interface button -->
|
||||
<div class="my-auto mr-2">
|
||||
<button @click="deleteInterface(interface_name)" type="button" class="cursor-pointer">
|
||||
<button @click="deleteInterface(iface._name)" type="button" class="cursor-pointer">
|
||||
<span class="flex text-gray-700 bg-gray-100 hover:bg-gray-200 p-2 rounded-full">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" />
|
||||
|
|
@ -828,13 +829,13 @@
|
|||
<div class="flex bg-gray-50 p-1 text-sm text-gray-500 space-x-1 border-t">
|
||||
|
||||
<!-- status -->
|
||||
<div v-if="findInterfaceStats(interface_name)?.status === true" class="text-sm text-green-500">Connected</div>
|
||||
<div v-if="iface._stats?.status === true" class="text-sm text-green-500">Connected</div>
|
||||
<div v-else class="text-sm text-red-500">Disconnected</div>
|
||||
|
||||
<!-- stats -->
|
||||
<div>• Bitrate: {{ formatBitsPerSecond(findInterfaceStats(interface_name)?.bitrate ?? 0) }}</div>
|
||||
<div>• TX: {{ formatBytes(findInterfaceStats(interface_name)?.txb ?? 0) }}</div>
|
||||
<div>• RX: {{ formatBytes(findInterfaceStats(interface_name)?.rxb ?? 0) }}</div>
|
||||
<div>• Bitrate: {{ formatBitsPerSecond(iface._stats?.bitrate ?? 0) }}</div>
|
||||
<div>• TX: {{ formatBytes(iface._stats?.txb ?? 0) }}</div>
|
||||
<div>• RX: {{ formatBytes(iface._stats?.rxb ?? 0) }}</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
@ -2414,6 +2415,15 @@
|
|||
return audioCall.is_outbound;
|
||||
});
|
||||
},
|
||||
interfacesWithStats() {
|
||||
const results = [];
|
||||
for(const [interfaceName, iface] of Object.entries(this.interfaces)){
|
||||
iface._name = interfaceName;
|
||||
iface._stats = this.findInterfaceStats(interfaceName);
|
||||
results.push(iface);
|
||||
}
|
||||
return results;
|
||||
},
|
||||
},
|
||||
}).mount('#app');
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue