Исключение отображения графиков для метрик top_cpu_proc и top_ram_proc

This commit is contained in:
mirivlad 2026-02-15 11:54:04 +03:00
parent 26d659ae7d
commit b60a092a2f
1 changed files with 26 additions and 22 deletions

View File

@ -108,31 +108,33 @@
<div class="row">
{% for metricName, metricData in metrics %}
<div class="col-12 mb-4">
<div class="card">
<div class="card-header">
<h6 class="mb-0">
{{ metricName|replace({'_': ' ', 'load': 'загрузка', 'used': 'использование'})|title }}
{% if metricData[0].unit %}<small class="text-muted">({{ metricData[0].unit }})</small>{% endif %}
</h6>
</div>
<div class="card-body">
{% if metricData %}
<h3 class="text-center text-end">{{ metricData[0].value }}{{ metricData[0].unit|default('') }}</h3>
<p class="text-muted text-center mb-2">
{{ metricData[0].created_at|date('d.m.Y H:i:s') }}
</p>
{% if metricName!="top_cpu_proc" && metricName!="top_ram_proc" %}
<div class="col-12 mb-4">
<div class="card">
<div class="card-header">
<h6 class="mb-0">
{{ metricName|replace({'_': ' ', 'load': 'загрузка', 'used': 'использование'})|title }}
{% if metricData[0].unit %}<small class="text-muted">({{ metricData[0].unit }})</small>{% endif %}
</h6>
</div>
<div class="card-body">
{% if metricData %}
<h3 class="text-center text-end">{{ metricData[0].value }}{{ metricData[0].unit|default('') }}</h3>
<p class="text-muted text-center mb-2">
{{ metricData[0].created_at|date('d.m.Y H:i:s') }}
</p>
<!-- График для метрики -->
<div>
<canvas id="chart-{{ metricName }}" width="100%" height="200"></canvas>
</div>
{% else %}
<p class="text-center text-muted">Нет данных за этот период</p>
{% endif %}
<!-- График для метрики -->
<div>
<canvas id="chart-{{ metricName }}" width="100%" height="200"></canvas>
</div>
{% else %}
<p class="text-center text-muted">Нет данных за этот период</p>
{% endif %}
</div>
</div>
</div>
</div>
{% endif %}
{% endfor %}
{% if metrics|length == 0 %}
@ -464,6 +466,7 @@ document.addEventListener('DOMContentLoaded', function() {
// Графики метрик
{% for metricName, metricData in metrics %}
{% if metricName!="top_cpu_proc" && metricName!="top_ram_proc" %}
const ctx{{ metricName|replace({'-': '_', '.': '_'}) }} = document.getElementById('chart-{{ metricName }}').getContext('2d');
// Подготовка данных для графика
@ -573,6 +576,7 @@ new Chart(ctx{{ metricName|replace({'-': '_', '.': '_'}) }}, {
}
}
});
{% endif %}
{% endfor %}
</script>
{% endblock %}