Display the list of registered clients

This commit is contained in:
2025-01-27 21:54:03 +01:00
parent 28b64b4475
commit 2c14281ae3
8 changed files with 147 additions and 8 deletions

View File

@ -14,7 +14,7 @@
<header data-bs-theme="dark">
<div class="navbar navbar-dark bg-dark shadow-sm">
<div class="container">
<a href="#" class="navbar-brand d-flex align-items-center">
<a href="/" class="navbar-brand d-flex align-items-center">
<svg xxmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" stroke="currentColor"
stroke-linecap="round" stroke-linejoin="round" stroke-width="1" aria-hidden="true" class="me-2"
viewBox="0 0 24 24">
@ -46,6 +46,51 @@
</div>
{% endif %}
<!-- Display clients list -->
<div class="card border-light mb-3">
<div class="card-header">Registered clients</div>
<div class="card-body">
{% if clients.len() > 0 %}
<table class="table table-hover">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Description</th>
<th scope="col">Network</th>
<th scope="col">Created</th>
<th scope="col">Used</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
{% for client in clients %}
<tr>
<th scope="row">{{ client.id }}</th>
<td>{{ client.description }}</td>
<td>
{% if let Some(net) = client.network %}
{{ net }}
{% else %}
<i>Unrestricted</i>
{% endif %}
</td>
<td>{{ client.fmt_created() }}</td>
<td>{{ client.fmt_used() }}</td>
<td>
<button type="button" class="btn btn-danger btn-sm">Delete</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% if clients.len() == 0 %}
<p>No client registered yet!</p>
{% endif %}
</div>
</div>
<!-- New client -->
<div class="card border-light mb-3">
<div class="card-header">New client</div>
@ -54,13 +99,14 @@
<div>
<label for="new_client_desc" class="form-label">Description</label>
<input type="text" class="form-control" id="new_client_desc" required minlength="3"
aria-describedby="new_client_desc" placeholder="New client description..." name="new_client_desc" />
aria-describedby="new_client_desc" placeholder="New client description..."
name="new_client_desc"/>
<small class="form-text text-muted">Client description helps with identification.</small>
</div>
<div>
<label for="ip_network" class="form-label">Allowed IP network</label>
<input type="text" class="form-control" id="ip_network" aria-describedby="ip_network"
placeholder="Client network (x.x.x.x/x or x:x:x:x:x:x/x" name="ip_network" />
placeholder="Client network (x.x.x.x/x or x:x:x:x:x:x/x" name="ip_network"/>
<small class="form-text text-muted">Restrict the networks this IP address can be used from.</small>
</div>