summaryrefslogtreecommitdiffstats
path: root/ogcp/templates
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2022-03-25 13:09:50 +0100
committerJavier Sánchez Parra <jsanchez@soleta.eu>2022-03-25 13:09:50 +0100
commit6b617bd448bf0122f2183e60f0fb4537b13caece (patch)
tree68fd71b37c70e8a0ec745f04076463ae9f47cd65 /ogcp/templates
parentd4e7a9f05bc45def5e5738ffd8d2391795311fd0 (diff)
Check swap size is not zero
If the server do not have swap, show a warning.
Diffstat (limited to 'ogcp/templates')
-rw-r--r--ogcp/templates/dashboard.html6
1 files changed, 6 insertions, 0 deletions
diff --git a/ogcp/templates/dashboard.html b/ogcp/templates/dashboard.html
index 5187b15..a84ae4d 100644
--- a/ogcp/templates/dashboard.html
+++ b/ogcp/templates/dashboard.html
@@ -118,6 +118,7 @@
{{ _('Swap') }}
</div>
<div class="card-body">
+ {% if stats['swap']['size'] %}
<canvas id="swapChart" class="mb-2"></canvas>
<ul class="list-group list-group-horizontal">
<li class="list-group-item w-50">
@@ -143,6 +144,9 @@
({{ ((stats['swap']['free'] / stats['swap']['size']) * 100)|int }}%)
</li>
</ul>
+ {% else %}
+ <h2>No swap</h2>
+ {% endif %}
</div>
</div>
</div>
@@ -259,6 +263,7 @@
document.getElementById('memoryChart'),
memoryChartConfig,
);
+ {% if stats['swap']['size'] %}
const swapChartConfig = {
type: 'doughnut',
data: {
@@ -294,5 +299,6 @@
document.getElementById('swapChart'),
swapChartConfig,
);
+ {% endif %}
</script>
{% endblock %}