v0.81.0: retire drive-activation banner; add standalone "Kiszolgáló újraindítása" button
In the intermediary-mount model an enrolled drive binds live into the running guest (no reboot), so the "… meghajtó aktiválásra vár / Újraindítás most" banner was an obsolete relic — also dead since v0.78 (pendingActivationDrives keyed on the raw MountPath vs the now-stable sp.Path). Removed the banner block + activatePendingDrives JS (settings.html), the PendingDrives feed (handlers.go), and the dead pendingActivationDrives helper + its unused internal/system import. Renamed handleStorageActivate -> HandleServerReboot (split out a testable serverReboot core), removed the /api/storage/activate case, and mounted the handler at the new non-storage route /api/server/reboot (RequireAuth+CsrfProtect). The agent GuestReboot primitive is reused unchanged. Added the standalone "Kiszolgáló újraindítása" settings card (sibling to the controller-only "Vezérlő újraindítása"), reusing the pollRestart() loop. Test: TestHandleServerReboot_CallsGuestReboot (fake diskAgent asserts GuestReboot invoked once + 202). diskAgent/mockAgent gained GuestReboot. 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:
@@ -408,15 +408,6 @@ function pollUntilBack() {
|
||||
<a href="/settings/storage/attach" class="btn btn-sm btn-outline">🔗 Meglévő meghajtó csatolása</a>
|
||||
</div>
|
||||
|
||||
{{if .PendingDrives}}
|
||||
<div class="alert alert-warning" style="margin-top:1rem">
|
||||
<strong>{{len .PendingDrives}} meghajtó aktiválásra vár.</strong>
|
||||
Az újonnan csatolt adatmeghajtók a vendég rövid (~30 mp) újraindítása után válnak elérhetővé az alkalmazások számára.
|
||||
<div style="margin-top:.6rem"><button class="btn btn-sm btn-primary" id="activate-drives-btn" onclick="activatePendingDrives()">Újraindítás most (~30 mp)</button></div>
|
||||
<div id="activate-result" style="margin-top:.5rem"></div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
<div style="margin-top:1.5rem">
|
||||
<h4 style="margin-bottom:.25rem">Meghajtók (ügynök nézet)</h4>
|
||||
<p class="form-hint" style="margin-bottom:.75rem">A host-ügynök által észlelt meghajtók élő nézete. A meghajtó <strong>szerepkörét</strong> az ügynök saját vizsgálattal állapítja meg: a rendszer- és biztonsági-mentés meghajtók védettek (csak operátori aláírással módosíthatók), a felhasználói adatmeghajtókat Ön kezeli.</p>
|
||||
@@ -564,16 +555,6 @@ window.__registeredPaths=[{{range .StoragePaths}}{{if .Path}}"{{.Path}}",{{end}}
|
||||
location.reload();
|
||||
}catch(e){ alert('Hiba: '+e.message); }
|
||||
};
|
||||
// Activate pending drive binds by rebooting the guest (~30s). The reboot takes the controller down
|
||||
// too, so the fetch may not resolve — we reload after the restart window regardless.
|
||||
window.activatePendingDrives=function(){
|
||||
if(!confirm('A vendég újraindul (~30 másodperc). Eközben az alkalmazások és a vezérlőpult rövid időre nem elérhetők. Folytatja?')) return;
|
||||
var btn=document.getElementById('activate-drives-btn'); var out=document.getElementById('activate-result');
|
||||
if(btn) btn.disabled=true;
|
||||
if(out) out.innerHTML='<span class="form-hint">Újraindítás folyamatban… az oldal automatikusan újratöltődik.</span>';
|
||||
fetch('/api/storage/activate',{method:'POST',headers:Object.assign({'Content-Type':'application/json'},csrfHeaders())}).catch(function(){});
|
||||
setTimeout(function(){location.reload();}, 45000);
|
||||
};
|
||||
window.confirmEject=function(where){
|
||||
// The confirm name is the drive BASENAME (matches the server's path.Base(where) check); `where` may
|
||||
// be the stable /mnt/felhom-drives/<name> path, so strip the whole directory, not just the /mnt/ prefix.
|
||||
@@ -1144,6 +1125,16 @@ window.__registeredPaths=[{{range .StoragePaths}}{{if .Path}}"{{.Path}}",{{end}}
|
||||
<button type="button" class="btn btn-outline" id="btn-restart-controller" onclick="restartController()">Vezérlő újraindítása</button>
|
||||
</div>
|
||||
|
||||
<!-- Section: Full server (guest) restart — a deliberate maintenance affordance, sibling to the controller restart -->
|
||||
<div class="settings-card">
|
||||
<h3>Kiszolgáló újraindítása</h3>
|
||||
<p class="settings-card-desc">
|
||||
Az egész kiszolgáló (szerver) újraindítása. Minden alkalmazás rövid időre leáll, és a vezérlőpult kb. 30 másodpercig nem elérhető. Akkor használja, ha a teljes rendszer újraindítására van szükség — egyébként a fenti „Vezérlő újraindítása” elegendő.
|
||||
</p>
|
||||
<div id="server-restart-status"></div>
|
||||
<button type="button" class="btn btn-outline" id="btn-restart-server" onclick="restartServer()">Kiszolgáló újraindítása</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function restartController() {
|
||||
if (!confirm('Biztosan újraindítja a vezérlőt? A művelet néhány másodpercig tart, és a felület rövid időre elérhetetlen lesz.')) return;
|
||||
@@ -1155,6 +1146,16 @@ function restartController() {
|
||||
.then(function(){ pollRestart(0); })
|
||||
.catch(function(){ pollRestart(0); }); // connection may drop as the process exits — poll regardless
|
||||
}
|
||||
function restartServer() {
|
||||
if (!confirm('Biztosan újraindítja a kiszolgálót? Az alkalmazások és a vezérlőpult kb. 30 másodpercre elérhetetlenné válnak.')) return;
|
||||
var btn = document.getElementById('btn-restart-server');
|
||||
var status = document.getElementById('server-restart-status');
|
||||
if (btn) btn.disabled = true;
|
||||
if (status) status.innerHTML = '<div class="alert alert-info">Újraindítás folyamatban… a vezérlőpult néhány másodperc múlva újratölt.</div>';
|
||||
fetch('/api/server/reboot', { method: 'POST', headers: csrfHeaders() })
|
||||
.then(function(){ pollRestart(0); })
|
||||
.catch(function(){ pollRestart(0); }); // the guest reboot drops the connection — poll regardless
|
||||
}
|
||||
function pollRestart(attempt) {
|
||||
if (attempt > 60) { // ~2 min cap — never leave the user on a dead page silently
|
||||
document.getElementById('restart-status').innerHTML =
|
||||
|
||||
Reference in New Issue
Block a user