{{ define "content" }}

<p>
    Send signals to the running process.
</p>

<br>
<button class="btn btn-istio" onclick="sendSIGUSR1()">SIGUSR1</button>

{{ template "last-refresh" .}}

<script>
    "use strict";

    function sendSIGUSR1() {
        let url = window.location.protocol + "//" + window.location.host + "/signalj/SIGUSR1";

        let ajax = new XMLHttpRequest();
        ajax.onload = onload;
        ajax.onerror = onerror;
        ajax.open("PUT", url, true);
        ajax.send();

        function onload() {
            console.log(url + " -> " + ajax.status)
        }

        function onerror(e) {
            console.error(e);
        }
    }
</script>

{{ end }}
