srv/poe_manager/templates/switche.html aktualisiert

This commit is contained in:
2025-10-07 18:17:58 +02:00
parent bc80b5fcf1
commit 74617a1e0f

View File

@@ -1,50 +1,52 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block content %} {% block content %}
<h2>Switche</h2> <h2>Switch-Verwaltung</h2>
{% if current_user.is_admin %} <!-- Hinzufügen -->
<h4>Neuen Switch hinzufügen</h4> <form method="post" class="mb-3">
<form method="post" class="row g-2 mb-4">
<input type="hidden" name="add_switch" value="1"> <input type="hidden" name="add_switch" value="1">
<div class="col"><input type="text" name="hostname" placeholder="Hostname" class="form-control" required></div> <div class="row g-2">
<div class="col"><input type="text" name="ip" placeholder="IP-Adresse" class="form-control" required></div> <div class="col"><input class="form-control" name="hostname" placeholder="Hostname" required></div>
<div class="col"><input type="text" name="username" placeholder="Username" class="form-control" required></div> <div class="col"><input class="form-control" name="ip" placeholder="IP-Adresse" required></div>
<div class="col"><input type="password" name="password" placeholder="Password" class="form-control" required></div> <div class="col"><input class="form-control" name="username" placeholder="Benutzername" required></div>
<div class="col"><button class="btn btn-success w-100">Hinzufügen</button></div> <div class="col"><input class="form-control" name="password" type="password" placeholder="Passwort" required></div>
<div class="col-auto">
<button class="btn btn-primary">Hinzufügen</button>
</div>
</div>
</form> </form>
{% endif %}
<table class="table table-bordered"> <!-- Switch-Liste -->
<table class="table table-striped table-hover align-middle">
<thead> <thead>
<tr> <tr>
<th>Hostname</th> <th>Hostname</th>
<th>IP-Adresse</th> <th>IP-Adresse</th>
<th>Username</th> <th>Benutzername</th>
{% if current_user.is_admin %}<th>Aktionen</th>{% endif %} <th>Aktionen</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for s in switches %} {% for s in switches %}
<tr> <tr>
{% if current_user.is_admin %}
<form method="post"> <form method="post">
<input type="hidden" name="edit_switch" value="1"> <input type="hidden" name="edit_switch" value="1">
<input type="hidden" name="old_hostname" value="{{ s['hostname'] }}"> <input type="hidden" name="old_hostname" value="{{ s['hostname'] }}">
<td><input name="hostname" value="{{ s['hostname'] }}" class="form-control" required></td> <td><input class="form-control form-control-sm" name="hostname" value="{{ s['hostname'] }}"></td>
<td><input name="ip" value="{{ s['ip'] }}" class="form-control" required></td> <td><input class="form-control form-control-sm" name="ip" value="{{ s['ip'] }}"></td>
<td><input name="username" value="{{ s['username'] }}" class="form-control" required></td> <td><input class="form-control form-control-sm" name="username" value="{{ s['username'] }}"></td>
<td class="d-flex gap-1"> <td>
<button class="btn btn-primary btn-sm">Speichern</button> <div class="d-flex gap-1">
<button name="delete_switch" value="{{ s['hostname'] }}" class="btn btn-danger btn-sm" <input type="password" class="form-control form-control-sm" name="password" placeholder="Neues Passwort">
onclick="return confirm('Willst du den Switch wirklich löschen?');">Löschen</button> <button class="btn btn-sm btn-success">Speichern</button>
</td> </div>
</form> </form>
{% else %} <form method="post" style="display:inline;">
<td>{{ s['hostname'] }}</td> <input type="hidden" name="delete_switch" value="{{ s['hostname'] }}">
<td>{{ s['ip'] }}</td> <button class="btn btn-sm btn-danger ms-1">Löschen</button>
<td>{{ s['username'] }}</td> </form>
{% endif %} </td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>