add: whitelist

This commit is contained in:
2026-02-20 13:36:02 +00:00
parent 614dea44b4
commit a12366867d
3 changed files with 35 additions and 10 deletions

View File

@@ -13,9 +13,16 @@
class="form-control bg-dark text-white"
placeholder="Nom de la machine">
</div>
<div class="col-md-2">
<select name="time" class="form-select bg-dark text-white">
<div class="form-check text-white">
<input class="form-check-input" type="checkbox" name="noshutdown" id="noshutdown">
<label class="form-check-label" for="noshutdown">
Whitelist shutdown
</label>
</div>
</div>
<div class="col-md-2">
<select name="time" class="form-select bg-dark text-white" id="time-select">
{% for hour in range(0, 24) %}
<option value="{{ '%02d:00'|format(hour) }}">{{ '%02d:00'|format(hour) }}</option>
<option value="{{ '%02d:30'|format(hour) }}">{{ '%02d:30'|format(hour) }}</option>
@@ -38,9 +45,12 @@
{% for item in items %}
<div class="d-flex justify-content-between align-items-center py-2">
<span class="text-white">{{ item.name }}</span>
{% if item.noshutdown %}
<span class="text-green">OUI</span>
{% else %}
<span class="text-red">NON</span>
<span class="text-white">{{ item.time }}</span>
{% endif %}
<form method="post" action="/delete" class="m-0 p-0">
<input type="hidden" name="item_name" value="{{ item.name }}">
<button type="submit" class="btn btn-sm btn-danger">&times;</button>
@@ -55,4 +65,15 @@
</div>
<script>
const tickCheckbox = document.getElementById('tick'); // script pr desactiver la selection de l'heure si whitelist
const timeSelect = document.getElementById('time-select');
timeSelect.disabled = tickCheckbox.checked;
tickCheckbox.addEventListener('change', function() {
timeSelect.disabled = this.checked;
});
</script>
{% endblock %}