updated view and database
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Devices – {{ app_name }}{% endblock %}
|
||||
{% block page_title %}Device Health{% endblock %}
|
||||
{% block page_title %}Devices{% endblock %}
|
||||
|
||||
{% block extra_css %}
|
||||
<style>
|
||||
@@ -70,8 +70,8 @@ body.dark-mode .sync-never { background: #2a2a2a; color: #999; }
|
||||
<div class="col-6 col-md-2">
|
||||
<div class="card text-center h-100">
|
||||
<div class="card-body py-3">
|
||||
<h4 class="mb-0 text-info">{{ devices|selectattr('mac_address')|list|length }}</h4>
|
||||
<small class="text-muted">WMT Clients</small>
|
||||
<h4 class="mb-0 text-info">{{ devices|selectattr('wmt_enabled')|list|length }}</h4>
|
||||
<small class="text-muted">WMT Enabled</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -92,6 +92,9 @@ body.dark-mode .sync-never { background: #2a2a2a; color: #999; }
|
||||
<button class="btn btn-primary ms-auto" data-bs-toggle="modal" data-bs-target="#addDeviceModal">
|
||||
<i class="fas fa-plus me-1"></i>Add Device
|
||||
</button>
|
||||
<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>
|
||||
<button class="btn btn-outline-secondary" onclick="location.reload()">
|
||||
<i class="fas fa-sync-alt me-1"></i>Refresh
|
||||
</button>
|
||||
@@ -108,7 +111,9 @@ body.dark-mode .sync-never { background: #2a2a2a; color: #999; }
|
||||
<th>Hostname</th>
|
||||
<th>IP</th>
|
||||
<th>MAC / Type</th>
|
||||
<th class="text-center">WMT</th>
|
||||
<th>Status</th>
|
||||
<th>Card</th>
|
||||
<th>Logs</th>
|
||||
<th>Last Seen</th>
|
||||
<th>Config Sync</th>
|
||||
@@ -117,8 +122,9 @@ body.dark-mode .sync-never { background: #2a2a2a; color: #999; }
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for device in devices %}
|
||||
{% set is_wmt = device.mac_address is not none and device.mac_address != '' %}
|
||||
{% set has_pending = is_wmt and (pending_by_mac.get(device.mac_address, 0) > 0) %}
|
||||
{% set has_mac = device.mac_address is not none and device.mac_address != '' %}
|
||||
{% set is_wmt = device.wmt_enabled %}
|
||||
{% set has_pending = has_mac and (pending_by_mac.get(device.mac_address, 0) > 0) %}
|
||||
<tr class="device-row"
|
||||
data-search="{{ device.hostname|lower }} {{ device.device_ip }} {{ (device.nume_masa or '')|lower }} {{ (device.mac_address or '')|lower }}">
|
||||
|
||||
@@ -138,13 +144,27 @@ body.dark-mode .sync-never { background: #2a2a2a; color: #999; }
|
||||
|
||||
<!-- MAC / Type -->
|
||||
<td>
|
||||
{% if is_wmt %}
|
||||
{% if has_mac %}
|
||||
<code class="mac-badge">{{ device.mac_address }}</code>
|
||||
{% else %}
|
||||
<span class="text-muted">—</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<!-- WMT checkpoint -->
|
||||
<td class="text-center">
|
||||
{% if is_wmt %}
|
||||
<span class="text-success"
|
||||
title="WMT enabled · last client check-in {{ device.wmt_last_seen | local_dt('%Y-%m-%d %H:%M:%S') }}">
|
||||
<i class="fas fa-check-circle"></i>
|
||||
</span>
|
||||
{% else %}
|
||||
<span class="text-muted" title="No WMT client check-in recorded">
|
||||
<i class="far fa-circle"></i>
|
||||
</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<!-- Status -->
|
||||
<td>
|
||||
{% if device.status == 'active' %}
|
||||
@@ -156,6 +176,19 @@ body.dark-mode .sync-never { background: #2a2a2a; color: #999; }
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<!-- Card presence (WMT) -->
|
||||
<td>
|
||||
{% if is_wmt or has_mac %}
|
||||
{% if device.card_presence == 'enable' %}
|
||||
<span class="badge bg-success">enable</span>
|
||||
{% else %}
|
||||
<span class="badge bg-secondary">disable</span>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<span class="text-muted">—</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<!-- Logs -->
|
||||
<td>{{ device_log_counts.get(device.id, 0) }}</td>
|
||||
|
||||
@@ -168,7 +201,7 @@ body.dark-mode .sync-never { background: #2a2a2a; color: #999; }
|
||||
|
||||
<!-- Config Sync status -->
|
||||
<td>
|
||||
{% if not is_wmt %}
|
||||
{% if not has_mac %}
|
||||
<span class="text-muted">—</span>
|
||||
|
||||
{% elif has_pending %}
|
||||
@@ -217,6 +250,12 @@ body.dark-mode .sync-never { background: #2a2a2a; color: #999; }
|
||||
class="btn btn-sm btn-outline-secondary py-0" title="Edit">
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
{% if is_wmt or has_mac %}
|
||||
<a href="{{ url_for('wmt_web.device_edit', device_id=device.id) }}"
|
||||
class="btn btn-sm btn-outline-info py-0" title="WMT Config">
|
||||
<i class="fas fa-tablet-alt"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
<form method="post" action="{{ url_for('main.device_delete', device_id=device.id) }}"
|
||||
class="d-inline"
|
||||
onsubmit="return confirm('Delete device {{ device.hostname }}? This also removes all its logs.')">
|
||||
@@ -228,7 +267,7 @@ body.dark-mode .sync-never { background: #2a2a2a; color: #999; }
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="9" class="text-center text-muted py-5">
|
||||
<td colspan="11" class="text-center text-muted py-5">
|
||||
<i class="fas fa-desktop fa-2x mb-2 d-block"></i>
|
||||
No devices registered yet.
|
||||
</td>
|
||||
@@ -242,7 +281,9 @@ body.dark-mode .sync-never { background: #2a2a2a; color: #999; }
|
||||
|
||||
<!-- Sync legend -->
|
||||
<div class="d-flex flex-wrap gap-3 mt-3 ms-1">
|
||||
<small class="text-muted"><strong>Config Sync legend:</strong></small>
|
||||
<small class="text-muted"><strong>Legend:</strong></small>
|
||||
<small><span class="text-success"><i class="fas fa-check-circle"></i></span> WMT enabled — device has checked in via the WMT client</small>
|
||||
<small><span class="text-muted"><i class="far fa-circle"></i></span> No WMT check-in recorded</small>
|
||||
<small><span class="sync-pill sync-ok"><i class="fas fa-check-circle"></i> OK</span> — client confirmed configs match</small>
|
||||
<small><span class="sync-pill sync-required"><i class="fas fa-arrow-circle-down"></i> Awaiting client</span> — server pushed new config, waiting for client check-in</small>
|
||||
<small><span class="sync-pill sync-pending"><i class="fas fa-user-clock"></i> Pending Approval</span> — new/unknown device waiting for admin</small>
|
||||
|
||||
Reference in New Issue
Block a user