diff --git a/templates/servers/detail.twig b/templates/servers/detail.twig index e4fc5e9..090643a 100755 --- a/templates/servers/detail.twig +++ b/templates/servers/detail.twig @@ -806,8 +806,16 @@ document.addEventListener('mousemove', function(e) { {% endif %} {% endfor %} -{% for iface in net_interfaces %} -{% if metrics['net_in_' ~ iface] is defined and metrics['net_out_' ~ iface] is defined %} +{% set net_interfaces_js = [] %} +{% for m in displayMetrics %} + {% if m starts with 'net_in_' %} + {% set iface = m|replace({'net_in_': ''}) %} + {% set net_interfaces_js = net_interfaces_js|merge([iface]) %} + {% endif %} +{% endfor %} + +{% for iface in net_interfaces_js %} +{% if ('net_in_' ~ iface) in displayMetrics and ('net_out_' ~ iface) in displayMetrics and metrics['net_in_' ~ iface] is defined and metrics['net_out_' ~ iface] is defined %} (function() { var ctx = document.getElementById('chart-net-{{ iface }}'); if (!ctx) return; @@ -899,7 +907,7 @@ document.addEventListener('mousemove', function(e) { var colorIdx = 0; {% for mn, md in metrics %} - {% if mn starts with 'temp_' %} + {% if mn in displayMetrics and mn starts with 'temp_' %} if (!labelsFilled) { {% for p in md|slice(-1000) %} labels.push('{{ p.time_bucket|default(p.created_at)|date("d.m H:i") }}');