Fix proc metrics hide - proper Twig syntax

This commit is contained in:
mirivlad 2026-02-15 03:47:40 +00:00
parent 70393075cb
commit 0e6d8ebcd6
1 changed files with 9 additions and 17 deletions

View File

@ -107,8 +107,7 @@
</div>
<div class="row">
{% for metricName, metricData in metrics %}
{% if metricName != 'top_cpu_proc' and metricName != 'top_ram_proc' %}
{% for metricName, metricData in metrics %}{% if metricName != 'top_cpu_proc' and metricName != 'top_ram_proc' %}
<div class="col-12 mb-4">
<div class="card">
<div class="card-header">
@ -135,7 +134,7 @@
</div>
</div>
{% endif %}
{% endfor %}
{% if metrics|length == 0 %}
<div class="col-12">
@ -220,8 +219,7 @@
</div>
</div>
</div>
{% endif %}
{% endfor %}
{% for service in stoppedServices %}
<div class="col-md-4 col-lg-3 mb-2">
@ -252,8 +250,7 @@
</div>
</div>
</div>
{% endif %}
{% endfor %}
{% for service in unknownServices %}
<div class="col-md-4 col-lg-3 mb-2">
@ -284,8 +281,7 @@
</div>
</div>
</div>
{% endif %}
{% endfor %}
{% else %}
<div class="col-12">
<div class="alert alert-warning text-center">
@ -369,8 +365,7 @@
</div>
</div>
</div>
{% endif %}
{% endfor %}
<div class="d-grid gap-2 d-md-flex justify-content-md-end">
<button type="submit" class="btn btn-primary">
@ -470,8 +465,6 @@ document.addEventListener('DOMContentLoaded', function() {
// Графики метрик
{% for metricName, metricData in metrics %}
{% if metricName != 'top_cpu_proc' and metricName != 'top_ram_proc' %}
{% if metricName != 'top_cpu_proc' and metricName != 'top_ram_proc' %}
const ctx{{ metricName|replace({'-': '_', '.': '_'}) }} = document.getElementById('chart-{{ metricName }}').getContext('2d');
// Подготовка данных для графика
@ -481,8 +474,7 @@ var data{{ metricName }} = [];
{% for metric in metricData|slice(0, 20)|reverse %}
labels{{ metricName }}.push('{{ metric.created_at|date('H:i') }}');
data{{ metricName }}.push({{ metric.value|raw }});
{% endif %}
{% endfor %}
new Chart(ctx{{ metricName|replace({'-': '_', '.': '_'}) }}, {
type: 'line',
@ -563,6 +555,7 @@ new Chart(ctx{{ metricName|replace({'-': '_', '.': '_'}) }}, {
lines.push(' ' + proc.name + ': ' + proc.value + '%');
});
}
{% endif %}
// Show tooltip
var position = context.chart.canvas.getBoundingClientRect();
@ -581,7 +574,6 @@ new Chart(ctx{{ metricName|replace({'-': '_', '.': '_'}) }}, {
}
}
});
{% endif %}
{% endfor %}
</script>
{% endblock %}