v0.79.0: disk view keys the "registered" check on the stable path

Follow-up to v0.78.0. The disk-view JS (settings.html regBadge/actions) checked
registration by the raw mount_path, but the registry stores the stable path since
v0.78.0 — so enrolled drives showed a spurious "Nem regisztrált" badge + Register
button. Fix: regKey(d) = d.guest_path || d.mount_path (agent reports the stable
guest_path per disk); registerDrive still posts the raw path. Display-only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PsnU2ASocYrvzqE82YDYW
This commit is contained in:
2026-06-23 17:42:37 +02:00
parent 081c1cd77f
commit a9f0de4c63
3 changed files with 49 additions and 68 deletions
@@ -441,9 +441,14 @@ window.__registeredPaths=[{{range .StoragePaths}}{{if .Path}}"{{.Path}}",{{end}}
return '<span class="badge badge-lock"><span class="lock-ico">🔒</span>Védett</span>';
}
function dataBadge(d){ return d.data_bearing ? '<span class="badge badge-error" title="'+esc(d.data_reason)+'">Adatot tartalmaz</span>' : ''; }
// regKey is the path a drive is REGISTERED under: the STABLE intermediary path (guest_path,
// /mnt/felhom-drives/<name>) the agent reports, else the raw mount_path (legacy). The registry
// stores the STABLE path (handleStorageRegister/runStorageInit), so checking the raw mount_path
// alone made an enrolled drive read as "Nem regisztrált" + show a spurious Regisztrálás button.
function regKey(d){ return d.guest_path || d.mount_path; }
function regBadge(d, registered){
if(!d.mount_path) return '';
return registered[d.mount_path] ? '<span class="badge badge-ok">Regisztrálva</span>' : '<span class="badge badge-muted">Nem regisztrált</span>';
return registered[regKey(d)] ? '<span class="badge badge-ok">Regisztrálva</span>' : '<span class="badge badge-muted">Nem regisztrált</span>';
}
// appBackingTag marks the storages that actually hold deployed apps: the internal SSD (app
// databases + Docker) and the external user-data drives (large app files). Keyed on the agent's
@@ -476,7 +481,9 @@ window.__registeredPaths=[{{range .StoragePaths}}{{if .Path}}"{{.Path}}",{{end}}
var btns = '';
// A mounted-but-unregistered user-data drive: the natural intent is to USE it → Regisztrálás is
// the PRIMARY action (no format, no eject). Leválasztás/Törlés stay available but secondary.
if(!registered[d.mount_path]){
// Registration is keyed on the STABLE path (regKey) — the registry stores that, not the raw mp;
// registerDrive() still posts the RAW mp (the agent operates on raw, the handler maps to stable).
if(!registered[regKey(d)]){
btns += '<button class="btn btn-xs btn-primary" onclick="registerDrive(\''+mp+'\')">Regisztrálás</button> ';
}
btns += '<button class="btn btn-xs btn-danger-outline" onclick="confirmEject(\''+mp+'\')">Leválasztás</button>';