hosts_app/templates/clear_servers.html
Mateusz Gruszczyński 4b5d7526ff refactor web interface
2025-02-25 09:44:24 +01:00

79 lines
2.8 KiB
HTML

{% extends "base.html" %}
{% block title %}Wyczyść Server - /etc/hosts Manager{% endblock %}
{% block extra_css %}
{{ super() }}
<style>
.tooltip-inner {
max-width: 300px;
text-align: left;
}
</style>
{% endblock %}
{% block content %}
<div class="card mb-4">
<div class="card-header">
<h2>Wyczyść /etc/hosts</h2>
</div>
<div class="card-body">
<form method="POST" action="{{ url_for('clear_server') }}">
<div class="mb-3">
<label class="form-label">Opcja czyszczenia:</label>
<div class="form-check">
<input class="form-check-input" type="radio" name="clear_option" id="clear_all" value="all" checked>
<label class="form-check-label" for="clear_all">Wyczyść dla wszystkich hostów</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="clear_option" id="clear_one" value="one">
<label class="form-check-label" for="clear_one">Wybierz serwer</label>
</div>
</div>
<div class="mb-3" id="host_select_div" style="display: none;">
<label for="host_id" class="form-label">Wybierz serwer:</label>
<select class="form-select" id="host_id" name="host_id">
{% for host in hosts %}
<option value="{{ host.id }}">{{ host.hostname }}</option>
{% endfor %}
</select>
</div>
<div class="mb-3">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="linux" id="linux">
<label class="form-check-label" for="linux">Wyczyść Linux</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="mikrotik" id="mikrotik">
<label class="form-check-label" for="mikrotik">Wyczyść Mikrotik</label>
</div>
</div>
<button type="submit" class="btn btn-danger">Wyczyść</button>
</form>
</div>
</div>
<div class="mt-3 text-center">
<a href="{{ url_for('dashboard') }}" class="btn btn-secondary">Przejdź do pulpitu</a>
</div>
{% endblock %}
{% block extra_js %}
{{ super() }}
<script>
// Pokazuj lub ukrywaj rozwijaną listę w zależności od wybranej opcji
const clearAllRadio = document.getElementById('clear_all');
const clearOneRadio = document.getElementById('clear_one');
const hostSelectDiv = document.getElementById('host_select_div');
function toggleHostSelect() {
if (clearOneRadio.checked) {
hostSelectDiv.style.display = 'block';
} else {
hostSelectDiv.style.display = 'none';
}
}
clearAllRadio.addEventListener('change', toggleHostSelect);
clearOneRadio.addEventListener('change', toggleHostSelect);
// Inicjalnie ustaw stan przy załadowaniu strony
toggleHostSelect();
</script>
{% endblock %}