Initial commit — Server_Monitorizare_v2

This commit is contained in:
ske087
2026-04-23 15:55:46 +03:00
commit d2485e4c66
61 changed files with 13861 additions and 0 deletions

109
templates/device_edit.html Normal file
View File

@@ -0,0 +1,109 @@
{% extends "base.html" %}
{% block title %}Edit {{ device.hostname }} {{ app_name }}{% endblock %}
{% block page_title %}Edit Device{% endblock %}
{% block content %}
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="card">
<div class="card-header">
<i class="fas fa-edit me-2"></i>Edit: <strong>{{ device.hostname }}</strong>
</div>
<div class="card-body">
<form method="post">
<h6 class="text-muted mb-3">Monitoring Fields</h6>
<div class="row g-3 mb-3">
<div class="col-md-6">
<label class="form-label fw-semibold">Hostname <span class="text-danger">*</span></label>
<input type="text" name="hostname" class="form-control" required
value="{{ device.hostname }}">
</div>
<div class="col-md-6">
<label class="form-label fw-semibold">IP Address <span class="text-danger">*</span></label>
<input type="text" name="device_ip" class="form-control" required
value="{{ device.device_ip }}">
</div>
<div class="col-md-6">
<label class="form-label fw-semibold">Device Name / Masa <span class="text-danger">*</span></label>
<input type="text" name="nume_masa" class="form-control" required
value="{{ device.nume_masa or '' }}">
</div>
<div class="col-md-6">
<label class="form-label fw-semibold">Status</label>
<select name="status" class="form-select">
<option value="active" {% if device.status == 'active' %}selected{% endif %}>Active</option>
<option value="inactive" {% if device.status == 'inactive' %}selected{% endif %}>Inactive</option>
<option value="maintenance" {% if device.status == 'maintenance' %}selected{% endif %}>Maintenance</option>
</select>
</div>
<div class="col-md-6">
<label class="form-label fw-semibold">Device Type</label>
<input type="text" name="device_type" class="form-control"
value="{{ device.device_type or '' }}" placeholder="Raspberry Pi, PC, Server…">
</div>
<div class="col-md-6">
<label class="form-label fw-semibold">Physical Location</label>
<input type="text" name="location" class="form-control"
value="{{ device.location or '' }}" placeholder="Floor 2, Room 201">
</div>
<div class="col-md-6">
<label class="form-label fw-semibold">OS Version</label>
<input type="text" name="os_version" class="form-control"
value="{{ device.os_version or '' }}" placeholder="Raspberry Pi OS 11">
</div>
<div class="col-12">
<label class="form-label fw-semibold">Description</label>
<textarea name="description" class="form-control" rows="2">{{ device.description or '' }}</textarea>
</div>
</div>
<hr>
<h6 class="text-muted mb-3">WMT Client Fields</h6>
<div class="row g-3 mb-3">
<div class="col-md-6">
<label class="form-label fw-semibold">MAC Address
<small class="text-muted fw-normal">(WMT client identifier)</small>
</label>
<input type="text" name="mac_address" class="form-control"
value="{{ device.mac_address or '' }}"
placeholder="b8:27:eb:aa:bb:cc"
pattern="^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$">
<div class="form-text">Leave empty if this is not a WMT client device.</div>
</div>
</div>
{% if device.mac_address %}
<div class="alert alert-light border small mb-4">
<strong>Config last updated:</strong>
{{ device.config_updated_at.strftime('%Y-%m-%d %H:%M:%S') if device.config_updated_at else '—' }}<br>
<strong>Info reviewed at:</strong>
<span class="{% if device.info_reviewed_at and device.info_reviewed_at.year > 1970 %}text-success{% else %}text-muted{% endif %}">
{{ device.info_reviewed_at.strftime('%Y-%m-%d %H:%M:%S') if (device.info_reviewed_at and device.info_reviewed_at.year > 1970) else 'Never reviewed' }}
</span><br>
<strong>Last seen:</strong>
{{ device.last_seen.strftime('%Y-%m-%d %H:%M:%S') if device.last_seen else 'Never' }}
</div>
{% endif %}
<div class="d-flex gap-2">
<button type="submit" class="btn btn-primary">
<i class="fas fa-save me-1"></i>Save Changes
</button>
<a href="{{ url_for('main.devices') }}" class="btn btn-outline-secondary">Cancel</a>
<form method="post" action="{{ url_for('main.device_delete', device_id=device.id) }}"
class="ms-auto"
onsubmit="return confirm('Delete {{ device.hostname }}? All logs will also be deleted.')">
<button type="submit" class="btn btn-outline-danger">
<i class="fas fa-trash me-1"></i>Delete Device
</button>
</form>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}