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>
{% 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 %}
{{ super() }}
<script>
document.addEventListener('DOMContentLoaded', function() {
// DNS Manager
const dnsList = document.getElementById('dns-list');
const addDnsBtn = document.getElementById('add-dns-btn');
const dnsEntryInput = document.getElementById('dns-entry-input');
function fetchDnsList() {
fetch('/dns')
fetch("{{ url_for('dns.get_dns_list') }}")
.then(response => response.json())
.then(data => {
dnsList.innerHTML = '';
@ -96,7 +63,7 @@ document.getElementById('check-expiring-accounts-btn').addEventListener('click',
function addDnsEntry() {
const dnsEntry = dnsEntryInput.value.trim();
if (dnsEntry) {
fetch('/dns', {
fetch("{{ url_for('dns.add_dns') }}", {
method: 'POST',
headers: {
'Content-Type': 'application/json'
@ -110,7 +77,7 @@ document.getElementById('check-expiring-accounts-btn').addEventListener('click',
}
function removeDnsEntry(dnsEntry) {
fetch('/dns', {
fetch("{{ url_for('dns.remove_dns') }}", {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
@ -123,6 +90,37 @@ document.getElementById('check-expiring-accounts-btn').addEventListener('click',
addDnsBtn.addEventListener('click', addDnsEntry);
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>
{% endblock %}