{% extends "base.html" %}
{% block content %}
<h2>Settings</h2>

<section>
    <h3>Workspace</h3>
    <button hx-post="/action/rescan" hx-swap="none"
            data-after="feedback" data-feedback-done="Rescanned" data-feedback-idle="Rescan workspace">
        Rescan workspace
    </button>
    <p><small>Re-discover repos in the workspace directory. Use after cloning or removing repos.</small></p>
</section>

<section>
    <h3>Excluded repos</h3>
    {% if state and state.excluded %}
    <table>
        <thead><tr><th>Repo</th><th></th></tr></thead>
        <tbody>
            {% for name in state.excluded %}
            <tr>
                <td>{{ name }}</td>
                <td>
                    <button class="outline small"
                            hx-post="/action/include/{{ name }}"
                            hx-swap="none"
                            data-after="reload">
                        Include
                    </button>
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
    {% else %}
    <p>No excluded repos.</p>
    {% endif %}
</section>

<section>
    <h3>Forges</h3>
    {% if state and state.forges %}
    <table>
        <thead><tr><th>Host</th><th>Type</th></tr></thead>
        <tbody>
            {% for host, info in state.forges.items() %}
            <tr><td>{{ host }}</td><td>{{ info.type | default("gitlab") }}</td></tr>
            {% endfor %}
        </tbody>
    </table>
    {% else %}
    <p>No forges configured.</p>
    {% endif %}
    <p><small>Use <code>project-hub configure-forge</code> CLI to add or modify forges.</small></p>
</section>
{% endblock %}
