updated to allow config of the new server
This commit is contained in:
@@ -1,83 +0,0 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}WMT Devices – {{ app_name }}{% endblock %}
|
||||
|
||||
{% block page_title %}WMT Devices{% endblock %}
|
||||
|
||||
{% 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>
|
||||
<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">
|
||||
<div class="card-body p-0">
|
||||
{% if devices %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover align-middle mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Work Place</th>
|
||||
<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>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for d in devices %}
|
||||
<tr>
|
||||
<td><strong>{{ d.device_name or '—' }}</strong></td>
|
||||
<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>
|
||||
<td class="text-muted small">
|
||||
{{ d.config_updated_at | local_dt if d.config_updated_at else '—' }}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<a href="{{ url_for('wmt_web.device_edit', device_id=d.id) }}"
|
||||
class="btn btn-sm btn-outline-primary">
|
||||
<i class="fas fa-edit"></i> Edit
|
||||
</a>
|
||||
<form method="post" action="{{ url_for('wmt_web.device_delete', device_id=d.id) }}"
|
||||
class="d-inline"
|
||||
onsubmit="return confirm('Delete device {{ d.mac_address }}?')">
|
||||
<button type="submit" class="btn btn-sm btn-outline-danger">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="text-center text-muted py-5">
|
||||
<i class="fas fa-desktop fa-3x mb-3 opacity-25"></i>
|
||||
<p>No devices registered yet. <a href="{{ url_for('wmt_web.device_new') }}">Add the first one</a>.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -1,183 +0,0 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}WMT Management – {{ app_name }}{% endblock %}
|
||||
|
||||
{% block extra_css %}
|
||||
<style>
|
||||
.stat-card { border-left: 4px solid; }
|
||||
.stat-card.blue { border-color: #3498db; }
|
||||
.stat-card.green { border-color: #2ecc71; }
|
||||
.stat-card.orange{ border-color: #f39c12; }
|
||||
.stat-card.red { border-color: #e74c3c; }
|
||||
.badge-pending { background-color: #f39c12; }
|
||||
.badge-accepted { background-color: #2ecc71; }
|
||||
.badge-rejected { background-color: #e74c3c; }
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block page_title %}WMT Management{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row mb-3">
|
||||
<div class="col">
|
||||
<a href="{{ url_for('wmt_web.settings') }}" class="btn btn-primary me-2">
|
||||
<i class="fas fa-cog"></i> Global Settings
|
||||
</a>
|
||||
<a href="{{ url_for('main.devices') }}" class="btn btn-outline-primary me-2">
|
||||
<i class="fas fa-desktop"></i> Devices
|
||||
</a>
|
||||
<a href="{{ url_for('wmt_web.update_requests') }}" class="btn btn-outline-warning">
|
||||
<i class="fas fa-inbox"></i> Update Requests
|
||||
{% if pending_count > 0 %}
|
||||
<span class="badge bg-danger ms-1">{{ pending_count }}</span>
|
||||
{% endif %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Stats row -->
|
||||
<div class="row g-3 mb-4">
|
||||
<div class="col-sm-6 col-lg-3">
|
||||
<div class="card stat-card blue h-100">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<p class="text-muted mb-1 small">Registered Devices</p>
|
||||
<h4 class="mb-0">{{ devices | length }}</h4>
|
||||
</div>
|
||||
<i class="fas fa-desktop fa-2x text-primary opacity-50"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 col-lg-3">
|
||||
<div class="card stat-card orange h-100">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<p class="text-muted mb-1 small">Pending Requests</p>
|
||||
<h4 class="mb-0">{{ pending_count }}</h4>
|
||||
</div>
|
||||
<i class="fas fa-clock fa-2x text-warning opacity-50"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 col-lg-3">
|
||||
<div class="card stat-card green h-100">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<p class="text-muted mb-1 small">Config Last Updated</p>
|
||||
<h6 class="mb-0">
|
||||
{% if global_cfg and global_cfg.updated_at %}
|
||||
{{ global_cfg.updated_at | local_dt }}
|
||||
{% else %}
|
||||
Never
|
||||
{% endif %}
|
||||
</h6>
|
||||
</div>
|
||||
<i class="fas fa-sync fa-2x text-success opacity-50"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 col-lg-3">
|
||||
<div class="card stat-card red h-100">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<p class="text-muted mb-1 small">Chrome URL</p>
|
||||
<small class="text-truncate d-block" style="max-width:160px">
|
||||
{{ global_cfg.chrome_url if global_cfg else '—' }}
|
||||
</small>
|
||||
</div>
|
||||
<i class="fas fa-globe fa-2x text-danger opacity-50"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-3">
|
||||
<!-- Device list -->
|
||||
<div class="col-lg-7">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<strong><i class="fas fa-desktop me-2"></i>WMT Client Devices</strong>
|
||||
<a href="{{ url_for('main.devices') }}" class="btn btn-sm btn-success">
|
||||
<i class="fas fa-plus"></i> Add
|
||||
</a>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
{% if devices %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-hover mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Work Place</th>
|
||||
<th>Client Name</th>
|
||||
<th>MAC</th>
|
||||
<th>IP</th>
|
||||
<th>Last Seen</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for d in devices %}
|
||||
<tr>
|
||||
<td><strong>{{ d.device_name or '—' }}</strong></td>
|
||||
<td>{{ d.hostname or '—' }}</td>
|
||||
<td><code>{{ d.mac_address }}</code></td>
|
||||
<td>{{ d.device_ip or '—' }}</td>
|
||||
<td class="text-muted small">
|
||||
{{ d.last_seen | local_dt if d.last_seen else 'Never' }}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ url_for('main.device_edit', device_id=d.id) }}"
|
||||
class="btn btn-xs btn-outline-primary btn-sm py-0">Edit</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="text-muted p-3 mb-0">No WMT client devices registered yet.
|
||||
<a href="{{ url_for('main.devices') }}">Manage devices</a>.
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Recent update requests -->
|
||||
<div class="col-lg-5">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<strong><i class="fas fa-inbox me-2"></i>Recent Requests</strong>
|
||||
<a href="{{ url_for('wmt_web.update_requests') }}" class="btn btn-sm btn-outline-secondary">
|
||||
View All
|
||||
</a>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
{% if recent_requests %}
|
||||
<ul class="list-group list-group-flush">
|
||||
{% for r in recent_requests %}
|
||||
<li class="list-group-item d-flex justify-content-between align-items-start py-2">
|
||||
<div>
|
||||
<code class="small">{{ r.mac_address }}</code><br>
|
||||
<small class="text-muted">{{ r.submitted_at | local_dt }}</small>
|
||||
</div>
|
||||
<span class="badge badge-{{ r.status }} rounded-pill">{{ r.status }}</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<p class="text-muted p-3 mb-0">No recent requests.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
+48
-22
@@ -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 %}
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="fas fa-save me-1"></i> Save Settings
|
||||
</button>
|
||||
<a href="{{ url_for('wmt_web.index') }}" class="btn btn-outline-secondary">Cancel</a>
|
||||
<a href="{{ url_for('main.devices') }}" class="btn btn-outline-secondary">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user