wg-portal/assets/tpl/admin_index.html

187 lines
9.9 KiB
HTML
Raw Normal View History

2020-11-05 13:37:51 -05:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
2020-11-06 06:21:47 -05:00
<title>{{ .Static.WebsiteTitle }} - Admin</title>
<meta name="description" content="{{ .Static.WebsiteTitle }}">
2020-11-05 13:37:51 -05:00
<link rel="stylesheet" href="/css/bootstrap.min.css">
<!--link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i"-->
<link rel="stylesheet" href="/fonts/fontawesome-all.min.css">
<link rel="stylesheet" href="/css/custom.css">
</head>
<body id="page-top">
{{template "prt_nav.html" .}}
<div class="container">
2020-11-07 12:36:23 -05:00
<h1 class="mt-2">WireGuard VPN Administration</h1>
2020-11-06 06:21:47 -05:00
<div class="card">
<div class="card-header">
<div class="d-flex align-items-center">
<span class="mr-auto">Interface status for <strong>{{.Device.DeviceName}}</strong></span>
<a href="/admin/device/edit"><i class="fas fa-cog"></i></a>
</div>
2020-11-05 13:37:51 -05:00
</div>
2020-11-06 06:21:47 -05:00
<div class="card-body">
<div class="row">
<div class="col-sm-6">
<table class="table table-sm table-borderless device-status-table">
<tbody>
<tr>
<td>Public Key:</td>
<td>{{.Device.PublicKey}}</td>
</tr>
<tr>
<td>Public Endpoint:</td>
<td>{{.Device.Endpoint}}</td>
</tr>
<tr>
<td>Listening Port:</td>
<td>{{.Device.ListenPort}}</td>
</tr>
<tr>
<td>Enabled Peers:</td>
<td>{{len .Device.Interface.Peers}}</td>
</tr>
</tbody>
</table>
</div>
<div class="col-sm-6">
<table class="table table-sm table-borderless device-status-table">
<tbody>
<tr>
<td>IP Address:</td>
<td>{{.Device.IPsStr}}</td>
</tr>
<tr>
<td>Default allowed IP's:</td>
<td>{{.Device.AllowedIPsStr}}</td>
</tr>
<tr>
<td>Default DNS servers:</td>
<td>{{.Device.DNSStr}}</td>
</tr>
<tr>
<td>Default MTU:</td>
<td>{{.Device.Mtu}}</td>
</tr>
<tr>
<td>Default Keepalive Interval:</td>
<td>{{.Device.PersistentKeepalive}}</td>
</tr>
</tbody>
</table>
</div>
</div>
2020-11-05 13:37:51 -05:00
</div>
</div>
2020-11-07 12:36:23 -05:00
<div class="mt-4 row">
<div class="col-sm-10 col-12">
<h2>Current VPN Users</h2>
</div>
<div class="col-sm-2 col-12">
2020-11-07 14:32:25 -05:00
<a href="/admin/peer/createldap" title="Add a LDAP user" class="btn btn-primary pull-right"><i class="fa fa-fw fa-user-plus"></i></a>
2020-11-07 12:36:23 -05:00
<a href="/admin/peer/create" title="Manual add a user" class="btn btn-primary pull-right"><i class="fa fa-fw fa-plus"></i>M</a>
</div>
</div>
<div class="mt-2 table-responsive">
2020-11-06 06:21:47 -05:00
<table class="table table-sm" id="userTable">
2020-11-05 13:37:51 -05:00
<thead>
2020-11-06 06:21:47 -05:00
<tr>
2020-11-05 13:37:51 -05:00
<th scope="col" class="list-image-cell"></th><!-- Status and expand -->
2020-11-06 06:21:47 -05:00
<th scope="col"><a href="?sort=id">Identifier <i class="fa fa-fw {{.Session.GetSortIcon "id"}}"></i></a></th>
<th scope="col"><a href="?sort=pubKey">Public Key <i class="fa fa-fw {{.Session.GetSortIcon "pubKey"}}"></i></a></th>
<th scope="col"><a href="?sort=mail">E-Mail <i class="fa fa-fw {{.Session.GetSortIcon "mail"}}"></i></a></th>
<th scope="col"><a href="?sort=ip">IP's <i class="fa fa-fw {{.Session.GetSortIcon "ip"}}"></i></a></th>
<th scope="col"><a href="?sort=traffic">Traffic <i class="fa fa-fw {{.Session.GetSortIcon "traffic"}}"></i></a></th>
<th scope="col"><a href="?sort=handshake">Last Handshake <i class="fa fa-fw {{.Session.GetSortIcon "handshake"}}"></i></a></th>
2020-11-05 13:37:51 -05:00
<th scope="col"></th><!-- Actions -->
</tr>
</thead>
<tbody>
2020-11-06 06:21:47 -05:00
{{range $i, $p :=.Peers}}
2020-11-07 04:31:48 -05:00
<tr id="user-pos-{{$i}}" {{if $p.DeactivatedAt}}class="disabled-peer"{{end}}>
2020-11-05 13:37:51 -05:00
<th scope="row" class="list-image-cell">
<a href="#{{$p.UID}}" data-toggle="collapse" class="collapse-indicator collapsed"></a>
<!-- online check -->
</th>
<td>{{$p.Identifier}}</td>
<td>{{$p.PublicKey}}</td>
<td>{{$p.Email}}</td>
<td>{{$p.IPsStr}}</td>
2020-11-08 04:26:18 -05:00
{{if not $p.Peer}}
<td>? / ?</td>
<td>?</td>
{{else}}
2020-11-07 04:31:48 -05:00
<td>{{if $p.DeactivatedAt}}-{{else}}{{$p.Peer.ReceiveBytes}} / {{$p.Peer.TransmitBytes}}{{end}}</td>
<td>{{if $p.DeactivatedAt}}-{{else}}{{$p.Peer.LastHandshakeTime}}{{end}}</td>
2020-11-08 04:26:18 -05:00
{{end}}
2020-11-05 13:37:51 -05:00
<td>
2020-11-06 06:21:47 -05:00
{{if eq $.Session.IsAdmin true}}
2020-11-07 04:31:48 -05:00
<a href="/admin/peer/edit?pkey={{$p.PublicKey}}"><i class="fas fa-cog"></i></a>
2020-11-05 13:37:51 -05:00
{{end}}
</td>
</tr>
<tr class="hiddenRow">
<td colspan="8" class="hiddenCell" style="white-space:nowrap">
<div class="collapse" id="{{$p.UID}}" data-parent="#userTable">
<div class="row collapsedRow">
<div class="col-md-6 leftBorder">
2020-11-06 06:21:47 -05:00
<ul class="nav nav-tabs">
<li class="nav-item">
2020-11-07 04:31:48 -05:00
<a class="nav-link active" data-toggle="tab" href="#t1{{$p.UID}}">Personal</a>
2020-11-06 06:21:47 -05:00
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#t2{{$p.UID}}">Configuration</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#t3{{$p.UID}}">Other</a>
</li>
</ul>
<div class="tab-content" id="tabContent{{$p.UID}}">
<div id="t1{{$p.UID}}" class="tab-pane fade active show">
2020-11-07 04:31:48 -05:00
{{if not $p.LdapUser}}
<p>No LDAP user-information available...</p>
{{else}}
<ul>
<li>Firstname: {{$p.LdapUser.Firstname}}</li>
<li>Lastname: {{$p.LdapUser.Lastname}}</li>
<li>Phone: {{$p.UID}}</li>
<li>Mail: {{$p.LdapUser.Mail}}</li>
<li>Department: {{$p.UID}}</li>
</ul>
{{end}}
2020-11-05 13:37:51 -05:00
</div>
2020-11-06 06:21:47 -05:00
<div id="t2{{$p.UID}}" class="tab-pane fade">
<pre>{{$p.Config}}</pre>
2020-11-05 13:37:51 -05:00
</div>
2020-11-06 06:21:47 -05:00
<div id="t3{{$p.UID}}" class="tab-pane fade">
2020-11-05 13:37:51 -05:00
<ul>
<li>2</li>
</ul>
</div>
</div>
</div>
<div class="col-md-6">
2020-11-06 06:21:47 -05:00
<img class="list-image-large" src="/user/qrcode?pkey={{$p.PublicKey}}"/>
2020-11-05 13:37:51 -05:00
</div>
</div>
</div>
</td>
</tr>
{{end}}
</tbody>
</table>
2020-11-06 06:21:47 -05:00
<p>Currently listed peers: <strong>{{len .Peers}}</strong></p>
2020-11-05 13:37:51 -05:00
</div>
</div>
{{template "prt_footer.html"}}
<script src="/js/jquery.min.js"></script>
2020-11-06 06:21:47 -05:00
<script src="/js/bootstrap.bundle.min.js"></script>
2020-11-05 13:37:51 -05:00
<script src="/js/jquery.easing.js"></script>
<script src="/js/custom.js"></script>
</body>
</html>