Zdalne-systemy-z-kit-uVPN/templates/index.html

46 lines
1.3 KiB
HTML
Raw Normal View History

2023-04-19 10:58:31 +00:00
{% extends "base.html" %}
{% block title %}Panel administracyjny{% endblock %}
{% block style %}
2023-04-19 10:27:09 +00:00
2023-04-24 08:22:17 +00:00
<link rel="stylesheet" href="/style/index.css" />
{% endblock %}
2023-04-19 10:58:31 +00:00
{% block content %}
2023-04-19 10:12:38 +00:00
<div class="container">
2023-04-21 08:46:46 +00:00
<h1 class="my-5 mx-auto">Lista maszyn</h1>
2023-04-19 10:12:38 +00:00
<table class="table table-striped table-hover">
<thead>
2023-04-19 07:43:00 +00:00
<tr>
<th>Nazwa maszyny(token)</th>
2023-04-19 10:12:38 +00:00
<th>Obraz</th>
2023-04-21 09:02:06 +00:00
<th>Czas uruchomienia (UTC)</th>
2023-04-19 10:12:38 +00:00
<th>IP uVPN</th>
<th>IP lokalne</th>
<th></th>
2023-04-19 07:43:00 +00:00
</tr>
2023-04-19 10:12:38 +00:00
</thead>
<tbody>
{% for machine in machines %}
<tr>
<td>{{ machine.name }}</td>
<td>{{ machine.image_name }}</td>
<td>{{ machine.start_time }}</td>
<td>{{ machine.ipvpn }}</td>
<td>{{ machine.iplocal }}</td>
<td><button class="btn btn-primary" onclick="ssh('{{ machine.ipvpn }}','{{machine.iplocal}}', '{{ machine.username }}', '{{ machine.password }}')">SSH</button></td>
2023-04-19 10:12:38 +00:00
</tr>
{% endfor %}
</tbody>
</table>
</div>
<script>
function ssh(ipvpn, iplocal, username, password) {
2023-04-19 10:12:38 +00:00
const currentLocation = window.location;
let ip = ipvpn != null ? ipvpn : iplocal;
const newUrl = currentLocation.protocol + '//' + currentLocation.hostname + ':' + {{ ssh_port }} + "/?hostname="+ip+"&username="+username+"&password="+btoa(password);
2023-04-19 10:12:38 +00:00
window.open(newUrl,"_blank");
}
</script>
2023-04-19 10:58:31 +00:00
{% endblock %}