Update to stats page

This commit is contained in:
pablorevilla-meshtastic
2026-02-13 15:48:40 -08:00
parent 4a7fa1df08
commit 20c2a3dc62
3 changed files with 62 additions and 0 deletions

View File

@@ -124,6 +124,7 @@
{
"mesh_stats_summary": "Mesh Statistics - Summary (all available in Database)",
"total_nodes": "Total Nodes",
"total_gateways": "Total Gateways",
"total_packets": "Total Packets",
"total_packets_seen": "Total Packets Seen",
"packets_per_day_all": "Packets per Day - All Ports (Last 14 Days)",
@@ -134,6 +135,10 @@
"hardware_breakdown": "Hardware Breakdown",
"role_breakdown": "Role Breakdown",
"channel_breakdown": "Channel Breakdown",
"gateway_channel_breakdown": "Gateway Channel Breakdown",
"gateway_role_breakdown": "Gateway Role Breakdown",
"gateway_firmware_breakdown": "Gateway Firmware Breakdown",
"no_gateways": "No gateways found",
"expand_chart": "Expand Chart",
"export_csv": "Export CSV",
"all_channels": "All Channels",

View File

@@ -120,6 +120,7 @@
"stats": {
"mesh_stats_summary": "Estadísticas de la Malla - Resumen (completas en la base de datos)",
"total_nodes": "Nodos Totales",
"total_gateways": "Gateways Totales",
"total_packets": "Paquetes Totales",
"total_packets_seen": "Paquetes Totales Vistos",
"packets_per_day_all": "Paquetes por Día - Todos los Puertos (Últimos 14 Días)",
@@ -130,6 +131,10 @@
"hardware_breakdown": "Distribución de Hardware",
"role_breakdown": "Distribución de Roles",
"channel_breakdown": "Distribución de Canales",
"gateway_channel_breakdown": "Desglose de canales de gateways",
"gateway_role_breakdown": "Desglose de roles de gateways",
"gateway_firmware_breakdown": "Desglose de firmware de gateways",
"no_gateways": "No se encontraron gateways",
"expand_chart": "Ampliar Gráfico",
"export_csv": "Exportar CSV",
"all_channels": "Todos los Canales"

View File

@@ -112,6 +112,10 @@
<p data-translate-lang="total_packets_seen">Total Packets Seen</p>
<div class="summary-count" id="summary_seen">0</div>
</div>
<div class="summary-card" style="flex:1;">
<p data-translate-lang="total_gateways">Total Gateways</p>
<div class="summary-count" id="summary_gateways">0</div>
</div>
</div>
<!-- Daily Charts -->
@@ -190,6 +194,28 @@
<button class="export-btn" data-chart="chart_channel" data-translate-lang="export_csv">Export CSV</button>
<div id="chart_channel" class="chart"></div>
</div>
<!-- Gateway breakdown charts -->
<div class="card-section">
<p class="section-header" data-translate-lang="gateway_channel_breakdown">Gateway Channel Breakdown</p>
<button class="expand-btn" data-chart="chart_gateway_channel" data-translate-lang="expand_chart">Expand Chart</button>
<button class="export-btn" data-chart="chart_gateway_channel" data-translate-lang="export_csv">Export CSV</button>
<div id="chart_gateway_channel" class="chart"></div>
</div>
<div class="card-section">
<p class="section-header" data-translate-lang="gateway_role_breakdown">Gateway Role Breakdown</p>
<button class="expand-btn" data-chart="chart_gateway_role" data-translate-lang="expand_chart">Expand Chart</button>
<button class="export-btn" data-chart="chart_gateway_role" data-translate-lang="export_csv">Export CSV</button>
<div id="chart_gateway_role" class="chart"></div>
</div>
<div class="card-section">
<p class="section-header" data-translate-lang="gateway_firmware_breakdown">Gateway Firmware Breakdown</p>
<button class="expand-btn" data-chart="chart_gateway_firmware" data-translate-lang="expand_chart">Expand Chart</button>
<button class="export-btn" data-chart="chart_gateway_firmware" data-translate-lang="export_csv">Export CSV</button>
<div id="chart_gateway_firmware" class="chart"></div>
</div>
</div>
<!-- Modal for expanded charts -->
@@ -339,6 +365,7 @@ function renderPieChart(elId,data,name){
return chart;
}
// --- Packet Type Pie Chart ---
async function fetchPacketTypeBreakdown(channel=null) {
const portnums = [1,3,4,67,70,71];
@@ -362,6 +389,7 @@ async function fetchPacketTypeBreakdown(channel=null) {
let chartHourlyAll, chartPortnum1, chartPortnum3, chartPortnum4, chartPortnum67, chartPortnum70, chartPortnum71;
let chartDailyAll, chartDailyPortnum1;
let chartHwModel, chartRole, chartChannel;
let chartGatewayChannel, chartGatewayRole, chartGatewayFirmware;
let chartPacketTypes;
async function init(){
@@ -408,10 +436,31 @@ async function init(){
chartRole=renderPieChart("chart_role",processCountField(nodes,"role"),"Role");
chartChannel=renderPieChart("chart_channel",processCountField(nodes,"channel"),"Channel");
const gateways = nodes.filter(n => n.is_mqtt_gateway);
chartGatewayChannel = renderPieChart(
"chart_gateway_channel",
processCountField(gateways, "channel"),
"Gateway Channel"
);
chartGatewayRole = renderPieChart(
"chart_gateway_role",
processCountField(gateways, "role"),
"Gateway Role"
);
chartGatewayFirmware = renderPieChart(
"chart_gateway_firmware",
processCountField(gateways, "firmware"),
"Gateway Firmware"
);
const summaryNodesEl = document.getElementById("summary_nodes");
if (summaryNodesEl) {
summaryNodesEl.textContent = nodes.length.toLocaleString();
}
const summaryGatewaysEl = document.getElementById("summary_gateways");
if (summaryGatewaysEl) {
summaryGatewaysEl.textContent = gateways.length.toLocaleString();
}
// Packet types pie
const packetTypesData = await fetchPacketTypeBreakdown();
@@ -458,6 +507,9 @@ window.addEventListener('resize',()=>{
chartHwModel,
chartRole,
chartChannel,
chartGatewayChannel,
chartGatewayRole,
chartGatewayFirmware,
chartPacketTypes
].forEach(c=>c?.resize());
});