Fix skipChart logic for JS generation
This commit is contained in:
parent
474836e077
commit
10e646a26a
|
|
@ -552,8 +552,9 @@ var diskTotalGB = {
|
||||||
{% if metricData[0] is defined %}
|
{% if metricData[0] is defined %}
|
||||||
{% set ctxVarName = 'ctx' ~ metricName|replace({'-': '_', '.': '_'}) %}
|
{% set ctxVarName = 'ctx' ~ metricName|replace({'-': '_', '.': '_'}) %}
|
||||||
const {{ ctxVarName }} = document.getElementById('chart-{{ metricName }}');
|
const {{ ctxVarName }} = document.getElementById('chart-{{ metricName }}');
|
||||||
if (!{{ ctxVarName }}) { return; }
|
if (!{{ ctxVarName }}) { var skipChart = true; }
|
||||||
|
|
||||||
|
{% if not skipChart is defined %}
|
||||||
const ctxInstance{{ metricName|replace({'-': '_', '.': '_'}) }} = {{ ctxVarName }}.getContext('2d');
|
const ctxInstance{{ metricName|replace({'-': '_', '.': '_'}) }} = {{ ctxVarName }}.getContext('2d');
|
||||||
|
|
||||||
// Подготовка данных для графика
|
// Подготовка данных для графика
|
||||||
|
|
@ -567,6 +568,7 @@ labels{{ metricName }}.push('{{ time_val|date(time_format) }}');
|
||||||
data{{ metricName }}.push({{ metric.value|raw }});
|
data{{ metricName }}.push({{ metric.value|raw }});
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
{% if not skipChart is defined %}
|
||||||
const chart{{ metricName|replace({'-': '_', '.': '_'}) }} = new Chart(ctxInstance{{ metricName|replace({'-': '_', '.': '_'}) }}, {
|
const chart{{ metricName|replace({'-': '_', '.': '_'}) }} = new Chart(ctxInstance{{ metricName|replace({'-': '_', '.': '_'}) }}, {
|
||||||
type: 'line',
|
type: 'line',
|
||||||
data: {
|
data: {
|
||||||
|
|
@ -763,6 +765,7 @@ chart{{ metricName|replace({'-': '_', '.': '_'}) }}.canvas.addEventListener('mou
|
||||||
chart{{ metricName|replace({'-': '_', '.': '_'}) }}.update();
|
chart{{ metricName|replace({'-': '_', '.': '_'}) }}.update();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue