fix: improve layout & manual callback

This commit is contained in:
2023-11-12 08:38:43 +01:00
parent c1addbf9fb
commit 163854d7bd

View File

@@ -5,20 +5,28 @@
<div class="container"> <div class="container">
<script> <script>
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function submit_manual(){ function submit_manual(){
await fetch("/report", { fetch("/report", {
headers: { headers: {
'Accept': 'application/json', 'Accept': 'application/json',
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
"service" : "{{ service.service }}",
"token" : "{{ service.token }}", "token" : "{{ service.token }}",
"status" : "OK", "status" : "OK",
"info" : "Submitted from Web-Interface" }) "info" : "Submitted from Web-Interface" })
} }).then( () => {
) sleep(1000).then( () => {
window.location.reload() window.location.reload()
})
}).catch( () => {
alert("Submission failed, see console for details.")
})
} }
</script> </script>
@@ -42,7 +50,7 @@
<p style="color: darkred;">Show in Icinga</p> <p style="color: darkred;">Show in Icinga</p>
</a> </a>
<button style="clear: both;" class="hover mr-3" onclick="submit_manual()"> <button style="clear: both;" class="last-status hover mr-3" onclick="submit_manual()">
<p style="color: darkred;">Submit manual OK</p> <p style="color: darkred;">Submit manual OK</p>
</button> </button>