fixy i usprwnienia
This commit is contained in:
@ -19,6 +19,7 @@
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><input type="checkbox" id="select-all"></th>
|
||||
<th>Data utworzenia</th>
|
||||
<th>Opis</th>
|
||||
<th>Akcje</th>
|
||||
@ -27,11 +28,16 @@
|
||||
<tbody>
|
||||
{% for backup in backups %}
|
||||
<tr>
|
||||
<td>
|
||||
<!-- Każdy checkbox jest przypisany do formularza bulkDeleteForm -->
|
||||
<input type="checkbox" name="selected_backups" value="{{ backup.id }}" form="bulkDeleteForm">
|
||||
</td>
|
||||
<td>{{ backup.created_at.strftime("%Y-%m-%d %H:%M:%S") }}</td>
|
||||
<td>{{ backup.description }}</td>
|
||||
<td>
|
||||
<a href="{{ url_for('view_backup', backup_id=backup.id) }}" class="btn btn-sm btn-info">Podgląd</a>
|
||||
<a href="{{ url_for('restore_backup', backup_id=backup.id) }}" class="btn btn-sm btn-success">Przywróć</a>
|
||||
<!-- Usuwanie pojedynczego backupu -->
|
||||
<form action="{{ url_for('delete_backup', backup_id=backup.id) }}" method="post" style="display:inline;">
|
||||
<button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Czy na pewno usunąć backup?');">Usuń</button>
|
||||
</form>
|
||||
@ -40,6 +46,22 @@
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- Formularz do bulk usuwania – checkboxy znajdują się poza tym formularzem, ale dzięki atrybutowi form są z nim powiązane -->
|
||||
<form id="bulkDeleteForm" action="{{ url_for('delete_selected_backups') }}" method="post">
|
||||
<button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Czy na pewno usunąć zaznaczone backupy?');">Usuń zaznaczone</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block extra_js %}
|
||||
{{ super() }}
|
||||
<script>
|
||||
// Skrypt do zaznaczania/odznaczania wszystkich checkboxów
|
||||
document.getElementById('select-all').addEventListener('change', function(){
|
||||
var checkboxes = document.querySelectorAll('input[name="selected_backups"]');
|
||||
checkboxes.forEach(function(checkbox) {
|
||||
checkbox.checked = document.getElementById('select-all').checked;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
@ -24,6 +24,8 @@
|
||||
<th>Port</th>
|
||||
<th>Typ</th>
|
||||
<th>Metoda uwierzytelniania</th>
|
||||
<th>Auto Deploy</th>
|
||||
<th>Auto Backup</th>
|
||||
<th>Akcje</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -38,10 +40,24 @@
|
||||
<td>{{ h.port }}</td>
|
||||
<td>{{ h.type }}</td>
|
||||
<td>{{ h.auth_method }}</td>
|
||||
<!-- Formularz aktualizujący automatyczny deploy dla serwera -->
|
||||
<td>
|
||||
<form method="POST" action="{{ url_for('update_host_automation', id=h.id) }}" style="display:inline;">
|
||||
<input type="hidden" name="setting" value="auto_deploy">
|
||||
<input type="checkbox" name="enabled" value="1" onchange="this.form.submit()" {% if h.auto_deploy_enabled %}checked{% endif %}>
|
||||
</form>
|
||||
</td>
|
||||
<!-- Formularz aktualizujący automatyczny backup dla serwera -->
|
||||
<td>
|
||||
<form method="POST" action="{{ url_for('update_host_automation', id=h.id) }}" style="display:inline;">
|
||||
<input type="hidden" name="setting" value="auto_backup">
|
||||
<input type="checkbox" name="enabled" value="1" onchange="this.form.submit()" {% if h.auto_backup_enabled %}checked{% endif %}>
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ url_for('edit_server', id=h.id) }}" class="btn btn-primary btn-sm">Edytuj</a>
|
||||
<a href="{{ url_for('test_server_connection', id=h.id) }}" class="btn btn-info btn-sm">Testuj</a>
|
||||
<a href="{{ url_for('server_backup', host_id=h.id) }}" class="btn btn-success btn-sm">Backup</a>
|
||||
<a href="{{ url_for('server_backup', host_id=h.id) }}" class="btn btn-success btn-sm">Backup</a>
|
||||
<form method="GET" action="{{ url_for('delete_server', id=h.id) }}" style="display:inline;">
|
||||
<button type="submit" class="btn btn-danger btn-sm">Usuń</button>
|
||||
</form>
|
||||
|
@ -21,17 +21,25 @@
|
||||
<label class="form-check-label" for="auto_deploy">Automatyczny deploy</label>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="deploy_interval" class="form-label">Interwał deploy (minuty)</label>
|
||||
<input type="number" class="form-control" id="deploy_interval" name="deploy_interval" value="{{ settings.deploy_interval }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="backup_interval" class="form-label">Interwał backupów (minuty)</label>
|
||||
<input type="number" class="form-control" id="backup_interval" name="backup_interval" value="{{ settings.backup_interval }}">
|
||||
<label for="deploy_cron" class="form-label">Harmonogram deploy (cron)</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="deploy_cron" name="deploy_cron" value="{{ settings.deploy_cron }}">
|
||||
<button type="button" class="btn btn-outline-secondary" onclick="openCronModal('deploy_cron')">Generuj cron</button>
|
||||
</div>
|
||||
<small class="text-muted">Np. <code>0 0 * * *</code> – codziennie o północy</small>
|
||||
</div>
|
||||
<div class="mb-3 form-check">
|
||||
<input type="checkbox" class="form-check-input" id="auto_backup" name="auto_backup" {% if settings.auto_backup_enabled %}checked{% endif %}>
|
||||
<label class="form-check-label" for="auto_backup">Automatyczne kopie zapasowe</label>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="backup_cron" class="form-label">Harmonogram backup (cron)</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="backup_cron" name="backup_cron" value="{{ settings.backup_cron }}">
|
||||
<button type="button" class="btn btn-outline-secondary" onclick="openCronModal('backup_cron')">Generuj cron</button>
|
||||
</div>
|
||||
<small class="text-muted">Np. <code>0 */6 * * *</code> – co 6 godzin</small>
|
||||
</div>
|
||||
<div class="mb-3 form-check">
|
||||
<input type="checkbox" class="form-check-input" id="enable_regex_entries" name="enable_regex_entries" {% if settings.regex_deploy_enabled %}checked{% endif %}>
|
||||
<label class="form-check-label" for="enable_regex_entries">Włącz regex/CIDR deploy</label>
|
||||
@ -44,4 +52,81 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal do generowania wyrażenia CRON -->
|
||||
<div class="modal fade" id="cronModal" tabindex="-1" aria-labelledby="cronModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="cronModalLabel">Generuj wyrażenie CRON</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Zamknij"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="mb-3">
|
||||
<label for="cron_minute" class="form-label">Minuta</label>
|
||||
<input type="text" class="form-control" id="cron_minute" placeholder="0-59">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="cron_hour_modal" class="form-label">Godzina</label>
|
||||
<input type="text" class="form-control" id="cron_hour_modal" placeholder="0-23">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="cron_day" class="form-label">Dzień miesiąca</label>
|
||||
<input type="text" class="form-control" id="cron_day" placeholder="1-31 lub *">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="cron_month" class="form-label">Miesiąc</label>
|
||||
<input type="text" class="form-control" id="cron_month" placeholder="1-12 lub *">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="cron_dow" class="form-label">Dzień tygodnia</label>
|
||||
<input type="text" class="form-control" id="cron_dow" placeholder="0-6 (0 = niedziela) lub *">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Anuluj</button>
|
||||
<button type="button" class="btn btn-primary" onclick="generateCronExpression()">Generuj</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_js %}
|
||||
{{ super() }}
|
||||
<script>
|
||||
// Globalna zmienna, która będzie przechowywać ID pola formularza do aktualizacji
|
||||
var currentCronField = null;
|
||||
|
||||
function openCronModal(fieldId) {
|
||||
currentCronField = fieldId;
|
||||
// Resetuj wartości w modal
|
||||
document.getElementById('cron_minute').value = "";
|
||||
document.getElementById('cron_hour_modal').value = "";
|
||||
document.getElementById('cron_day').value = "";
|
||||
document.getElementById('cron_month').value = "";
|
||||
document.getElementById('cron_dow').value = "";
|
||||
// Wyświetl modal przy użyciu Bootstrap
|
||||
var cronModal = new bootstrap.Modal(document.getElementById('cronModal'));
|
||||
cronModal.show();
|
||||
}
|
||||
|
||||
function generateCronExpression() {
|
||||
var minute = document.getElementById('cron_minute').value || "*";
|
||||
var hour = document.getElementById('cron_hour_modal').value || "*";
|
||||
var day = document.getElementById('cron_day').value || "*";
|
||||
var month = document.getElementById('cron_month').value || "*";
|
||||
var dow = document.getElementById('cron_dow').value || "*";
|
||||
|
||||
var cronExpression = minute + " " + hour + " " + day + " " + month + " " + dow;
|
||||
if (currentCronField) {
|
||||
document.getElementById(currentCronField).value = cronExpression;
|
||||
}
|
||||
// Zamknij modal
|
||||
var modalEl = document.getElementById('cronModal');
|
||||
var modal = bootstrap.Modal.getInstance(modalEl);
|
||||
modal.hide();
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
|
Reference in New Issue
Block a user