v0.128.1: suppress the class hint on USB drives (ruling F5)

Only Observe-sourced drives ever carried class, so legacy PVE dir:-backed USB
drives showed 'lassú' while registry-sourced ones never did. The card already
carries the USB type tag. Hub-report ClassHint UNCHANGED (UI-only). Pinned by
TestStorageTemplate_USBClassBadgeSuppressed (red-proof run).
This commit is contained in:
2026-07-13 21:40:37 +02:00
parent 61c1391ff6
commit d752f159b9
3 changed files with 54 additions and 0 deletions
+14
View File
@@ -1,5 +1,19 @@
## Changelog ## Changelog
### v0.128.1 — USB drives never show the rotational class hint (2026-07-13, ruling F5)
`storage.html` `classTag(d)`: `if(d.type==='usb') return '';` ahead of the class branches —
covers both render sites (card badges + metarow, the latter already guards on `d.class`).
Rationale: only Observe-sourced drives ever carried `class`, so the demo's legacy PVE
`dir:`-backed USB drives showed "lassú" while registry-sourced drives never did — a misleading
inconsistency, and the card already carries the USB type tag. Non-USB storages (e.g. a future
internal SATA data drive) keep the hint. **The hub-report `ClassHint` field is UNCHANGED**
(documented hint; UI-only suppression). Pinned by `TestStorageTemplate_USBClassBadgeSuppressed`
(red-proof: guard removed → FAIL "classTag USB guard missing"). Part 1 of the demo
storage-hygiene task (Part 2 = host-side `pvesm remove` of the two legacy dir storages —
operational, no repo change). Task was numbered v0.127.3 pre-sequencing; ships as v0.128.1
(0.127.3 + 0.128.0 already taken).
### v0.128.0 — browser .fab upload on the import page: chunked, tunnel-proof (2026-07-13) ### v0.128.0 — browser .fab upload on the import page: chunked, tunnel-proof (2026-07-13)
The Restore/import flow no longer requires copying `.fab` files to `{tároló}/exports/` by hand The Restore/import flow no longer requires copying `.fab` files to `{tároló}/exports/` by hand
@@ -0,0 +1,36 @@
package web
import (
"bytes"
"strings"
"testing"
)
// F5 (2026-07-13): USB drives never show the rotational class hint — the card already carries
// the USB tag, and only Observe-sourced drives ever had class set, so USB cards flapped between
// "lassú" and nothing depending on the data source. The guard is client-side (classTag runs on
// /api/disks JSON), so the pin asserts the rendered page ships the guard FIRST in classTag.
// Companion red-proof: remove the `d.type==='usb'` guard line → FAIL.
func TestStorageTemplate_USBClassBadgeSuppressed(t *testing.T) {
s := testServer(t)
s.loadTemplates()
var buf bytes.Buffer
if err := s.tmpl.ExecuteTemplate(&buf, "storage", map[string]interface{}{
"Page": "storage", "Title": "Tárolók",
}); err != nil {
t.Fatalf("render storage: %v", err)
}
html := buf.String()
guard := strings.Index(html, `if(d.type==='usb') return '';`)
slow := strings.Index(html, `tag-off">lassú`)
if guard < 0 {
t.Fatal("classTag USB guard missing from the storage page")
}
if slow < 0 {
t.Fatal("classTag slow-branch missing — the guard has nothing to suppress (test needs updating)")
}
if guard > slow {
t.Fatalf("USB guard (at %d) must run BEFORE the class branches (at %d)", guard, slow)
}
}
@@ -250,6 +250,10 @@ window.__registeredPaths=[{{range .StoragePaths}}{{if .Path}}"{{.Path}}",{{end}}
function usageColorClass(p){ if(p>=85) return 'crit'; if(p>=70) return 'warn'; return 'nominal'; } function usageColorClass(p){ if(p>=85) return 'crit'; if(p>=70) return 'warn'; return 'nominal'; }
var LOCK_ICO='<svg class="ico ico-sm"><use href="#i-lock"/></svg>'; var LOCK_ICO='<svg class="ico ico-sm"><use href="#i-lock"/></svg>';
function classTag(d){ function classTag(d){
// F5 2026-07-13: USB drives never show the class hint — the card already carries the USB
// tag, and Observe-sourced USB drives showing "lassú" while registry-sourced ones never do
// was a misleading inconsistency. Hub-report ClassHint is UNCHANGED (UI-only suppression).
if(d.type==='usb') return '';
if(d.class==='fast') return '<span class="tag">gyors</span>'; if(d.class==='fast') return '<span class="tag">gyors</span>';
if(d.class==='slow') return '<span class="tag tag-off">lassú</span>'; if(d.class==='slow') return '<span class="tag tag-off">lassú</span>';
return ''; return '';