package main
import (
"fmt"
"time"
)
templ probeListPage(probes []Probe) {
Probes
| Name |
URL |
Last Result |
|
for _, probe := range probes {
@probeRow(probe)
}
@probeCreateForm()
}
templ probeCreateForm() {
}
templ probeRow(probe Probe) {
| { probe.Name } |
{ probe.URL } |
if probe.LastResult.CreatedAt.IsZero() {
Not run yet |
} else {
{ probe.LastResult.LastModified } |
}
|
}
templ probeEdit(probe Probe) {
|
|
|
}
templ probePage(probe Probe, history []ProbeResult) {
{ probe.Name }
|
Name
|
{ probe.Name }
|
|
Created At
|
{ probe.CreatedAt.Format(time.RFC3339) }
|
|
URL
|
{ probe.URL }
|
if probe.LastResultID != 0 {
|
Last result at
|
{ probe.LastResult.CreatedAt.Format(time.RFC3339) }
|
|
Last result contents
|
{ probe.LastResult.LastModified }
|
} else {
|
Last result at
|
Probe has not been run yet
|
}
Run history
The most recent 15 runs of this probe.
if len(history) != 0 {
| Time |
Result |
Status code |
Last Modified |
for _, check := range history {
| { check.CreatedAt.Format(time.RFC3339) } |
if check.Success {
✔️
Success
} else {
❌
Failure
}
|
if check.StatusCode != 0 {
{ fmt.Sprint(check.StatusCode) }
}
|
{ check.LastModified } |
}
} else {
This probe has not been run yet, wait 15 minutes or so for it to be run.
}
}
templ probeRunPage(probe Probe, result ProbeResult) {
-
Home
-
-
-
Run { fmt.Sprint(result.ID) }
Probe run { fmt.Sprint(result.ID) }
|
URL
|
{ probe.URL }
|
|
Success?
|
{ fmt.Sprint(result.Success) }
|
|
Last Modified
|
{ result.LastModified }
|
|
Status code
|
{ fmt.Sprint(result.StatusCode) }
|
|
Region
|
{ result.Region }
|
|
Remark
|
if result.Remark != "" {
{ result.Remark }
} else {
n/a
}
|
}