58 lines
1.4 KiB
HTML
58 lines
1.4 KiB
HTML
{% extends 'layouts/blank.html' %} {% block content %}
|
|
|
|
<!-- Mostra i messaggi di errore o successo -->
|
|
{% if messages %}
|
|
<div>
|
|
{% for message in messages %}
|
|
<div class="alert {% if message.tags %}alert-{{ message.tags }}{% endif %}">
|
|
{{ message }}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
<h1>List Mosquitto Users</h1>
|
|
<a href="{% url 'create_user' %}">
|
|
<button class="btn btn-primary mb-3">Add User</button>
|
|
</a>
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>Site</th>
|
|
<th>Username</th>
|
|
<th>Client ID</th>
|
|
<th>Topic</th>
|
|
<th>Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for user in users %}
|
|
<tr>
|
|
<td>{{user.site}}</td>
|
|
<td>
|
|
<a href="{% url 'edit_user' user.slug %}">{{user.username}}</a
|
|
>
|
|
</td>
|
|
<td>{{user.client_id}}</td>
|
|
<td>{{user.topic}}</td>
|
|
<td id="user-status">
|
|
{% if user.status == "enabled" %}
|
|
<a href="{% url 'disable_user' user.slug %}">
|
|
<button class="btn btn-danger btn-sm">Disable</button>
|
|
</a>
|
|
{% else %}
|
|
<a href="{% url 'enable_user' user.slug %}">
|
|
<button class="btn btn-warning btn-sm">Enable</button>
|
|
</a>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% empty %}
|
|
<tr>
|
|
<td colspan="5"><i> No users </i></td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{% endblock content %}
|