diff --git a/content/sv/status/index.md b/content/sv/status/index.md index 5832f67..3d4dd5d 100644 --- a/content/sv/status/index.md +++ b/content/sv/status/index.md @@ -7,30 +7,6 @@ draft: false
{{% blocks/section color="white" %}} - - -
- -
- ## Antal Enheter
@@ -60,19 +36,14 @@ Antalet meddelanden per timme senaste 7 dygnen. Grafen visar antal okrypterade m Mätarna visar genomsnittligt kanalutnyttjande för de 10 noder som har högst kanalutnyttjande. Kanalutnyttjande (Channel Utilization) visar hur mycket av radiokanalen som är upptagen. Under 15–20% är allt normalt, över 25% får Telemetri lägre prioritet, vilket kan ge längre tid mellan uppdateringar. Runt 40% stryps positionsuppdateringar. Här i EU gäller dessutom max 10% sändtid per timme som kan pausa sändningar helt.
-
-
-
LongFast
-
- -
-
-
-
+
+
MediumFast
+
+
diff --git a/static/js/status/channel-utilization-gauges.js b/static/js/status/channel-utilization-gauges.js index 34963d9..897e5c3 100644 --- a/static/js/status/channel-utilization-gauges.js +++ b/static/js/status/channel-utilization-gauges.js @@ -2,15 +2,13 @@ async function channelUtilizationGauges() { try { await fetchNodes(); - // Create gauges for both channels - await createChannelUtilizationGauge('LongFast', 'longfastGauge'); + // Create gauge for MediumFast only await createChannelUtilizationGauge('MediumFast', 'mediumfastGauge'); } catch (err) { console.error('Error creating channel utilization gauges:', err); - // Show error on both canvases - showGaugeError('longfastGauge'); + // Show error on MediumFast canvas showGaugeError('mediumfastGauge'); } } @@ -160,26 +158,28 @@ function showTop10NodesLegend(channelName, top10Nodes) { if (!legendContainer || top10Nodes.length === 0) return; - let legendHTML = '
Top 10 Nodes
'; - legendHTML += '
'; + let legendHTML = '
Top 10 Nodes
'; + legendHTML += '
    '; top10Nodes.forEach((node, index) => { const utilizationColor = getUtilizationColor(node.utilizationValue); const shortName = node.short_name || node.node_id_hex || `Node ${node.node_id}`; + const longName = node.long_name || ''; legendHTML += ` -
    +
  • ${node.utilizationValue.toFixed(1)}% - - ${shortName} + [${shortName}] + + ${longName} -
  • + `; }); - - legendHTML += '
'; + + legendHTML += ''; legendContainer.innerHTML = legendHTML; } diff --git a/static/js/status/channel-utilization.js b/static/js/status/channel-utilization.js index 57d9e48..d28cfc4 100644 --- a/static/js/status/channel-utilization.js +++ b/static/js/status/channel-utilization.js @@ -9,26 +9,21 @@ async function channelUtilizationHourlyAverage() { ctx.fillText('Loading...', canvas.width/2, canvas.height/2); try { - // Fetch data for both channels over the last 7 days - const [mediumFastResponse, longFastResponse] = await Promise.all([ - fetch('https://map.sthlm-mesh.se/api/v1/stats/channel-utilization-stats?days=7&channel_id=MediumFast'), - fetch('https://map.sthlm-mesh.se/api/v1/stats/channel-utilization-stats?days=7&channel_id=LongFast') - ]); + // Fetch data for MediumFast over the last 7 days + const response = await fetch('https://map.sthlm-mesh.se/api/v1/stats/channel-utilization-stats?days=7&channel_id=MediumFast'); + const allData = await response.json(); - const mediumFastData = await mediumFastResponse.json(); - const longFastData = await longFastResponse.json(); + // Single dataset containing all points + const datasets = []; - // Create datasets for both channels - const datasets = []; - - const mediumFastPoints = mediumFastData.map(entry => ({ + const points = allData.map(entry => ({ x: entry.recorded_at, - y: parseFloat(entry.avg_channel_utilization) + y: entry.avg_channel_utilization })); - + datasets.push({ - label: 'MediumFast', - data: mediumFastPoints, + label: 'channelutilization', + data: points, borderColor: 'rgb(34, 197, 94)', backgroundColor: 'rgba(34, 197, 94, 0.1)', borderWidth: 2, @@ -37,22 +32,6 @@ async function channelUtilizationHourlyAverage() { fill: false, }); - const longFastPoints = longFastData.map(entry => ({ - x: entry.recorded_at, - y: parseFloat(entry.avg_channel_utilization) - })); - - datasets.push({ - label: 'LongFast', - data: longFastPoints, - borderColor: 'rgb(15, 169, 252)', - backgroundColor: 'rgba(15, 169, 252, 0.1)', - borderWidth: 2, - tension: 0.1, - pointRadius: 0, - fill: false, - }); - new Chart(ctx, { type: 'line', data: { @@ -78,12 +57,7 @@ async function channelUtilizationHourlyAverage() { }, plugins: { legend: { - display: true, - position: 'top', - labels: { - usePointStyle: true, - padding: 20 - } + display: false }, tooltip: { mode: 'index', intersect: false }, annotation: { diff --git a/static/js/status/shared.js b/static/js/status/shared.js index 6156db4..fbedde4 100644 --- a/static/js/status/shared.js +++ b/static/js/status/shared.js @@ -1,20 +1,5 @@ let nodes = []; let fetchPromise = null; -const StatusFilter = { - _channelId: null, - _subscribers: [], - getChannelId() { - return this._channelId; - }, - subscribe(callback) { - if (typeof callback === 'function') this._subscribers.push(callback); - }, - _notify() { - for (const cb of this._subscribers) { - try { cb(this._channelId); } catch (_) {} - } - } -}; async function fetchNodes() { if (nodes.length > 0) return; @@ -34,16 +19,3 @@ async function fetchNodes() { await fetchPromise; } - -// Initialize global channel filter listeners once -document.addEventListener('DOMContentLoaded', () => { - const radios = document.querySelectorAll("input[name='btnchannel-nodes']"); - if (!radios || radios.length === 0) return; - const checked = document.querySelector("input[name='btnchannel-nodes']:checked"); - StatusFilter._channelId = checked ? (checked.getAttribute('data-channel') || null) : null; - radios.forEach(r => r.addEventListener('change', () => { - const channel = r.getAttribute('data-channel'); - StatusFilter._channelId = channel || null; - StatusFilter._notify(); - })); -});