{% extends "base.html" %} {% block title %}Hosty - /etc/hosts Manager{% endblock %} {% block extra_css %} {{ super() }} <style> /* Dodatkowy styl, np. modyfikacja wyglądu tooltipów */ .tooltip-inner { max-width: 300px; text-align: left; } </style> {% endblock %} {% block content %} <div class="card mb-4"> <div class="card-header"> <h2>Dodaj nowy serwer</h2> </div> <div class="card-body"> <form method="POST" action="{{ url_for('manage_hosts') }}"> <div class="mb-3"> <label for="hostname" class="form-label">Nazwa hosta (IP lub domena)</label> <input type="text" name="hostname" id="hostname" class="form-control" required> </div> <div class="mb-3"> <label for="username" class="form-label">Użytkownik SSH</label> <input type="text" name="username" id="username" class="form-control" required> </div> <div class="mb-3"> <label for="password" class="form-label">Hasło SSH</label> <input type="password" name="password" id="password" class="form-control"> </div> <div class="mb-3"> <label for="port" class="form-label">Port SSH</label> <input type="text" name="port" id="port" class="form-control" value="22"> </div> <div class="mb-3"> <label for="host_type" class="form-label">Typ</label> <select name="host_type" id="host_type" class="form-select" required> <option value="linux">Linux</option> <option value="mikrotik">Mikrotik</option> </select> </div> <div class="mb-3"> <label for="auth_method" class="form-label">Metoda uwierzytelniania</label> <select name="auth_method" id="auth_method" class="form-select"> <option value="password">Hasło</option> <option value="ssh_key">Klucz SSH</option> </select> </div> <div class="mb-3"> <label for="private_key" class="form-label">Klucz prywatny (jeśli używasz klucza SSH)</label> <textarea name="private_key" id="private_key" rows="4" class="form-control"></textarea> </div> <div class="mb-3"> <label for="key_passphrase" class="form-label">Hasło do klucza (jeśli klucz jest zaszyfrowany)</label> <input type="password" name="key_passphrase" id="key_passphrase" class="form-control"> </div> <button type="submit" class="btn btn-primary">Dodaj hosta</button> </form> </div> </div> <div class="card"> <div class="card-header"> <h2>Lista serwerów</h2> </div> <div class="card-body table-responsive"> <table class="table table-striped"> <thead> <tr> <th>ID</th> <th>Nazwa hosta</th> <th>Użytkownik SSH</th> <th>Port</th> <th>Typ</th> <th>Metoda uwierzytelniania</th> <th>Akcje</th> </tr> </thead> <tbody> {% for h in hosts %} <tr> <td>{{ h.id }}</td> <td data-bs-toggle="tooltip" data-bs-placement="top" title="{{ h.resolved_hostname }}"> {{ h.hostname }} </td> <td>{{ h.username }}</td> <td>{{ h.port }}</td> <td>{{ h.type }}</td> <td>{{ h.auth_method }}</td> <td> <a href="{{ url_for('edit_host', id=h.id) }}" class="btn btn-primary btn-sm">Edytuj</a> <a href="{{ url_for('test_host', id=h.id) }}" class="btn btn-info btn-sm">Testuj</a> <a href="{{ url_for('backup_host', host_id=h.id) }}" class="btn btn-success btn-sm">Backup</a> <form method="GET" action="{{ url_for('delete_host', id=h.id) }}" style="display:inline;"> <button type="submit" class="btn btn-danger btn-sm">Usuń</button> </form> </td> </tr> {% endfor %} </tbody> </table> </div> </div> <div class="mt-3 text-center"> <a href="{{ url_for('import_hosts') }}" class="btn btn-secondary">Importuj serwery z CSV</a> <a href="{{ url_for('export_servers_to_csv') }}" class="btn btn-secondary">Eksportuj serwery do CSV</a> <a href="{{ url_for('dashboard') }}" class="btn btn-secondary">Przejdź do pulpitu</a> </div> {% endblock %}