ui: GitHub-Actions-style detail page, sub-steps, mini-tile run-view
Reshapes the detail page into a run-view: hybrid horizontal pipeline
+ expanded active-step pane with sub-steps, a per-step log pane with
line-numbered permalinks and client-side search, and a runs-history
sidebar that navigates via ?run=N. Default step is server-picked
(running → failed → Reporting) so the operator lands on the thing
that's moving.
Adds a sub_steps table + SSE topic (substep-{run}-{stage}-{ordinal})
so per-disk and per-pass work (SMART, CPUStress CPU/RAM, Storage,
GPU) is visible in the UI instead of buried in stage summary JSON.
Agent emits sub-step reports from existing per-iteration loops.
Dashboard tiles become a mini run-view with a 9-dot step strip so
the operator reads run health across the whole grid at a glance.
Register page gets the same card shell + button styling.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+43
-15
@@ -8,6 +8,7 @@ import (
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// SMART runs smartctl -a on each block device the kernel exposes. We
|
||||
@@ -46,25 +47,21 @@ func SMART(ctx context.Context, d Deps) Outcome {
|
||||
return Outcome{Passed: true, Summary: "skipped (no disks)", Extras: map[string]any{"skipped": true}}
|
||||
}
|
||||
|
||||
type diskReport struct {
|
||||
Device string `json:"device"`
|
||||
Passed bool `json:"passed"`
|
||||
Skipped bool `json:"skipped,omitempty"`
|
||||
Reason string `json:"reason,omitempty"`
|
||||
Raw map[string]any `json:"raw,omitempty"`
|
||||
}
|
||||
|
||||
var reports []diskReport
|
||||
var reports []smartDiskReport
|
||||
var subs []SubStepReport
|
||||
failed := 0
|
||||
usable := 0
|
||||
for _, dev := range disks {
|
||||
rep := diskReport{Device: dev}
|
||||
rep := smartDiskReport{Device: dev}
|
||||
started := time.Now()
|
||||
out, err := runSmartctl(ctx, dev)
|
||||
ended := time.Now()
|
||||
if err != nil {
|
||||
rep.Skipped = true
|
||||
rep.Reason = err.Error()
|
||||
reports = append(reports, rep)
|
||||
d.Info("SMART: " + dev + " skipped (" + err.Error() + ")")
|
||||
subs = append(subs, subStepFromSMART(dev, rep, started, ended))
|
||||
continue
|
||||
}
|
||||
usable++
|
||||
@@ -82,6 +79,7 @@ func SMART(ctx context.Context, d Deps) Outcome {
|
||||
rep.Reason = "no smart_status in output"
|
||||
}
|
||||
reports = append(reports, rep)
|
||||
subs = append(subs, subStepFromSMART(dev, rep, started, ended))
|
||||
}
|
||||
|
||||
extras := map[string]any{
|
||||
@@ -91,10 +89,11 @@ func SMART(ctx context.Context, d Deps) Outcome {
|
||||
}
|
||||
if failed > 0 {
|
||||
return Outcome{
|
||||
Passed: false,
|
||||
Message: fmt.Sprintf("%d disk(s) report SMART FAILED", failed),
|
||||
Summary: fmt.Sprintf("%d/%d failing", failed, usable),
|
||||
Extras: extras,
|
||||
Passed: false,
|
||||
Message: fmt.Sprintf("%d disk(s) report SMART FAILED", failed),
|
||||
Summary: fmt.Sprintf("%d/%d failing", failed, usable),
|
||||
Extras: extras,
|
||||
SubSteps: subs,
|
||||
}
|
||||
}
|
||||
summary := fmt.Sprintf("%d disks, %d SMART-reporting, all PASSED", len(disks), usable)
|
||||
@@ -102,7 +101,36 @@ func SMART(ctx context.Context, d Deps) Outcome {
|
||||
summary = "skipped (no smartctl data on any disk)"
|
||||
extras["skipped"] = true
|
||||
}
|
||||
return Outcome{Passed: true, Summary: summary, Extras: extras}
|
||||
return Outcome{Passed: true, Summary: summary, Extras: extras, SubSteps: subs}
|
||||
}
|
||||
|
||||
// smartDiskReport is the per-disk probe result. Lifted to package scope
|
||||
// so subStepFromSMART can accept it by value.
|
||||
type smartDiskReport struct {
|
||||
Device string `json:"device"`
|
||||
Passed bool `json:"passed"`
|
||||
Skipped bool `json:"skipped,omitempty"`
|
||||
Reason string `json:"reason,omitempty"`
|
||||
Raw map[string]any `json:"raw,omitempty"`
|
||||
}
|
||||
|
||||
// subStepFromSMART builds a per-disk sub-step row from the in-flight
|
||||
// report. "skipped" takes precedence over passed so virtio-blk etc.
|
||||
// render as skipped rather than failed in the UI.
|
||||
func subStepFromSMART(dev string, rep smartDiskReport, started, ended time.Time) SubStepReport {
|
||||
summary, _ := json.Marshal(map[string]any{
|
||||
"device": rep.Device,
|
||||
"reason": rep.Reason,
|
||||
"skipped": rep.Skipped,
|
||||
})
|
||||
return SubStepReport{
|
||||
Name: fmt.Sprintf("smartctl %s", dev),
|
||||
Passed: rep.Passed || rep.Skipped,
|
||||
Skipped: rep.Skipped,
|
||||
StartedAt: started,
|
||||
CompletedAt: ended,
|
||||
SummaryJSON: summary,
|
||||
}
|
||||
}
|
||||
|
||||
func listBlockDisks() ([]string, error) {
|
||||
|
||||
Reference in New Issue
Block a user