v0.126.4: edge-safe error statuses + native-alert ban — writeDiskJSON maps 502/504→500 (CF swallows those bodies; the M1 refusal reached the operator as a JSON SyntaxError popup), M1 refusal = typed errLastUsableDrive → 409; all 29 native alert() swept to showAlert + native_confirm_gate now bans alert( (F-11 class complete)
This commit is contained in:
@@ -101,11 +101,11 @@ function appMigWatch(){
|
||||
function appMigrate(btn,app,label){
|
||||
var sel=document.getElementById('app-migrate-target');
|
||||
var target=sel?sel.value:'';
|
||||
if(!target){ alert('Válassz céltárhelyet.'); return; }
|
||||
if(!target){ showAlert('Válassz céltárhelyet.'); return; }
|
||||
felhomConfirm(btn,'Áthelyezed a(z) '+label+' adatait ide: '+target+'? Az alkalmazás rövid időre leáll. A régi adatok csak sikeres áthelyezés után törlődnek.',function(){
|
||||
fetch('/api/storage/migrate-app',{method:'POST',headers:Object.assign({'Content-Type':'application/json'},csrfHeaders()),body:JSON.stringify({app:app,target:target})})
|
||||
.then(function(r){return r.json();}).then(function(d){ if(d.ok){ appMigWatch(); } else { alert('Hiba: '+(d.error||'ismeretlen')); } })
|
||||
.catch(function(e){ alert('Hiba: '+e); });
|
||||
.then(function(r){return r.json();}).then(function(d){ if(d.ok){ appMigWatch(); } else { showAlert('Hiba: '+(d.error||'ismeretlen')); } })
|
||||
.catch(function(e){ showAlert('Hiba: '+e); });
|
||||
});
|
||||
}
|
||||
(function(){ fetch('/api/storage/migrate/status').then(function(r){return r.json();}).then(function(d){ if(d.data&&d.data.job){ appMigWatch(); } }).catch(function(){}); })();
|
||||
|
||||
@@ -475,9 +475,9 @@ function simulateDisconnect(btn, path) {
|
||||
headers: Object.assign({'Content-Type':'application/json'}, csrfHeaders()),
|
||||
body: JSON.stringify({path: path})
|
||||
}).then(function(r){return r.json()}).then(function(data) {
|
||||
if (!data.ok) alert('Hiba: ' + (data.error || 'ismeretlen'));
|
||||
if (!data.ok) showAlert('Hiba: ' + (data.error || 'ismeretlen'));
|
||||
loadWatchdogStatus();
|
||||
}).catch(function(e) { alert('Hiba: ' + e.message); });
|
||||
}).catch(function(e) { showAlert('Hiba: ' + e.message); });
|
||||
});
|
||||
}
|
||||
function simulateReconnect(path) {
|
||||
@@ -486,9 +486,9 @@ function simulateReconnect(path) {
|
||||
headers: Object.assign({'Content-Type':'application/json'}, csrfHeaders()),
|
||||
body: JSON.stringify({path: path})
|
||||
}).then(function(r){return r.json()}).then(function(data) {
|
||||
if (!data.ok) alert('Hiba: ' + (data.error || 'ismeretlen'));
|
||||
if (!data.ok) showAlert('Hiba: ' + (data.error || 'ismeretlen'));
|
||||
loadWatchdogStatus();
|
||||
}).catch(function(e) { alert('Hiba: ' + e.message); });
|
||||
}).catch(function(e) { showAlert('Hiba: ' + e.message); });
|
||||
}
|
||||
|
||||
// ── Section 5: Hub ──
|
||||
|
||||
@@ -165,14 +165,14 @@
|
||||
var data = await resp.json();
|
||||
if (!data.ok) {
|
||||
checkbox.checked = !enable;
|
||||
alert(data.error || 'Hiba történt');
|
||||
showAlert(data.error || 'Hiba történt');
|
||||
} else {
|
||||
setTimeout(function(){ location.reload(); }, 500);
|
||||
return;
|
||||
}
|
||||
} catch(err) {
|
||||
checkbox.checked = !enable;
|
||||
alert('Hálózati hiba');
|
||||
showAlert('Hálózati hiba');
|
||||
}
|
||||
checkbox.disabled = false;
|
||||
}
|
||||
|
||||
@@ -207,13 +207,13 @@
|
||||
function storageMigrateAll(source,label){
|
||||
var sel=document.getElementById('migrate-target-'+source);
|
||||
var target=sel?sel.value:'';
|
||||
if(!target){ alert('Válassz céltárolót a legördülő menüből.'); return; }
|
||||
if(!target){ showAlert('Válassz céltárolót a legördülő menüből.'); return; }
|
||||
openDialog({title:'Összes adat áthelyezése', confirmLabel:'Áthelyezés',
|
||||
message:'Áthelyezed a(z) '+label+' ÖSSZES adatát ide: '+target+'?\n\nAz alkalmazások az áthelyezés alatt rövid időre leállnak. A forrás adatai csak az ellenőrzés és a sikeres újraindítás után törlődnek.',
|
||||
onConfirm:function(){
|
||||
fetch('/api/storage/migrate',{method:'POST',headers:Object.assign({'Content-Type':'application/json'},csrfHeaders()),body:JSON.stringify({source:source,target:target})})
|
||||
.then(function(r){return r.json();}).then(function(d){ if(d.ok){ migWatch(); } else { alert('Hiba: '+(d.error||'ismeretlen')); } })
|
||||
.catch(function(e){ alert('Hiba: '+e); });
|
||||
.then(function(r){return r.json();}).then(function(d){ if(d.ok){ migWatch(); } else { showAlert('Hiba: '+(d.error||'ismeretlen')); } })
|
||||
.catch(function(e){ showAlert('Hiba: '+e); });
|
||||
}});
|
||||
}
|
||||
// Resume view: if a migration is STILL IN PROGRESS when the page loads, show the panel and watch.
|
||||
@@ -408,9 +408,9 @@ window.__registeredPaths=[{{range .StoragePaths}}{{if .Path}}"{{.Path}}",{{end}}
|
||||
window.registerDrive=async function(where){
|
||||
try{
|
||||
var r=await fetch('/api/storage/register',{method:'POST',headers:Object.assign({'Content-Type':'application/json'},csrfHeaders()),body:JSON.stringify({where:where})});
|
||||
var j=await r.json(); if(!j.ok){ alert('Regisztráció sikertelen: '+(j.error||'')); return; }
|
||||
var j=await r.json(); if(!j.ok){ showAlert('Regisztráció sikertelen: '+(j.error||'')); return; }
|
||||
location.reload();
|
||||
}catch(e){ alert('Hiba: '+e.message); }
|
||||
}catch(e){ showAlert('Hiba: '+e.message); }
|
||||
};
|
||||
window.confirmEject=function(where){
|
||||
// The confirm name is the drive BASENAME (matches the server's path.Base(where) check); `where` may
|
||||
@@ -530,12 +530,12 @@ function doStorageDisconnect(path) {
|
||||
body: JSON.stringify({where: path})
|
||||
}).then(function(r) { return r.json(); }).then(function(data) {
|
||||
if (data.ok) {
|
||||
alert('A meghajtó biztonságosan eltávolítható.');
|
||||
showAlert('A meghajtó biztonságosan eltávolítható.');
|
||||
location.reload();
|
||||
} else {
|
||||
alert('Hiba: ' + (data.error || 'ismeretlen'));
|
||||
showAlert('Hiba: ' + (data.error || 'ismeretlen'));
|
||||
}
|
||||
}).catch(function(e) { alert('Hiba: ' + e); });
|
||||
}).catch(function(e) { showAlert('Hiba: ' + e); });
|
||||
}
|
||||
function storageReconnect(path) {
|
||||
var actionsDiv = document.getElementById('storage-actions-' + path);
|
||||
@@ -548,11 +548,11 @@ function storageReconnect(path) {
|
||||
if (data.ok) {
|
||||
location.reload();
|
||||
} else {
|
||||
alert('Hiba: ' + (data.error || 'ismeretlen'));
|
||||
showAlert('Hiba: ' + (data.error || 'ismeretlen'));
|
||||
if (actionsDiv) actionsDiv.innerHTML = '<button class="btn btn-xs btn-primary" onclick="storageReconnect(\'' + path + '\')">Csatlakoztatás</button>';
|
||||
}
|
||||
}).catch(function(e) {
|
||||
alert('Hiba: ' + e);
|
||||
showAlert('Hiba: ' + e);
|
||||
if (actionsDiv) actionsDiv.innerHTML = '<button class="btn btn-xs btn-primary" onclick="storageReconnect(\'' + path + '\')">Csatlakoztatás</button>';
|
||||
});
|
||||
}
|
||||
@@ -564,12 +564,12 @@ function storageRestartApps(path) {
|
||||
}).then(function(r) { return r.json(); }).then(function(data) {
|
||||
if (data.ok) {
|
||||
var r2 = data.restarted || [];
|
||||
if (r2.length) alert('Elindítva: ' + r2.join(', '));
|
||||
if (r2.length) showAlert('Elindítva: ' + r2.join(', '));
|
||||
location.reload();
|
||||
} else {
|
||||
alert('Hiba: ' + (data.error || 'ismeretlen'));
|
||||
showAlert('Hiba: ' + (data.error || 'ismeretlen'));
|
||||
}
|
||||
}).catch(function(e) { alert('Hiba: ' + e); });
|
||||
}).catch(function(e) { showAlert('Hiba: ' + e); });
|
||||
}
|
||||
// H2: decommission a drive (non-destructive). If a migrate target is picked in the inline select →
|
||||
// migrate-then-decommission; otherwise decommission-anyway with type-to-confirm.
|
||||
@@ -594,9 +594,9 @@ function doStorageDecommission(body) {
|
||||
headers: Object.assign({'Content-Type': 'application/json'}, csrfHeaders()),
|
||||
body: JSON.stringify(body)
|
||||
}).then(function(r) { return r.json(); }).then(function(data) {
|
||||
if (data.ok) { alert('Leszerelés elindítva.'); location.reload(); }
|
||||
else { alert('Hiba: ' + (data.error || 'ismeretlen')); }
|
||||
}).catch(function(e) { alert('Hiba: ' + e); });
|
||||
if (data.ok) { showAlert('Leszerelés elindítva.'); location.reload(); }
|
||||
else { showAlert('Hiba: ' + (data.error || 'ismeretlen')); }
|
||||
}).catch(function(e) { showAlert('Hiba: ' + e); });
|
||||
}
|
||||
// H3: one-click re-enroll a decommissioned/ejected drive — clears the marker, re-attaches under the
|
||||
// parent, restarts the gate-stopped apps (data is intact).
|
||||
@@ -612,8 +612,8 @@ function doStorageReEnroll(path) {
|
||||
body: JSON.stringify({where: path})
|
||||
}).then(function(r) { return r.json(); }).then(function(data) {
|
||||
if (data.ok) { location.reload(); }
|
||||
else { alert('Hiba: ' + (data.error || 'ismeretlen')); }
|
||||
}).catch(function(e) { alert('Hiba: ' + e); });
|
||||
else { showAlert('Hiba: ' + (data.error || 'ismeretlen')); }
|
||||
}).catch(function(e) { showAlert('Hiba: ' + e); });
|
||||
}
|
||||
function cancelEditLabel(path, label) {
|
||||
var wrap = document.getElementById('label-wrap-' + path);
|
||||
|
||||
@@ -218,8 +218,8 @@ function netStorageRemove(name,label){
|
||||
onConfirm:function(){
|
||||
fetch('/api/storage/netstorage/remove',{method:'POST',headers:Object.assign({'Content-Type':'application/json'},csrfHeaders()),body:JSON.stringify({name:name})})
|
||||
.then(function(r){return r.json();}).then(function(d){
|
||||
if(d.ok){ location.reload(); } else { alert('Hiba: '+(d.error||'ismeretlen')); }
|
||||
}).catch(function(e){ alert('Hiba: '+e); });
|
||||
if(d.ok){ location.reload(); } else { showAlert('Hiba: '+(d.error||'ismeretlen')); }
|
||||
}).catch(function(e){ showAlert('Hiba: '+e); });
|
||||
}});
|
||||
}
|
||||
if(document.getElementById('ns-add-form')){ nsToggleSmb(); nsUpdateHostID(); } // form absent on the capability banner
|
||||
|
||||
Reference in New Issue
Block a user