updated to allow config of the new server

This commit is contained in:
ske087
2026-06-26 10:11:44 +03:00
parent a48b3afb83
commit dbc1c882eb
14 changed files with 197 additions and 1127 deletions
+48 -22
View File
@@ -4,9 +4,10 @@
{% block extra_css %}
<style>
.badge-pending { background-color: #f39c12; color: #fff; }
.badge-accepted { background-color: #2ecc71; color: #fff; }
.badge-rejected { background-color: #e74c3c; color: #fff; }
.badge-pending { background-color: #f39c12; color: #fff; }
.badge-accepted { background-color: #2ecc71; color: #fff; }
.badge-rejected { background-color: #e74c3c; color: #fff; }
.badge-to_be_configured{ background-color: #6f42c1; color: #fff; }
</style>
{% endblock %}
@@ -15,11 +16,21 @@
{% if pending_count > 0 %}
<span class="badge bg-danger ms-2">{{ pending_count }} pending</span>
{% endif %}
{% if unconfigured_count > 0 %}
<span class="badge bg-purple ms-1" style="background:#6f42c1">{{ unconfigured_count }} to configure</span>
{% endif %}
{% endblock %}
{% block content %}
<!-- Filter tabs -->
<ul class="nav nav-tabs mb-4">
<li class="nav-item">
<a class="nav-link {% if status_filter == 'to_be_configured' %}active{% endif %}"
href="{{ url_for('wmt_web.update_requests', status='to_be_configured') }}">
<i class="fas fa-tools me-1"></i>To Be Configured
{% if unconfigured_count > 0 %}<span class="badge ms-1" style="background:#6f42c1;color:#fff">{{ unconfigured_count }}</span>{% endif %}
</a>
</li>
<li class="nav-item">
<a class="nav-link {% if status_filter == 'pending' %}active{% endif %}"
href="{{ url_for('wmt_web.update_requests', status='pending') }}">
@@ -41,6 +52,17 @@
</li>
</ul>
{% if status_filter == 'to_be_configured' and requests %}
<div class="alert alert-info d-flex align-items-start gap-2 mb-3">
<i class="fas fa-info-circle mt-1"></i>
<div>
These devices are online but have <strong>no work_place assigned</strong> yet.
They are <em>not</em> registered in the devices table. Accept a request to create
the device record and push a configuration to the client.
</div>
</div>
{% endif %}
{% if requests %}
<div class="card">
<div class="card-body p-0">
@@ -53,47 +75,51 @@
<th>Proposed Work Place</th>
<th>Proposed Hostname</th>
<th>Proposed IP</th>
<th>Submitted</th>
<th>Client Config Time</th>
<th>Last Seen</th>
<th>Status</th>
{% if status_filter == 'pending' or status_filter == 'all' %}
{% if status_filter in ('pending', 'to_be_configured', 'all') %}
<th class="text-end">Actions</th>
{% endif %}
</tr>
</thead>
<tbody>
{% for r in requests %}
<tr>
<tr {% if r.status == 'to_be_configured' %}class="table-warning"{% endif %}>
<td class="text-muted small">{{ r.id }}</td>
<td><code>{{ r.mac_address }}</code></td>
<td>{{ r.proposed_device_name or '—' }}</td>
<td><code>{{ r.mac_address or '—' }}</code></td>
<td>
{% if r.status == 'to_be_configured' %}
<span class="text-muted fst-italic">not assigned</span>
{% else %}
{{ r.proposed_device_name or '—' }}
{% endif %}
</td>
<td>{{ r.proposed_hostname or '—' }}</td>
<td>{{ r.proposed_device_ip or '—' }}</td>
<td class="text-muted small">{{ r.submitted_at | local_dt }}</td>
<td class="text-muted small">{{ r.client_config_mtime or '—' }}</td>
<td>
<span class="badge badge-{{ r.status }} rounded-pill">{{ r.status }}</span>
<span class="badge badge-{{ r.status }} rounded-pill">{{ r.status.replace('_', ' ') }}</span>
{% if r.admin_reviewed_at %}
<br><small class="text-muted">{{ r.admin_reviewed_at | local_dt }}</small>
{% endif %}
</td>
{% if status_filter == 'pending' or status_filter == 'all' %}
{% if status_filter in ('pending', 'to_be_configured', 'all') %}
<td class="text-end">
{% if r.status == 'pending' %}
<!-- Accept -->
{% if r.status in ('pending', 'to_be_configured') %}
<!-- Accept / Assign -->
<form method="post" action="{{ url_for('wmt_web.accept_request', req_id=r.id) }}"
class="d-inline"
onsubmit="return confirm('Accept this request and update the device record?')">
onsubmit="return confirm('Accept this request and create/update the device record?')">
<button type="submit" class="btn btn-sm btn-success">
<i class="fas fa-check"></i> Accept
<i class="fas fa-check"></i> {% if r.status == 'to_be_configured' %}Assign{% else %}Accept{% endif %}
</button>
</form>
<!-- Reject -->
<!-- Reject / Dismiss -->
<form method="post" action="{{ url_for('wmt_web.reject_request', req_id=r.id) }}"
class="d-inline ms-1"
onsubmit="return confirm('Reject this request?')">
onsubmit="return confirm('Dismiss this device?')">
<button type="submit" class="btn btn-sm btn-outline-danger">
<i class="fas fa-times"></i> Reject
<i class="fas fa-times"></i> Dismiss
</button>
</form>
{% else %}
@@ -104,8 +130,8 @@
</tr>
{% if r.admin_notes %}
<tr class="table-light">
<td colspan="9" class="small text-muted ps-4">
<i class="fas fa-comment me-1"></i> Admin note: {{ r.admin_notes }}
<td colspan="8" class="small text-muted ps-4">
<i class="fas fa-comment me-1"></i>{{ r.admin_notes }}
</td>
</tr>
{% endif %}
@@ -118,7 +144,7 @@
{% else %}
<div class="text-center text-muted py-5">
<i class="fas fa-inbox fa-3x mb-3 opacity-25"></i>
<p>No {{ status_filter }} requests found.</p>
<p>No {{ status_filter.replace('_', ' ') }} requests found.</p>
</div>
{% endif %}
{% endblock %}