Show logs when editing a code
All checks were successful
/ build-container (push) Successful in 8m14s

This commit is contained in:
Finn 2024-11-24 16:08:06 -08:00
parent 060b5705c8
commit a26b9cc63e
7 changed files with 113 additions and 5 deletions

View file

@ -5,6 +5,7 @@ import (
"fmt"
"html/template"
"io/fs"
"time"
"git.janky.solutions/finn/lockserver/config"
)
@ -19,7 +20,8 @@ var (
Templates *template.Template
funcs = template.FuncMap{
"version": func() string { return fmt.Sprintf("better-zwave-locks %s", config.Version) },
"version": func() string { return fmt.Sprintf("better-zwave-locks %s", config.Version) },
"time_since": func(t time.Time) string { return time.Since(t).Round(time.Second).String() },
}
)

View file

@ -8,4 +8,11 @@
<br />
<input type="submit" value="save" />
</form>
<br /><br />
<ul>
{{ range $_, $entry := .Data.log }}
<li>{{ $entry.State }} (<i>{{ $entry.Timestamp | time_since }} ago</i>)</li>
{{ end }}
</ul>
{{ template "footer.html" }}

View file

@ -20,4 +20,7 @@
</tr>
{{ end }}
</table>
<br /><br />
{{ template "footer.html" }}