Fix proc metrics hide - proper Twig syntax
This commit is contained in:
parent
9117f19c4d
commit
cd14d8438a
|
|
@ -408,7 +408,6 @@ function fetchProcesses(serverId, time) {
|
||||||
data.top_cpu.forEach(function(proc) {
|
data.top_cpu.forEach(function(proc) {
|
||||||
lines.push(' ' + proc.name + ': ' + proc.value + '%');
|
lines.push(' ' + proc.name + ': ' + proc.value + '%');
|
||||||
});
|
});
|
||||||
{% endif %}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Добавляем топ-процессы RAM
|
// Добавляем топ-процессы RAM
|
||||||
|
|
@ -418,7 +417,6 @@ function fetchProcesses(serverId, time) {
|
||||||
data.top_ram.forEach(function(proc) {
|
data.top_ram.forEach(function(proc) {
|
||||||
lines.push(' ' + proc.name + ': ' + proc.value + '%');
|
lines.push(' ' + proc.name + ': ' + proc.value + '%');
|
||||||
});
|
});
|
||||||
{% endif %}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve(lines);
|
resolve(lines);
|
||||||
|
|
@ -426,9 +424,7 @@ function fetchProcesses(serverId, time) {
|
||||||
.catch(function() {
|
.catch(function() {
|
||||||
resolve([]);
|
resolve([]);
|
||||||
});
|
});
|
||||||
{% endif %}
|
|
||||||
});
|
});
|
||||||
{% endif %}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -444,7 +440,6 @@ function requestServices() {
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
alert('Ошибка получения списка сервисов: ' + error);
|
alert('Ошибка получения списка сервисов: ' + error);
|
||||||
});
|
});
|
||||||
{% endif %}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Обработчик кнопки "Выбрать все"
|
// Обработчик кнопки "Выбрать все"
|
||||||
|
|
@ -453,9 +448,7 @@ document.getElementById('selectAllServices').addEventListener('change', function
|
||||||
checkboxes.forEach(checkbox => {
|
checkboxes.forEach(checkbox => {
|
||||||
checkbox.checked = this.checked;
|
checkbox.checked = this.checked;
|
||||||
});
|
});
|
||||||
{% endif %}
|
|
||||||
});
|
});
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
// Активация нужной вкладки при загрузке
|
// Активация нужной вкладки при загрузке
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
|
@ -468,7 +461,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
tabButton.click();
|
tabButton.click();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
// Графики метрик
|
// Графики метрик
|
||||||
{% for metricName, metricData in metrics %}
|
{% for metricName, metricData in metrics %}
|
||||||
|
|
@ -482,7 +474,6 @@ var data{{ metricName }} = [];
|
||||||
{% for metric in metricData|slice(0, 20)|reverse %}
|
{% for metric in metricData|slice(0, 20)|reverse %}
|
||||||
labels{{ metricName }}.push('{{ metric.created_at|date('H:i') }}');
|
labels{{ metricName }}.push('{{ metric.created_at|date('H:i') }}');
|
||||||
data{{ metricName }}.push({{ metric.value|raw }});
|
data{{ metricName }}.push({{ metric.value|raw }});
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
new Chart(ctx{{ metricName|replace({'-': '_', '.': '_'}) }}, {
|
new Chart(ctx{{ metricName|replace({'-': '_', '.': '_'}) }}, {
|
||||||
|
|
@ -554,7 +545,6 @@ new Chart(ctx{{ metricName|replace({'-': '_', '.': '_'}) }}, {
|
||||||
data.top_cpu.forEach(function(proc) {
|
data.top_cpu.forEach(function(proc) {
|
||||||
lines.push(' ' + proc.name + ': ' + proc.value + '%');
|
lines.push(' ' + proc.name + ': ' + proc.value + '%');
|
||||||
});
|
});
|
||||||
{% endif %}
|
|
||||||
}
|
}
|
||||||
{% elseif metricName == 'ram_used' %}
|
{% elseif metricName == 'ram_used' %}
|
||||||
// Показываем только top_ram
|
// Показываем только top_ram
|
||||||
|
|
@ -564,9 +554,7 @@ new Chart(ctx{{ metricName|replace({'-': '_', '.': '_'}) }}, {
|
||||||
data.top_ram.forEach(function(proc) {
|
data.top_ram.forEach(function(proc) {
|
||||||
lines.push(' ' + proc.name + ': ' + proc.value + '%');
|
lines.push(' ' + proc.name + ': ' + proc.value + '%');
|
||||||
});
|
});
|
||||||
{% endif %}
|
|
||||||
}
|
}
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
// Show tooltip
|
// Show tooltip
|
||||||
var position = context.chart.canvas.getBoundingClientRect();
|
var position = context.chart.canvas.getBoundingClientRect();
|
||||||
|
|
@ -580,7 +568,6 @@ new Chart(ctx{{ metricName|replace({'-': '_', '.': '_'}) }}, {
|
||||||
// tooltipEl.style.opacity = 0;
|
// tooltipEl.style.opacity = 0;
|
||||||
// }, 3000);
|
// }, 3000);
|
||||||
});
|
});
|
||||||
{% endif %}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue