<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Edit server {{ host.hostname }}</title> <style> body { font-family: Arial, sans-serif; background: #f1f1f1; margin: 0; padding: 0; } .container { max-width: 600px; margin: 40px auto; background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 0 10px #ccc; } label { display: block; margin-top: 1em; } input[type="text"], input[type="password"], textarea { width: 100%; padding: 8px; margin-top: 4px; box-sizing: border-box; } button { margin-top: 1em; padding: 10px 20px; background: #007bff; border: none; color: #fff; cursor: pointer; border-radius: 4px; } button:hover { background: #0056b3; } .flash-messages { margin-top: 10px; color: #b30000; text-align: center; } .links { text-align: center; margin-top: 10px; } .links a { color: #007bff; text-decoration: none; margin: 0 10px; } .links a:hover { text-decoration: underline; } </style> </head> <body> <div class="container"> <h1>Edit server {{ host.hostname }}</h1> {% with messages = get_flashed_messages(category_filter=["danger","success","info"]) %} {% if messages %} <div class="flash-messages"> {% for message in messages %} <p>{{ message }}</p> {% endfor %} </div> {% endif %} {% endwith %} <form method="POST" action="{{ url_for('edit_host', id=host.id) }}"> <label for="hostname">Hostname (IP or domain):</label> <input type="text" name="hostname" id="hostname" value="{{ host.hostname }}" required /> <label for="username">SSH Username:</label> <input type="text" name="username" id="username" value="{{ host.username }}" required /> <label for="password">SSH Password:</label> <input type="password" name="password" id="password" value="{{ host.password }}" /> <label for="port">SSH Port:</label> <input type="text" name="port" id="port" value="{{ host.port }}" /> <label for="host_type">Type:</label> <select name="host_type" id="host_type"> <option value="linux" {% if host.type == 'linux' %}selected{% endif %}>Linux</option> <option value="mikrotik" {% if host.type == 'mikrotik' %}selected{% endif %}>Mikrotik</option> </select> <label for="auth_method">Authentication Method:</label> <select name="auth_method" id="auth_method"> <option value="password" {% if host.auth_method == 'password' %}selected{% endif %}>Password</option> <option value="ssh_key" {% if host.auth_method == 'ssh_key' %}selected{% endif %}>SSH Key</option> </select> <label for="private_key">Private Key (if using SSH Key):</label> <textarea name="private_key" id="private_key" rows="5">{{ host.private_key }}</textarea> <label for="key_passphrase">Key Passphrase (if encrypted key):</label> <input type="password" name="key_passphrase" id="key_passphrase" value="{{ host.key_passphrase }}" /> <button type="submit">Save Changes</button> </form> <div class="links"> <a href="{{ url_for('manage_hosts') }}">Back Remote server management</a> | <a href="{{ url_for('dashboard') }}">Back to Dashboard</a> </div> </div> </body> </html>