fix the template

This commit is contained in:
Karl 2025-07-19 09:44:02 +01:00
parent 08ebb7a265
commit 7622716b92

View File

@ -28,50 +28,17 @@
</div> </div>
{% endblock %} {% endblock %}
{% block scripts %}
{{ super() }}
<script>
document.getElementById('send-test-notification-btn').addEventListener('click', function() {
fetch('{{ url_for("send_test_notification") }}', {
method: 'POST'
}).then(response => {
if (response.ok) {
alert('Test notification sent successfully!');
} else {
alert('Failed to send test notification.');
}
}).catch(err => {
console.error('Error sending test notification:', err);
alert('An error occurred while sending the test notification.');
});
});
document.getElementById('check-expiring-accounts-btn').addEventListener('click', function() {
fetch('{{ url_for("check_expiring_accounts") }}', {
method: 'POST'
}).then(response => {
if (response.ok) {
alert('Expiring accounts check triggered successfully!');
} else {
alert('Failed to trigger expiring accounts check.');
}
}).catch(err => {
console.error('Error triggering expiring accounts check:', err);
alert('An error occurred while triggering the expiring accounts check.');
});
});
</script>
{% endblock %}
{% block scripts %} {% block scripts %}
{{ super() }} {{ super() }}
<script> <script>
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
// DNS Manager
const dnsList = document.getElementById('dns-list'); const dnsList = document.getElementById('dns-list');
const addDnsBtn = document.getElementById('add-dns-btn'); const addDnsBtn = document.getElementById('add-dns-btn');
const dnsEntryInput = document.getElementById('dns-entry-input'); const dnsEntryInput = document.getElementById('dns-entry-input');
function fetchDnsList() { function fetchDnsList() {
fetch('/dns') fetch("{{ url_for('dns.get_dns_list') }}")
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
dnsList.innerHTML = ''; dnsList.innerHTML = '';
@ -96,7 +63,7 @@ document.getElementById('check-expiring-accounts-btn').addEventListener('click',
function addDnsEntry() { function addDnsEntry() {
const dnsEntry = dnsEntryInput.value.trim(); const dnsEntry = dnsEntryInput.value.trim();
if (dnsEntry) { if (dnsEntry) {
fetch('/dns', { fetch("{{ url_for('dns.add_dns') }}", {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
@ -110,7 +77,7 @@ document.getElementById('check-expiring-accounts-btn').addEventListener('click',
} }
function removeDnsEntry(dnsEntry) { function removeDnsEntry(dnsEntry) {
fetch('/dns', { fetch("{{ url_for('dns.remove_dns') }}", {
method: 'DELETE', method: 'DELETE',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
@ -123,6 +90,37 @@ document.getElementById('check-expiring-accounts-btn').addEventListener('click',
addDnsBtn.addEventListener('click', addDnsEntry); addDnsBtn.addEventListener('click', addDnsEntry);
fetchDnsList(); fetchDnsList();
// Other buttons
document.getElementById('send-test-notification-btn').addEventListener('click', function() {
fetch('{{ url_for("send_test_notification") }}', {
method: 'POST'
}).then(response => {
if (response.ok) {
alert('Test notification sent successfully!');
} else {
alert('Failed to send test notification.');
}
}).catch(err => {
console.error('Error sending test notification:', err);
alert('An error occurred while sending the test notification.');
});
});
document.getElementById('check-expiring-accounts-btn').addEventListener('click', function() {
fetch('{{ url_for("check_expiring_accounts") }}', {
method: 'POST'
}).then(response => {
if (response.ok) {
alert('Expiring accounts check triggered successfully!');
} else {
alert('Failed to trigger expiring accounts check.');
}
}).catch(err => {
console.error('Error triggering expiring accounts check:', err);
alert('An error occurred while triggering the expiring accounts check.');
});
});
}); });
</script> </script>
{% endblock %} {% endblock %}