63 lines
2.5 KiB
HTML
63 lines
2.5 KiB
HTML
{% extends "base.html" %}
|
||
{% block title %}Boards – Location Management{% endblock %}
|
||
|
||
{% block content %}
|
||
<div class="d-flex align-items-center justify-content-between mb-4">
|
||
<h2 class="fw-bold mb-0"><i class="bi bi-motherboard me-2 text-primary"></i>Boards</h2>
|
||
{% if current_user.is_admin() %}
|
||
<a href="{{ url_for('boards.add_board') }}" class="btn btn-primary">
|
||
<i class="bi bi-plus-circle me-1"></i> Add Board
|
||
</a>
|
||
{% endif %}
|
||
</div>
|
||
|
||
{% if boards %}
|
||
<div class="table-responsive">
|
||
<table class="table table-hover align-middle">
|
||
<thead class="table-dark">
|
||
<tr>
|
||
<th>Name</th><th>Type</th><th>Host</th><th>Relays</th><th>Inputs</th><th>Status</th><th>Last Seen</th><th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for b in boards %}
|
||
<tr>
|
||
<td><a href="{{ url_for('boards.board_detail', board_id=b.id) }}" class="fw-semibold text-decoration-none">{{ b.name }}</a></td>
|
||
<td><span class="badge text-bg-secondary">{{ b.board_type }}</span></td>
|
||
<td class="font-monospace small">{{ b.host }}:{{ b.port }}</td>
|
||
<td>{{ b.num_relays }}</td>
|
||
<td>{{ b.num_inputs }}</td>
|
||
<td>
|
||
<span class="badge {% if b.is_online %}text-bg-success{% else %}text-bg-secondary{% endif %}">
|
||
{% if b.is_online %}Online{% else %}Offline{% endif %}
|
||
</span>
|
||
</td>
|
||
<td class="small text-secondary">
|
||
{% if b.last_seen %}{{ b.last_seen.strftime('%Y-%m-%d %H:%M') }}{% else %}—{% endif %}
|
||
</td>
|
||
<td>
|
||
<a href="{{ url_for('boards.board_detail', board_id=b.id) }}" class="btn btn-sm btn-outline-primary me-1"><i class="bi bi-eye"></i></a>
|
||
{% if current_user.is_admin() %}
|
||
<a href="{{ url_for('boards.edit_board', board_id=b.id) }}" class="btn btn-sm btn-outline-secondary me-1"><i class="bi bi-pencil"></i></a>
|
||
<form method="POST" action="{{ url_for('boards.delete_board', board_id=b.id) }}" class="d-inline"
|
||
onsubmit="return confirm('Delete {{ b.name }}?')">
|
||
<button class="btn btn-sm btn-outline-danger"><i class="bi bi-trash"></i></button>
|
||
</form>
|
||
{% endif %}
|
||
</td>
|
||
</tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
{% else %}
|
||
<div class="text-center py-5 text-secondary">
|
||
<i class="bi bi-motherboard display-2"></i>
|
||
<p class="mt-3">No boards yet.</p>
|
||
{% if current_user.is_admin() %}
|
||
<a href="{{ url_for('boards.add_board') }}" class="btn btn-primary">Add Board</a>
|
||
{% endif %}
|
||
</div>
|
||
{% endif %}
|
||
{% endblock %}
|