Add card_presence feature, device CRUD, CSV export, Update_Rest_WMT_client playbook, migrate_to_wmt dual-path idmasa

This commit is contained in:
ske087
2026-04-27 14:11:57 +03:00
parent a548fc40de
commit 10dd0a560c
9 changed files with 691 additions and 8 deletions

View File

@@ -62,6 +62,16 @@
<textarea name="notes" class="form-control" rows="2">{{ device.notes or '' if device else '' }}</textarea>
</div>
<div class="mb-4">
<label class="form-label fw-semibold">Card Presence
<small class="text-muted fw-normal">(enable = RFID card reader present; disable = no card reader)</small>
</label>
<select name="card_presence" class="form-select">
<option value="enable" {% if not device or device.card_presence != 'disable' %}selected{% endif %}>enable</option>
<option value="disable" {% if device and device.card_presence == 'disable' %}selected{% endif %}>disable</option>
</select>
</div>
{% if device %}
<div class="alert alert-light border small mb-4">
<strong>Last seen:</strong>

View File

@@ -7,9 +7,14 @@
{% block content %}
<div class="mb-3 d-flex justify-content-between align-items-center">
<p class="text-muted mb-0">{{ devices | length }} device(s) registered.</p>
<a href="{{ url_for('wmt_web.device_new') }}" class="btn btn-success">
<i class="fas fa-plus me-1"></i> New Device
</a>
<div class="d-flex gap-2">
<a href="{{ url_for('wmt_web.devices_export_csv') }}" class="btn btn-outline-secondary">
<i class="fas fa-file-csv me-1"></i> Export CSV
</a>
<a href="{{ url_for('wmt_web.device_new') }}" class="btn btn-success">
<i class="fas fa-plus me-1"></i> New Device
</a>
</div>
</div>
<div class="card">
@@ -23,6 +28,7 @@
<th>MAC Address</th>
<th>Hostname</th>
<th>IP Address</th>
<th>Card Presence</th>
<th>Last Seen</th>
<th>Config Updated</th>
<th class="text-end">Actions</th>
@@ -35,6 +41,13 @@
<td><code>{{ d.mac_address }}</code></td>
<td>{{ d.hostname or '—' }}</td>
<td>{{ d.device_ip or '—' }}</td>
<td>
{% if d.card_presence == 'enable' %}
<span class="badge bg-success">enable</span>
{% else %}
<span class="badge bg-secondary">disable</span>
{% endif %}
</td>
<td class="text-muted small">
{{ d.last_seen | local_dt if d.last_seen else 'Never' }}
</td>