W13 new-drive pages pre-fill the next free hdd_N and answer a bad name visibly; W14 drive operator detail behind Részletek; W29 plain decommission names no move; unreleased
gates / gates (push) Successful in 1m37s

This commit is contained in:
2026-10-21 22:51:08 +02:00
parent 8c1e290f63
commit 28b05d6d68
16 changed files with 1349 additions and 32 deletions
@@ -17,7 +17,7 @@
<div class="settings-card" id="cfg-card" style="display:none">
<h3>{{T "storage_attach.2_konfiguracio"}}</h3>
<form id="attach-form" onsubmit="return submitAttach(event)">
<form id="attach-form" novalidate onsubmit="return submitAttach(event)">
<div class="form-group">
<label>{{T "storage_attach.kivalasztott_eszkoz"}}</label>
<span class="settings-value mono" id="sel-device">—</span>
@@ -28,8 +28,8 @@
<label for="mount-name">{{T "storage_attach.csatlakoztatasi_nev"}} <span class="required">*</span></label>
<div style="display:flex;align-items:center;gap:.25rem">
<span class="mono" style="opacity:.6">/mnt/</span>
<input type="text" id="mount-name" class="form-control" placeholder="hdd_1"
pattern="[a-zA-Z0-9_-]+" required style="max-width:180px">
<input type="text" id="mount-name" class="form-control" placeholder="hdd_1" value="{{if .SuggestedMountName}}{{.SuggestedMountName}}{{else}}hdd_1{{end}}"
pattern="[a-zA-Z0-9_-]+" maxlength="40" required style="max-width:180px">
</div>
<span class="form-hint">{{T "storage_attach.a_meghajto_a_mnt_nev"}}</span>
</div>
@@ -123,9 +123,20 @@ function pickDisk(radio){
document.getElementById('cfg-card').scrollIntoView({behavior:'smooth'});
}
// W13: the form is novalidate — a browser tooltip was the only answer to an empty or wrong name, and the button
// seemed to do nothing. An already-mounted store has no name to check.
function mountNameProblem(){
if(selMounted){ return ''; }
var v=(document.getElementById('mount-name').value||'').trim();
if(/^[a-zA-Z0-9_-]{1,40}$/.test(v)){ return ''; }
return '{{T "storage_wizard.name_invalid"}}'.replace('{name}', '{{if .SuggestedMountName}}{{.SuggestedMountName}}{{else}}hdd_1{{end}}');
}
async function submitAttach(ev){
ev.preventDefault();
var btn=document.getElementById('attach-btn'); var out=document.getElementById('attach-result');
var bad=mountNameProblem();
if(bad){ out.innerHTML='<div class="alert alert-error" id="mount-name-error">'+esc(bad)+'</div>'; document.getElementById('mount-name').focus(); return false; }
btn.disabled=true; out.innerHTML='<p class="form-hint">{{T "storage_attach.csatlakoztatas_folyamatban"}}</p>';
try{
// R-280: an already-mounted store is REGISTERED in place. Sending it to /api/storage/attach would
@@ -137,7 +148,7 @@ async function submitAttach(ev){
set_default:document.getElementById('set-default').checked};
}else{
url='/api/storage/attach';
body={device:selDevice, fstype:selFSType, mount_name:document.getElementById('mount-name').value,
body={device:selDevice, fstype:selFSType, mount_name:document.getElementById('mount-name').value.trim(),
label:document.getElementById('storage-label').value, set_default:document.getElementById('set-default').checked};
}
var r=await fetch(url,{method:'POST',headers:Object.assign({'Content-Type':'application/json'},csrfHeaders()),body:JSON.stringify(body)});