161 lines
		
	
	
		
			5.7 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			161 lines
		
	
	
		
			5.7 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<!DOCTYPE html>
 | 
						|
<html lang="en">
 | 
						|
<head>
 | 
						|
  <meta charset="UTF-8">
 | 
						|
  <title>Remote server management</title>
 | 
						|
  <style>
 | 
						|
    body { font-family: Arial, sans-serif; background: #f1f1f1; margin: 0; padding: 0; }
 | 
						|
    .container { max-width: 800px; margin: 40px auto; background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 0 10px #ccc; }
 | 
						|
    h1 { text-align: center; margin-bottom: 1em; }
 | 
						|
    table { width: 100%; border-collapse: collapse; margin-bottom: 1em; }
 | 
						|
    table th, table td { border: 1px solid #ccc; padding: 8px; text-align: left; }
 | 
						|
    table th { background: #f7f7f7; }
 | 
						|
    .form-section { margin-bottom: 20px; background: #fafafa; padding: 10px; border: 1px solid #ddd; border-radius: 4px; }
 | 
						|
    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; }
 | 
						|
    .delete-btn { background: #dc3545; margin-top: 0; }
 | 
						|
    .delete-btn:hover { background: #c82333; }
 | 
						|
    .links { text-align: center; margin-top: 10px; }
 | 
						|
    .links a { color: #007bff; text-decoration: none; margin: 0 10px; }
 | 
						|
    .links a:hover { text-decoration: underline; }
 | 
						|
    .flash-messages { margin-top: 10px; color: #b30000; text-align: center; }
 | 
						|
    .btn {
 | 
						|
          display: inline-block;
 | 
						|
          padding: 4px 10px;
 | 
						|
          margin: 0 3px;
 | 
						|
          border-radius: 4px;
 | 
						|
          border: none;
 | 
						|
          cursor: pointer;
 | 
						|
          text-decoration: none;
 | 
						|
          color: #fff;
 | 
						|
          font-size: 0.85em;
 | 
						|
          vertical-align: middle;
 | 
						|
        }
 | 
						|
 | 
						|
        /* Kolorowe warianty */
 | 
						|
        .btn-primary {
 | 
						|
          background-color: #007bff;
 | 
						|
        }
 | 
						|
        .btn-primary:hover {
 | 
						|
          background-color: #0056b3;
 | 
						|
        }
 | 
						|
 | 
						|
        .btn-info {
 | 
						|
          background-color: #17a2b8;
 | 
						|
        }
 | 
						|
        .btn-info:hover {
 | 
						|
          background-color: #138496;
 | 
						|
        }
 | 
						|
 | 
						|
        .btn-success {
 | 
						|
          background-color: #28a745;
 | 
						|
        }
 | 
						|
        .btn-success:hover {
 | 
						|
          background-color: #218838;
 | 
						|
        }
 | 
						|
 | 
						|
        .btn-danger {
 | 
						|
          background-color: #dc3545;
 | 
						|
        }
 | 
						|
        .btn-danger:hover {
 | 
						|
          background-color: #c82333;
 | 
						|
        }
 | 
						|
    .resolved-hostname {
 | 
						|
      display: none;
 | 
						|
      font-size: 0.7em;
 | 
						|
      color: #777;
 | 
						|
    }
 | 
						|
    td:hover .resolved-hostname {
 | 
						|
      display: block;
 | 
						|
    }
 | 
						|
  </style>
 | 
						|
</head>
 | 
						|
<body>
 | 
						|
  <div class="container">
 | 
						|
    <h1>Remote server management</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 %}
 | 
						|
    <div class="form-section">
 | 
						|
      <h2>Add new server</h2>
 | 
						|
      <form method="POST" action="{{ url_for('manage_hosts') }}">
 | 
						|
        <label for="hostname">Hostname (IP or domain):</label>
 | 
						|
        <input type="text" name="hostname" id="hostname" required />
 | 
						|
        <label for="username">SSH Username:</label>
 | 
						|
        <input type="text" name="username" id="username" required />
 | 
						|
        <label for="password">SSH Password:</label>
 | 
						|
        <input type="password" name="password" id="password" />
 | 
						|
        <label for="port">SSH Port:</label>
 | 
						|
        <input type="text" name="port" id="port" value="22" />
 | 
						|
        <label for="host_type">Type:</label>
 | 
						|
        <select name="host_type" id="host_type" required>
 | 
						|
          <option value="linux">Linux</option>
 | 
						|
          <option value="mikrotik">Mikrotik</option>
 | 
						|
        </select>
 | 
						|
        <label for="auth_method">Authentication Method:</label>
 | 
						|
        <select name="auth_method" id="auth_method">
 | 
						|
          <option value="password">Password</option>
 | 
						|
          <option value="ssh_key">SSH Key</option>
 | 
						|
        </select>
 | 
						|
        <label for="private_key">Private Key (if using SSH Key):</label>
 | 
						|
        <textarea name="private_key" id="private_key" rows="5"></textarea>
 | 
						|
        <label for="key_passphrase">Key Passphrase (if encrypted key):</label>
 | 
						|
        <input type="password" name="key_passphrase" id="key_passphrase" />
 | 
						|
        <button type="submit">Add Host</button>
 | 
						|
      </form>
 | 
						|
    </div>
 | 
						|
    <table>
 | 
						|
      <thead>
 | 
						|
        <tr>
 | 
						|
          <th>ID</th>
 | 
						|
          <th>Hostname</th>
 | 
						|
          <th>SSH User</th>
 | 
						|
          <th>Port</th>
 | 
						|
          <th>Type</th>
 | 
						|
          <th>Auth Method</th>
 | 
						|
          <th>Actions</th>
 | 
						|
        </tr>
 | 
						|
      </thead>
 | 
						|
      <tbody>
 | 
						|
        {% for h in hosts %}
 | 
						|
        <tr>
 | 
						|
          <td>{{ h.id }}</td>
 | 
						|
          <td>
 | 
						|
            <span class="primary-hostname">{{ h.hostname }}</span>
 | 
						|
            <br>
 | 
						|
            <span class="resolved-hostname">{{ h.resolved_hostname }}</span>
 | 
						|
          </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">Edit</a>
 | 
						|
            <a href="{{ url_for('test_host', id=h.id) }}" class="btn btn-info">Test</a>
 | 
						|
            <a href="{{ url_for('backup_host', host_id=h.id) }}" class="btn btn-success">Backup</a>
 | 
						|
            <form method="GET" action="{{ url_for('delete_host', id=h.id) }}" style="display:inline;">
 | 
						|
              <button type="submit" class="btn btn-danger">Delete</button>
 | 
						|
            </form>
 | 
						|
          </td>
 | 
						|
        </tr>
 | 
						|
        {% endfor %}
 | 
						|
      </tbody>
 | 
						|
    </table>
 | 
						|
    <div class="links">
 | 
						|
      <a href="{{ url_for('import_hosts') }}">Import Servers from CSV</a> |
 | 
						|
      <a href="{{ url_for('export_hosts') }}">Export Servers to CSV</a> |
 | 
						|
      <a href="{{ url_for('dashboard') }}">Go to Dashboard</a>
 | 
						|
    </div>
 | 
						|
  </div>
 | 
						|
</body>
 | 
						|
</html>
 |