Lots of changes to the website

This commit is contained in:
Blake Ridgway
2026-03-27 07:57:13 -05:00
parent 617624c179
commit 7e7480ecf9
33 changed files with 1539 additions and 184 deletions

View File

@@ -0,0 +1,46 @@
{{define "title"}}{{if .IsNew}}New Entry{{else}}Edit Entry{{end}} — Changelog Admin{{end}}
{{define "content"}}
<div class="admin-wrap">
<div class="admin-header">
<h1>{{if .IsNew}}New Changelog Entry{{else}}Edit Entry{{end}}</h1>
<div class="admin-actions">
<a href="/admin/changelog" class="btn btn-outline">Back</a>
</div>
</div>
{{if .Error}}<p class="form-error">{{.Error}}</p>{{end}}
<form method="POST" action="{{if .IsNew}}/admin/changelog/new{{else}}/admin/changelog/edit/{{.Entry.ID}}{{end}}">
<div class="form-row">
<label for="date">Date</label>
<input type="date" id="date" name="date" value="{{.Entry.Date}}" required class="form-input">
</div>
<div class="form-row">
<label for="category">Category</label>
<select id="category" name="category" class="form-input">
{{range .Categories}}
<option value="{{.}}" {{if eq . $.Entry.Category}}selected{{end}}>{{.}}</option>
{{end}}
</select>
</div>
<div class="form-row">
<label for="title">Title</label>
<input type="text" id="title" name="title" value="{{.Entry.Title}}" required
placeholder="e.g. Migrated fw01 from OpenBSD to OPNsense" class="form-input">
</div>
<div class="form-row">
<label for="description">Description <span class="label-optional">(optional)</span></label>
<textarea id="description" name="description" rows="4"
placeholder="Additional details about the change…" class="form-input">{{.Entry.Description}}</textarea>
</div>
<div class="editor-footer">
<button type="submit" class="btn">{{if .IsNew}}Create{{else}}Save{{end}}</button>
</div>
</form>
</div>
{{end}}

View File

@@ -0,0 +1,47 @@
{{define "title"}}Changelog &mdash; Admin{{end}}
{{define "content"}}
<div class="admin-wrap">
<div class="admin-header">
<h1>Changelog</h1>
<div class="admin-actions">
<a href="/admin" class="btn btn-outline">Back</a>
<a href="/changelog" class="btn btn-outline">View Page</a>
<a href="/admin/changelog/new" class="btn">New Entry</a>
</div>
</div>
{{if .Flash}}<p class="flash-msg">{{.Flash}}</p>{{end}}
{{if and .Log .Log.Entries}}
<table class="hw-table">
<thead>
<tr>
<th>Date</th>
<th>Category</th>
<th>Title</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{{range .Log.Entries}}
<tr>
<td class="hw-spec">{{.Date}}</td>
<td><span class="changelog-category changelog-category-{{.Category}}">{{.Category}}</span></td>
<td>{{.Title}}</td>
<td class="admin-row-actions">
<a href="/admin/changelog/edit/{{.ID}}" class="btn btn-outline btn-sm">Edit</a>
<form method="POST" action="/admin/changelog/delete/{{.ID}}" style="display:inline">
<button type="submit" class="btn btn-danger btn-sm"
onclick="return confirm('Delete this entry?')">Delete</button>
</form>
</td>
</tr>
{{end}}
</tbody>
</table>
{{else}}
<p class="empty-state">No entries yet. <a href="/admin/changelog/new">Create one.</a></p>
{{end}}
</div>
{{end}}

View File

@@ -3,7 +3,7 @@
{{define "content"}}
<div class="admin-wrap">
<div class="admin-header">
<h1>Edit Service Status</h1>
<h1>Service Status</h1>
<div class="admin-actions">
<a href="/admin" class="btn btn-outline">Back</a>
<a href="/status" class="btn btn-outline">View Status Page</a>
@@ -18,16 +18,46 @@
<p class="form-error">{{.Error}}</p>
{{end}}
<p class="page-desc">
Edit the raw JSON below. Valid status values: <code>up</code>, <code>degraded</code>,
<code>down</code>, <code>unknown</code>.
</p>
{{if .Page}}
<form method="POST" action="/admin/status">
<textarea name="json" class="json-editor" rows="30" spellcheck="false">{{.JSON}}</textarea>
<table class="hw-table status-editor-table">
<thead>
<tr>
<th>Service</th>
<th>Status</th>
<th>Note</th>
</tr>
</thead>
<tbody>
{{range $i, $s := .Page.Services}}
<tr>
<td>
<span class="status-editor-name">{{$s.Name}}</span>
{{if $s.Description}}<span class="hw-spec">{{$s.Description}}</span>{{end}}
</td>
<td>
<select name="status_{{$i}}" class="status-select status-select-{{$s.Status}}">
<option value="up" {{if eq $s.Status "up"}}selected{{end}}>up</option>
<option value="degraded" {{if eq $s.Status "degraded"}}selected{{end}}>degraded</option>
<option value="down" {{if eq $s.Status "down"}}selected{{end}}>down</option>
<option value="unknown" {{if eq $s.Status "unknown"}}selected{{end}}>unknown</option>
</select>
</td>
<td>
<input type="text" name="note_{{$i}}" value="{{$s.Note}}" placeholder="Optional note&hellip;" class="status-note-input">
</td>
</tr>
{{end}}
</tbody>
</table>
<div class="editor-footer">
<button type="submit" class="btn">Save</button>
{{if .Page.LastChecked}}
<span class="status-last-checked">Last auto-checked: {{.Page.LastChecked.Format "2006-01-02 15:04 UTC"}}</span>
{{end}}
</div>
</form>
{{end}}
</div>
{{end}}