99 lines
3.8 KiB
HTML
99 lines
3.8 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Équipements{% endblock %}
|
|
{% block content %}
|
|
<h1>Inventaire des équipements</h1>
|
|
|
|
<section>
|
|
<h2>Ajouter un équipement</h2>
|
|
<form method="post" action="{{ url_for('create_equipment_form') }}">
|
|
<label>Hostname <input type="text" name="hostname" required></label>
|
|
<label>Type
|
|
<select name="type" required>
|
|
{% for t in types %}
|
|
<option value="{{ t }}">{{ t }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</label>
|
|
<label>Adresse IP <input type="text" name="ip_address" required></label>
|
|
<label>Latence (ms) <input type="number" name="latency" step="0.1" min="0"></label>
|
|
<label><input type="checkbox" name="is_active" checked> Actif</label>
|
|
|
|
<fieldset>
|
|
<legend>Interfaces</legend>
|
|
<div class="interface-row">
|
|
<input type="number" name="ports[]" placeholder="Port" min="0" max="65535">
|
|
<input type="text" name="services[]" placeholder="Service">
|
|
</div>
|
|
<div class="interface-row">
|
|
<input type="number" name="ports[]" placeholder="Port" min="0" max="65535">
|
|
<input type="text" name="services[]" placeholder="Service">
|
|
</div>
|
|
</fieldset>
|
|
|
|
<button type="submit">Créer</button>
|
|
</form>
|
|
</section>
|
|
|
|
<section>
|
|
<h2>Équipements enregistrés ({{ equipments|length }})</h2>
|
|
{% if equipments %}
|
|
<table class="equipments-table">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Hostname</th>
|
|
<th>Type</th>
|
|
<th>Adresse IP</th>
|
|
<th>Latence</th>
|
|
<th>État</th>
|
|
<th>Interfaces</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for eq in equipments %}
|
|
<tr class="{% if not eq.is_active %}row-inactive{% else %}row-active{% endif %}">
|
|
<td>{{ eq.id }}</td>
|
|
<td>{{ eq.hostname }}</td>
|
|
<td><span class="badge">{{ eq.type }}</span></td>
|
|
<td>{{ eq.ip_address }}</td>
|
|
<td>{{ eq.latency if eq.latency is not none else '-' }} ms</td>
|
|
<td>
|
|
{% if eq.is_active %}
|
|
<span class="status status-active">Actif</span>
|
|
{% else %}
|
|
<span class="status status-inactive">Inactif</span>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
{% if eq.interfaces %}
|
|
<ul class="interfaces-list">
|
|
{% for i in eq.interfaces %}
|
|
<li>{{ i.service }} : {{ i.port }}/tcp</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% else %}
|
|
-
|
|
{% endif %}
|
|
</td>
|
|
<td class="actions">
|
|
<form method="post" action="{{ url_for('toggle_equipment', equipment_id=eq.id) }}">
|
|
<button type="submit" class="btn-toggle">
|
|
{% if eq.is_active %}Désactiver{% else %}Activer{% endif %}
|
|
</button>
|
|
</form>
|
|
<form method="post" action="{{ url_for('delete_equipment_form', equipment_id=eq.id) }}"
|
|
onsubmit="return confirm('Confirmer la suppression de {{ eq.hostname }} ?');">
|
|
<button type="submit" class="btn-delete">Supprimer</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{% else %}
|
|
<p class="empty">Aucun équipement enregistré.</p>
|
|
{% endif %}
|
|
</section>
|
|
{% endblock %}
|