added stats page and password reset

This commit is contained in:
ston1th 2019-11-24 12:25:19 +01:00
commit cabc3e94b4
55 changed files with 8094 additions and 4362 deletions

View file

@ -325,6 +325,7 @@ const (
{{end}}
<ul class="nav navbar-nav ml-auto">
{{if .Login}}
<li class="nav-item"><a class="nav-link" href="/stats">Stats</a></li>
<li class="nav-item"><a class="nav-link" href="/user/edit">Profile</a></li>
<li class="nav-item"><a class="nav-link" href="/logout">Logout</a></li>
{{else}}
@ -501,6 +502,39 @@ created:&lt;="2016-09-21"</code></pre>
</div>
{{end}}
</div>
{{end}}`
stats = `{{define "body"}}
<div class="page-header">
<div class="row">
<h2>{{.BodyTitle}}</h2>
</div>
</div>
<div class="row">
<table class="table table-stripped table-hover">
<tbody>
<tr>
<td><b>Goroutines</b></td>
<td>{{.Data.Goroutines}}</td>
</tr>
<tr>
<td><b>Memory usage</b></td>
<td>{{.Data.Alloc}} MiB</td>
</tr>
<tr>
<td><b>Memory allocated</b></td>
<td>{{.Data.Sys}} MiB</td>
</tr>
<tr>
<td><b>Documents</b></td>
<td>{{.Data.Docs}}</td>
</tr>
<tr>
<td><b>Go Version</b></td>
<td>{{.Data.GoVersion}}</td>
</tr>
</tbody>
</table>
</div>
{{end}}`
tagsDel = `{{define "body"}}
<div class="row">
@ -662,7 +696,7 @@ created:&lt;="2016-09-21"</code></pre>
<form class="form-horizontal" action="/user/edit" method="post">
<input type="hidden" name="token" value="{{.Token}}">
<div class="form-group">
<label class="col-form-label" for="password">Password</label>
<label class="col-form-label" for="password">New Password</label>
<input class="form-control input-sm" type="password" id="password" name="password" autofocus>
</div>
<div class="form-group">
@ -946,6 +980,8 @@ func (s *HTTPServer) loadTemplates() {
s.templ["tagsNewHandler"] = parse(index, menu, tagsNew)
s.templ["tagsEditHandler"] = parse(index, menu, tagsEdit)
s.templ["tagsDelHandler"] = parse(index, menu, tagsDel)
// stats
s.templ["statsHandler"] = parse(index, menu, stats)
// logs
s.templ["logsHandler"] = parse(index, menu, logs)