added gunicorn and updated to the last version of server monitorizare
This commit is contained in:
@@ -1,14 +1,33 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Devices – {{ app_name }}{% endblock %}
|
||||
{% block page_title %}Devices{% endblock %}
|
||||
{% block page_title %}Device Health{% endblock %}
|
||||
|
||||
{% block extra_css %}
|
||||
<style>
|
||||
.mac-badge { font-size: 0.75rem; letter-spacing: 0.03em; }
|
||||
.sync-ok { color: #2ecc71; }
|
||||
.sync-old { color: #e74c3c; }
|
||||
.tbl-sm td, .tbl-sm th { padding: 0.45rem 0.6rem; font-size: 0.88rem; vertical-align: middle; }
|
||||
|
||||
/* Sync status pills */
|
||||
.sync-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
font-size: 0.78rem;
|
||||
font-weight: 600;
|
||||
padding: 3px 9px;
|
||||
border-radius: 20px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.sync-ok { background: #d4edda; color: #155724; }
|
||||
.sync-required { background: #fff3cd; color: #856404; }
|
||||
.sync-pending { background: #cce5ff; color: #004085; }
|
||||
.sync-never { background: #e2e3e5; color: #495057; }
|
||||
|
||||
body.dark-mode .sync-ok { background: #1a3a25; color: #6fcf97; }
|
||||
body.dark-mode .sync-required { background: #3a2e00; color: #f0c040; }
|
||||
body.dark-mode .sync-pending { background: #003060; color: #7ec8e3; }
|
||||
body.dark-mode .sync-never { background: #2a2a2a; color: #999; }
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
@@ -60,7 +79,7 @@
|
||||
<a href="{{ url_for('wmt_web.update_requests', status='pending') }}" class="card text-center h-100 text-decoration-none">
|
||||
<div class="card-body py-3">
|
||||
<h4 class="mb-0 {% if pending_count > 0 %}text-danger{% else %}text-secondary{% endif %}">{{ pending_count }}</h4>
|
||||
<small class="text-muted">Pending Requests</small>
|
||||
<small class="text-muted">Pending Approval</small>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
@@ -88,7 +107,7 @@
|
||||
<th>Work Place</th>
|
||||
<th>Hostname</th>
|
||||
<th>IP</th>
|
||||
<th>MAC Address</th>
|
||||
<th>MAC / Type</th>
|
||||
<th>Status</th>
|
||||
<th>Logs</th>
|
||||
<th>Last Seen</th>
|
||||
@@ -98,20 +117,35 @@
|
||||
</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) %}
|
||||
<tr class="device-row"
|
||||
data-search="{{ device.hostname|lower }} {{ device.device_ip }} {{ (device.nume_masa or '')|lower }} {{ (device.mac_address or '')|lower }}">
|
||||
|
||||
<!-- Work Place -->
|
||||
<td>
|
||||
<strong>{{ device.nume_masa or '—' }}</strong>
|
||||
{% if is_wmt %}
|
||||
<br><small class="text-muted"><i class="fas fa-tablet-alt me-1"></i>WMT</small>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<!-- Hostname -->
|
||||
<td>{{ device.hostname }}</td>
|
||||
|
||||
<!-- IP -->
|
||||
<td><code>{{ device.device_ip }}</code></td>
|
||||
|
||||
<!-- MAC / Type -->
|
||||
<td>
|
||||
{% if device.mac_address %}
|
||||
{% if is_wmt %}
|
||||
<code class="mac-badge">{{ device.mac_address }}</code>
|
||||
{% else %}
|
||||
<span class="text-muted">—</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<!-- Status -->
|
||||
<td>
|
||||
{% if device.status == 'active' %}
|
||||
<span class="badge bg-success">Active</span>
|
||||
@@ -121,24 +155,55 @@
|
||||
<span class="badge bg-danger">Offline</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<!-- Logs -->
|
||||
<td>{{ device_log_counts.get(device.id, 0) }}</td>
|
||||
|
||||
<!-- Last Seen -->
|
||||
<td class="text-muted">
|
||||
{% if device.last_seen %}
|
||||
{{ device.last_seen | local_dt }}
|
||||
{% else %}—{% endif %}
|
||||
</td>
|
||||
|
||||
<!-- Config Sync status -->
|
||||
<td>
|
||||
{% if device.mac_address and device.config_updated_at %}
|
||||
<span class="sync-ok" title="{{ device.config_updated_at | local_dt('%Y-%m-%d %H:%M:%S') }}">
|
||||
<i class="fas fa-check-circle"></i>
|
||||
{{ device.config_updated_at | local_dt('%m-%d %H:%M') }}
|
||||
</span>
|
||||
{% elif device.mac_address %}
|
||||
<span class="sync-old"><i class="fas fa-clock"></i> Never</span>
|
||||
{% else %}
|
||||
{% if not is_wmt %}
|
||||
<span class="text-muted">—</span>
|
||||
|
||||
{% elif has_pending %}
|
||||
{# Unknown device waiting for admin approval #}
|
||||
<a href="{{ url_for('wmt_web.update_requests', status='pending') }}"
|
||||
class="sync-pill sync-pending text-decoration-none"
|
||||
title="Admin approval required for this device">
|
||||
<i class="fas fa-user-clock"></i> Pending Approval
|
||||
</a>
|
||||
|
||||
{% elif device.config_synced_at %}
|
||||
{# Device checked in and server confirmed configs match #}
|
||||
<span class="sync-pill sync-ok"
|
||||
title="Last confirmed in-sync: {{ device.config_synced_at | local_dt('%Y-%m-%d %H:%M:%S') }}">
|
||||
<i class="fas fa-check-circle"></i>
|
||||
OK · {{ device.config_synced_at | local_dt('%m-%d %H:%M') }}
|
||||
</span>
|
||||
|
||||
{% elif device.config_updated_at %}
|
||||
{# Admin pushed config but client hasn't confirmed sync yet #}
|
||||
<span class="sync-pill sync-required"
|
||||
title="Config updated {{ device.config_updated_at | local_dt('%Y-%m-%d %H:%M:%S') }} – awaiting client check-in">
|
||||
<i class="fas fa-arrow-circle-down"></i> Awaiting client
|
||||
</span>
|
||||
|
||||
{% else %}
|
||||
{# WMT device registered but never checked in #}
|
||||
<span class="sync-pill sync-never"
|
||||
title="Client has not checked in yet">
|
||||
<i class="fas fa-question-circle"></i> Never synced
|
||||
</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<!-- Actions -->
|
||||
<td class="text-end text-nowrap">
|
||||
<a href="{{ url_for('main.device_detail', device_id=device.id) }}"
|
||||
class="btn btn-sm btn-outline-primary py-0" title="View Details">
|
||||
@@ -175,6 +240,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 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><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>
|
||||
<small><span class="sync-pill sync-never"><i class="fas fa-question-circle"></i> Never synced</span> — registered but hasn't checked in</small>
|
||||
</div>
|
||||
|
||||
<!-- Add Device Modal -->
|
||||
<div class="modal fade" id="addDeviceModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg">
|
||||
@@ -276,3 +350,4 @@ async function submitAddDevice(event) {
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user