fix: округление значений метрик над графиками до 2 знаков
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
parent
fc7a98663f
commit
c6e400ad32
|
|
@ -134,7 +134,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
{% if metricData %}
|
{% if metricData %}
|
||||||
<h3 class="text-center text-end">{{ metricData[0].value }}{{ metricData[0].unit|default('') }}</h3>
|
<h3 class="text-center text-end">{{ metricData[0].value|round(2) }}{{ metricData[0].unit|default('') }}</h3>
|
||||||
<p class="text-muted text-center mb-2">
|
<p class="text-muted text-center mb-2">
|
||||||
{{ metricData[0].created_at|date('d.m.Y H:i:s') }}
|
{{ metricData[0].created_at|date('d.m.Y H:i:s') }}
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -390,63 +390,69 @@
|
||||||
<!-- Вкладка "Пороги" -->
|
<!-- Вкладка "Пороги" -->
|
||||||
<div class="tab-pane fade" id="thresholds" role="tabpanel">
|
<div class="tab-pane fade" id="thresholds" role="tabpanel">
|
||||||
<h4>Настройка порогов</h4>
|
<h4>Настройка порогов</h4>
|
||||||
|
<p class="text-muted mb-3">
|
||||||
|
<i class="fas fa-info-circle"></i> 0 = алерт сразу при превышении, >0 = алерт только если превышено дольше указанного времени. Оставьте поле пустым для отключения порога.
|
||||||
|
</p>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-8">
|
<div class="col-12">
|
||||||
<form method="post" action="/servers/{{ server.id }}/thresholds">
|
<form method="post" action="/servers/{{ server.id }}/thresholds">
|
||||||
{% for metricType in allMetricTypes %}
|
{% for metricType in allMetricTypes %}
|
||||||
<div class="card mb-3">
|
<div class="card mb-2">
|
||||||
<div class="card-header">
|
<div class="card-body py-2">
|
||||||
<h6 class="mb-0">
|
<div class="row align-items-center">
|
||||||
{{ metricType.name|replace({'_': ' ', 'load': 'загрузка', 'used': 'использование'})|title }}
|
<div class="col-md-3 mb-2 mb-md-0">
|
||||||
{% if metricType.unit %}<small class="text-muted">({{ metricType.unit }})</small>{% endif %}
|
<strong>{{ metricType.name|replace({'_': ' ', 'load': 'загрузка', 'used': 'использование'})|title }}</strong>
|
||||||
</h6>
|
{% if metricType.unit %}<small class="text-muted">({{ metricType.unit }})</small>{% endif %}
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<label class="form-label">Порог предупреждения</label>
|
|
||||||
<input type="number" class="form-control"
|
|
||||||
name="{{ metricType.name }}_warning"
|
|
||||||
step="0.01"
|
|
||||||
{% if existingThresholds[metricType.name].warning is defined %}
|
|
||||||
value="{{ existingThresholds[metricType.name].warning }}"
|
|
||||||
{% endif %}
|
|
||||||
placeholder="80.00">
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-3 mb-2 mb-md-0">
|
||||||
<label class="form-label">Порог критический</label>
|
<div class="input-group input-group-sm" title="Порог предупреждения">
|
||||||
<input type="number" class="form-control"
|
<span class="input-group-text" title="Порог предупреждения"><i class="fas fa-exclamation-triangle text-warning"></i></span>
|
||||||
name="{{ metricType.name }}_critical"
|
<input type="number" class="form-control" style="max-width: 90px;"
|
||||||
step="0.01"
|
name="{{ metricType.name }}_warning"
|
||||||
{% if existingThresholds[metricType.name].critical is defined %}
|
step="0.01"
|
||||||
value="{{ existingThresholds[metricType.name].critical }}"
|
placeholder="80"
|
||||||
{% endif %}
|
title="Порог предупреждения"
|
||||||
placeholder="90.00">
|
{% if existingThresholds[metricType.name].warning is defined %}
|
||||||
|
value="{{ existingThresholds[metricType.name].warning }}"
|
||||||
|
{% endif %}>
|
||||||
|
<span class="input-group-text">%</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col-md-3 mb-2 mb-md-0">
|
||||||
<div class="row mt-3">
|
<div class="input-group input-group-sm" title="Порог критический">
|
||||||
<div class="col-md-12">
|
<span class="input-group-text" title="Порог критический"><i class="fas fa-exclamation-circle text-danger"></i></span>
|
||||||
<label class="form-label">
|
<input type="number" class="form-control" style="max-width: 90px;"
|
||||||
<i class="fas fa-clock"></i> Длительность превышения (минуты)
|
name="{{ metricType.name }}_critical"
|
||||||
</label>
|
step="0.01"
|
||||||
<input type="number" class="form-control"
|
placeholder="90"
|
||||||
name="{{ metricType.name }}_duration"
|
title="Порог критический"
|
||||||
min="0"
|
{% if existingThresholds[metricType.name].critical is defined %}
|
||||||
step="1"
|
value="{{ existingThresholds[metricType.name].critical }}"
|
||||||
{% if existingThresholds[metricType.name].duration is defined %}
|
{% endif %}>
|
||||||
value="{{ existingThresholds[metricType.name].duration }}"
|
<span class="input-group-text">%</span>
|
||||||
{% endif %}
|
</div>
|
||||||
placeholder="0 - отправлять алерт сразу">
|
</div>
|
||||||
<small class="text-muted">
|
<div class="col-md-3">
|
||||||
0 = алерт сразу при превышении, >0 = алерт только если превышено дольше указанного времени
|
<div class="input-group input-group-sm" title="Длительность превышения (минуты)">
|
||||||
</small>
|
<span class="input-group-text" title="Длительность превышения"><i class="fas fa-clock"></i></span>
|
||||||
|
<input type="number" class="form-control" style="max-width: 90px;"
|
||||||
|
name="{{ metricType.name }}_duration"
|
||||||
|
min="0"
|
||||||
|
step="1"
|
||||||
|
placeholder="0"
|
||||||
|
title="Длительность превышения (минуты)"
|
||||||
|
{% if existingThresholds[metricType.name].duration is defined %}
|
||||||
|
value="{{ existingThresholds[metricType.name].duration }}"
|
||||||
|
{% endif %}>
|
||||||
|
<span class="input-group-text">мин</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<div class="d-grid gap-2 d-md-flex justify-content-md-end">
|
<div class="d-grid gap-2 d-md-flex justify-content-md-end mt-3">
|
||||||
<button type="submit" class="btn btn-primary">
|
<button type="submit" class="btn btn-primary">
|
||||||
<i class="fas fa-save"></i> Сохранить пороги
|
<i class="fas fa-save"></i> Сохранить пороги
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue