This commit is contained in:
Mateusz779 2023-04-19 09:43:00 +02:00
parent beed694eca
commit 820b839af4
2 changed files with 22 additions and 2 deletions

2
app.py
View File

@ -24,7 +24,7 @@ def main():
if db.get_user_bytoken(auth_token) is None: if db.get_user_bytoken(auth_token) is None:
return redirect("/login") return redirect("/login")
machines_all = db.get_machines() machines_all = db.get_machines()
return render_template('index.html', ssh_port=config.webssh_port, table=machines_all) return render_template('index.html', ssh_port=config.webssh_port, machines=machines_all)
@app.route('/login') @app.route('/login')

View File

@ -60,7 +60,27 @@
</head> </head>
<body> <body>
<h1>Lista maszyn</h1> <h1>Lista maszyn</h1>
{{table}} <table>
<thead>
<tr>
<th>Nazwa maszyny</th>
<th>Obraz</th>
<th>Czas uruchomienia</th>
<th>IP uVPN</th>
<th></th>
</tr>
</thead>
<tbody>
{% for machine in machines %}
<tr>
<td>{{ machine.name }}</td>
<td>{{ machine.image_name }}</td>
<td>{{ machine.start_time }}</td>
<td>{{ machine.ip }}</td>
<td><button onclick="ssh('{{ machine.ip, machine.username, machine.password }}')">SSH</button></td>
</tr>
{% endfor %}
</tbody>
</table> </table>
<script> <script>