{% extends 'base.html.twig' %}
{% block javascripts %}
    {% block importmap %}{{ importmap('app') }}{% endblock %}
    <script>
function initializeSetup() {
    if ("{{ status }}" === "SUCCESS") {
        window.setTimeout(function() {
            location.replace("{{ next_url }}");
        },2000);
    } else {
        let elem = document.getElementById("main-div");
        let a = document.createElement("a");
        a.setAttribute('href',"{{ setup_url }}");
        a.setAttribute('class','button');
        a.innerText = "{{ failed_button }}";
        elem.appendChild(a);
        console.log("LOADED");
    }
}
    </script>
{% endblock %}
{% block body %}
    <div id="main-div">
    <h1>Running Setup</h1>
    <p>{{ output }} ... {{ status_message }}</p>
    </div>
    {% if error %}
        <p class="error-message"><pre>{{ error }}</pre></p>
    {% endif %}
    <script>initializeSetup();</script>
{% endblock %}
