-
Target: {{ iface.target_host }}:{{ iface.target_port }}
+
{{ iface.target_host }}:{{ iface.target_port }}
-
+
Port: {{ iface.port }}
Frequency: {{ iface.frequency }}
Bandwidth: {{ iface.bandwidth }}
@@ -771,8 +776,21 @@
Coding Rate: {{ iface.codingrate }}
-
-
{{ isInterfaceEnabled(iface) ? 'Enabled' : 'Disabled' }}
+
+
No Information Available
+
+
+
+
+
+
+
Connected
+
Disconnected
+
+
+
• Bitrate: {{ formatBitsPerSecond(findInterfaceStats(interface_name)?.bitrate ?? 0) }}
+
• TX: {{ formatBytes(findInterfaceStats(interface_name)?.txb ?? 0) }}
+
• RX: {{ formatBytes(findInterfaceStats(interface_name)?.rxb ?? 0) }}
@@ -840,6 +858,7 @@
nomadnetFileDownloadCallbacks: {},
interfaces: {},
+ interfaceStats: {},
};
},
@@ -849,6 +868,7 @@
this.getLxmfDeliveryAnnounces();
this.getNomadnetworkNodeAnnounces();
this.loadInterfaces();
+ this.updateInterfaceStats();
window.onNodePageUrlClick = (url) => {
this.onNodePageUrlClick(url);
@@ -857,9 +877,10 @@
// update calls list
this.updateCallsList();
- // update calls list every 5 seconds
+ // update info every 5 seconds
setInterval(() => {
this.updateCallsList();
+ this.updateInterfaceStats();
}, 3000);
},
@@ -1405,6 +1426,33 @@
// do nothing if failed to load interfaces
}
},
+ async updateInterfaceStats() {
+ try {
+
+ // fetch interface stats
+ const response = await window.axios.get(`/api/v1/interface-stats`);
+
+ // update data
+ const interfaces = response.data.interface_stats?.interfaces ?? [];
+ for(const iface of interfaces){
+ this.interfaceStats[iface.name] = iface;
+ }
+
+ } catch(e) {
+ // do nothing if failed to load interfaces
+ }
+ },
+ findInterfaceStats(interfaceName) {
+
+ const iface = this.interfaces[interfaceName];
+ if(iface){
+ const interfaceNameWithType = `${iface.type}[${interfaceName}]`;
+ return this.interfaceStats[interfaceNameWithType];
+ }
+
+ return null;
+
+ },
async loadNodePage(destinationHash, pagePath, addToHistory = true, loadFromCache = true) {
// get new sequence for this page load
@@ -1826,6 +1874,19 @@
return parseFloat((bytes / Math.pow(k, i)).toFixed(decimals)) + ' ' + sizes[i];
},
+ formatBitsPerSecond: function(bits) {
+ if (bits === 0) {
+ return '0 bps';
+ }
+
+ const k = 1000; // Use 1000 instead of 1024 for network speeds
+ const decimals = 0;
+ const sizes = ['bps', 'kbps', 'Mbps', 'Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'];
+
+ const i = Math.floor(Math.log(bits) / Math.log(k));
+
+ return parseFloat((bits / Math.pow(k, i)).toFixed(decimals)) + ' ' + sizes[i];
+ },
arrayBufferToBase64: function(arrayBuffer) {
var binary = '';
var bytes = new Uint8Array(arrayBuffer);