From 9fbdf6f1167883711a9c3c4c83b50d8a161904fb Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Tue, 25 Feb 2025 18:32:35 -0300 Subject: [PATCH] chartjs better integration with peer list --- templates/wireguard/wireguard_peer_list.html | 49 +++++++++++--------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/templates/wireguard/wireguard_peer_list.html b/templates/wireguard/wireguard_peer_list.html index f36b99b..cb7d92c 100644 --- a/templates/wireguard/wireguard_peer_list.html +++ b/templates/wireguard/wireguard_peer_list.html @@ -1,9 +1,13 @@ {% extends "base.html" %} + {% block page_custom_head %} {% endblock %} @@ -26,14 +30,16 @@
{% for peer in peer_list %}
-
-
-
- - {{ peer }} - -
- +
+ {% comment %}background: linear-gradient(to right, white 50%, transparent 50%);{% endcomment %} +
+
+
+ + {{ peer }} + +
+ {% if user_acl.user_level >= 30 %}
{% endif %} - {% comment %} - - - - {% endcomment %} -
-

+

Throughput:
Transfer:
Latest Handshake: @@ -75,8 +75,8 @@ {% endfor %}
-

- +
+
{% endfor %} @@ -190,7 +190,9 @@ borderColor: 'rgba(54, 162, 235, 1)', backgroundColor: 'rgba(54, 162, 235, 0.2)', fill: false, - tension: 0.1 + tension: 0.1, + lineTension: 0.4, + pointRadius: 0 }, { label: 'Upload', @@ -198,7 +200,9 @@ borderColor: 'rgba(255, 99, 132, 1)', backgroundColor: 'rgba(255, 99, 132, 0.2)', fill: false, - tension: 0.1 + tension: 0.1, + lineTension: 0.4, + pointRadius: 0 } ] }, @@ -222,7 +226,7 @@ }, animation: { - duration: 1000 + duration: 0 } } }); @@ -361,11 +365,8 @@ formattedThroughput = ` ${downloadDisplay}, ${uploadDisplay}`; throughputElement.innerHTML = formattedThroughput; - // --- Update Chart.js instance for this peer (if available) --- - // Note: Ensure that the chart instance key uses the same identifier as used in the canvas (peer.public_key) if (charts[peerId]) { var chart = charts[peerId]; - // Add new values to the datasets and remove the oldest if more than 10 points. chart.data.datasets[0].data.push(downloadThroughput); if (chart.data.datasets[0].data.length > 10) { chart.data.datasets[0].data.shift(); @@ -534,8 +535,10 @@ $(".peer-extra-info").toggle(); if($(".peer-extra-info").is(":visible")){ $(this).text("Hide extras"); + $(".div-peer-text-information").removeClass('position-absolute') //.removeClass('p-3'); } else { $(this).text("Show extras"); + $(".div-peer-text-information").addClass('position-absolute') //.addClass('p-3'); } }); });