7714f1f6e4
Full-system validation on demo 9201 (controller v0.102.0 / agent v0.73.0). Headline: ONE genuine pilot-critical finding — the non-root agent cannot pct-restore the standard Felhom guest because it has bind-mount mountpoints (mp8 /mnt/felhom-drives, mp9 bootstrap) and pct restore refuses bind mounts unless root. This breaks BOTH --selftest=restore-test AND the offsite DR bring-up (R1), linked to a missing VM.Audit/VM.Allocate on the agent token (R2). The large raw FAIL count is dominated by one harness bug (auth-session expiry mis-scoring P3-P9) plus D1-injection/soak-probe/ dryrun-journal/escrow-blob calibration issues; the product where actually exercised was healthy with ZERO resource leaks over ~7h. Demo node healed to pre-campaign state (auth off, notifications restored, no scratch leaks). No production code changed. Evidence snapshot + README under campaign2-evidence-2026-07-07/ (cookie jars scrubbed). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PSK5g6qYLknKj8u3QAFEr6
1104 lines
68 KiB
HTML
1104 lines
68 KiB
HTML
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="hu">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Tárhely — Felhom.eu</title>
|
|
<link rel="icon" type="image/svg+xml" href="/static/favicon.svg">
|
|
<link rel="stylesheet" href="/static/style.css">
|
|
<meta name="csrf-token" content="ee8f0976099202660a6865daf2fe0e15217659da12a012a5dfd9233ce4cb157c">
|
|
<script>
|
|
function csrfHeaders(){var el=document.querySelector('meta[name="csrf-token"]');return el?{'X-CSRF-Token':el.content}:{};}
|
|
function showAlert(msg){var o=document.createElement('div');o.className='modal-overlay';o.id='alert-modal';o.addEventListener('click',function(e){if(e.target===o)o.remove();});var c=document.createElement('div');c.className='modal-card';c.innerHTML='<h3>Üzenet</h3><pre style="white-space:pre-wrap;word-break:break-word;background:var(--bg-2);padding:.75rem;border-radius:.375rem;font-size:.85rem;max-height:60vh;overflow-y:auto;user-select:text;cursor:text">'+msg.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>')+'</pre><div class="modal-actions"><button class="btn btn-primary" onclick="document.getElementById(\'alert-modal\').remove()">OK</button></div>';o.appendChild(c);document.body.appendChild(o);}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<svg xmlns="http://www.w3.org/2000/svg" style="display:none" aria-hidden="true">
|
|
<symbol id="i-hard-drive" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 16h.01" /> <path d="M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" /> <path d="M21.946 12.013H2.054" /> <path d="M6 16h.01" /></symbol>
|
|
<symbol id="i-cpu" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20v2" /> <path d="M12 2v2" /> <path d="M17 20v2" /> <path d="M17 2v2" /> <path d="M2 12h2" /> <path d="M2 17h2" /> <path d="M2 7h2" /> <path d="M20 12h2" /> <path d="M20 17h2" /> <path d="M20 7h2" /> <path d="M7 20v2" /> <path d="M7 2v2" /> <rect x="4" y="4" width="16" height="16" rx="2" /> <rect x="8" y="8" width="8" height="8" rx="1" /></symbol>
|
|
<symbol id="i-memory-stick" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 12v-2" /> <path d="M12 18v-2" /> <path d="M16 12v-2" /> <path d="M16 18v-2" /> <path d="M2 11h1.5" /> <path d="M20 18v-2" /> <path d="M20.5 11H22" /> <path d="M4 18v-2" /> <path d="M8 12v-2" /> <path d="M8 18v-2" /> <rect x="2" y="6" width="20" height="10" rx="2" /></symbol>
|
|
<symbol id="i-thermometer" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z" /></symbol>
|
|
<symbol id="i-triangle-alert" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" /> <path d="M12 9v4" /> <path d="M12 17h.01" /></symbol>
|
|
<symbol id="i-lock" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="11" x="3" y="11" rx="2" ry="2" /> <path d="M7 11V7a5 5 0 0 1 10 0v4" /></symbol>
|
|
<symbol id="i-cloud" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z" /></symbol>
|
|
<symbol id="i-square" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="3" rx="2" /></symbol>
|
|
<symbol id="i-rotate-cw" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" /> <path d="M21 3v5h-5" /></symbol>
|
|
<symbol id="i-file-text" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" /> <path d="M14 2v5a1 1 0 0 0 1 1h5" /> <path d="M10 9H8" /> <path d="M16 13H8" /> <path d="M16 17H8" /></symbol>
|
|
<symbol id="i-external-link" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h6v6" /> <path d="M10 14 21 3" /> <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" /></symbol>
|
|
<symbol id="i-shield" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z" /></symbol>
|
|
<symbol id="i-server" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="8" x="2" y="2" rx="2" ry="2" /> <rect width="20" height="8" x="2" y="14" rx="2" ry="2" /> <line x1="6" x2="6.01" y1="6" y2="6" /> <line x1="6" x2="6.01" y1="18" y2="18" /></symbol>
|
|
<symbol id="i-layout-grid" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="7" height="7" x="3" y="3" rx="1" /> <rect width="7" height="7" x="14" y="3" rx="1" /> <rect width="7" height="7" x="14" y="14" rx="1" /> <rect width="7" height="7" x="3" y="14" rx="1" /></symbol>
|
|
<symbol id="i-settings" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915" /> <circle cx="12" cy="12" r="3" /></symbol>
|
|
<symbol id="i-bell" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.268 21a2 2 0 0 0 3.464 0" /> <path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326" /></symbol>
|
|
<symbol id="i-x" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18" /> <path d="m6 6 12 12" /></symbol>
|
|
<symbol id="i-check" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5" /></symbol>
|
|
<symbol id="i-pencil" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" /> <path d="m15 5 4 4" /></symbol>
|
|
<symbol id="i-info" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10" /> <path d="M12 16v-4" /> <path d="M12 8h.01" /></symbol>
|
|
<symbol id="i-download" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 15V3" /> <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /> <path d="m7 10 5 5 5-5" /></symbol>
|
|
<symbol id="i-upload" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3v12" /> <path d="m17 8-5-5-5 5" /> <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /></symbol>
|
|
<symbol id="i-trash-2" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 11v6" /> <path d="M14 11v6" /> <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" /> <path d="M3 6h18" /> <path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" /></symbol>
|
|
<symbol id="i-wrench" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z" /></symbol>
|
|
<symbol id="i-link" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" /> <path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" /></symbol>
|
|
<symbol id="i-search" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21 21-4.34-4.34" /> <circle cx="11" cy="11" r="8" /></symbol>
|
|
<symbol id="i-plus" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14" /> <path d="M12 5v14" /></symbol>
|
|
<symbol id="i-chevron-down" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6" /></symbol>
|
|
<symbol id="i-play" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z" /></symbol>
|
|
<symbol id="i-pause" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="14" y="3" width="5" height="18" rx="1" /> <rect x="5" y="3" width="5" height="18" rx="1" /></symbol>
|
|
</svg>
|
|
<nav class="sidebar">
|
|
<div class="sidebar-header">
|
|
<img src="/static/felhom-logo.svg" alt="Felhom.eu" class="sidebar-logo">
|
|
<span class="customer-name">Demo Ügyfél</span>
|
|
</div>
|
|
<ul class="nav-links">
|
|
<li><a href="/" class=""><svg class="ico"><use href="#i-layout-grid"/></svg>Vezérlőpult</a></li>
|
|
<li><a href="/stacks" class=""><svg class="ico"><use href="#i-cloud"/></svg>Alkalmazások</a></li>
|
|
<li><a href="/storage" class="active"><svg class="ico"><use href="#i-hard-drive"/></svg>Tárhely</a>
|
|
<ul class="nav-links nav-links-sub nav-links-nested">
|
|
<li><a href="/storage" class="active">Meghajtók</a></li>
|
|
<li><a href="/storage/network" class="">Hálózati tárhely</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="/backups" class=""><svg class="ico"><use href="#i-shield"/></svg>Biztonsági mentés</a></li>
|
|
<li><a href="/monitoring" class=""><svg class="ico"><use href="#i-cpu"/></svg>Rendszermonitor</a></li>
|
|
|
|
</ul>
|
|
<div class="sidebar-bottom">
|
|
<div class="nav-group-label">Beállítások</div>
|
|
<ul class="nav-links nav-links-sub">
|
|
<li><a href="/settings" class=""><svg class="ico"><use href="#i-settings"/></svg>Rendszer</a></li>
|
|
<li><a href="/settings/notifications" class=""><svg class="ico"><use href="#i-bell"/></svg>Értesítések</a></li>
|
|
<li><a href="/settings/security" class=""><svg class="ico"><use href="#i-lock"/></svg>Biztonság és hozzáférés</a></li>
|
|
</ul>
|
|
<div class="sidebar-footer">
|
|
<span class="version">0.102.0</span>
|
|
<a href="/logout" class="logout-link">Kijelentkezés ↗</a>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
<main class="content">
|
|
|
|
<div class="alerts-container">
|
|
|
|
|
|
<div class="alert-banner alert-banner-error">
|
|
<span class="alert-icon"><svg class="ico"><use href="#i-triangle-alert"/></svg></span>
|
|
<span class="alert-message">A tárolókezelő ügynök nem elérhető.</span>
|
|
<a href="/settings" class="alert-link">Beállítások →</a>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="page-header">
|
|
<h2>Tárhely — Meghajtók</h2>
|
|
</div>
|
|
|
|
|
|
<div class="settings-card">
|
|
<h3>Adattárolók</h3>
|
|
<p class="settings-card-desc">Külső meghajtók kezelése alkalmazásadatok tárolásához.</p>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="storage-paths-list">
|
|
|
|
<div class="storage-path-item">
|
|
<div class="storage-path-header">
|
|
<div class="storage-path-info">
|
|
<div class="storage-path-label-wrap" id="label-wrap-/mnt/felhom-drives/felhom-usb">
|
|
<span class="storage-path-label" id="label-display-/mnt/felhom-drives/felhom-usb">Tárhely (felhom-usb)</span>
|
|
<button class="btn btn-xs btn-ghost" onclick="editStorageLabel('\/mnt\/felhom-drives\/felhom-usb', 'Tárhely (felhom-usb)')" title="Átnevezés"><svg class="ico ico-sm"><use href="#i-pencil"/></svg></button>
|
|
</div>
|
|
<span class="storage-path-path mono">/mnt/felhom-drives/felhom-usb</span>
|
|
</div>
|
|
<div class="storage-path-badges">
|
|
|
|
|
|
<span class="tag tag-run"><span class="dot"></span>Aktív</span>
|
|
<span class="badge" style="background:rgba(255,165,0,0.15);color:var(--warn)">USB</span>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="storage-path-details">
|
|
|
|
<div class="storage-path-disk">
|
|
<div class="system-info-header">
|
|
<span class="system-info-value">1.2 GB / 915.8 GB</span>
|
|
</div>
|
|
<div class="meter nominal">
|
|
<div class="meter-track">
|
|
<div class="meter-fill" style="width:0%"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="storage-path-fsinfo mono form-hint">
|
|
ext4 · /dev/sdc1[/felhom-data] · HD710 PRO
|
|
</div>
|
|
|
|
|
|
<div class="storage-path-meta">
|
|
|
|
<details class="storage-app-details">
|
|
<summary class="form-hint" style="cursor:pointer">
|
|
3 alkalmazás használja
|
|
</summary>
|
|
<div class="storage-app-list">
|
|
|
|
<div class="storage-app-row">
|
|
<a href="/apps/navidrome" class="storage-app-link">Navidrome</a>
|
|
|
|
<span class="btn btn-xs btn-outline" style="opacity:.45;cursor:not-allowed" title="Hamarosan"><svg class="ico ico-sm"><use href="#i-upload"/></svg> Mozgatás</span>
|
|
</div>
|
|
|
|
<div class="storage-app-row">
|
|
<a href="/apps/nextcloud" class="storage-app-link">Nextcloud</a>
|
|
<span class="mono form-hint">36.8 MB</span>
|
|
<span class="btn btn-xs btn-outline" style="opacity:.45;cursor:not-allowed" title="Hamarosan"><svg class="ico ico-sm"><use href="#i-upload"/></svg> Mozgatás</span>
|
|
</div>
|
|
|
|
<div class="storage-app-row">
|
|
<a href="/apps/paperless-ngx" class="storage-app-link">Paperless-ngx</a>
|
|
|
|
<span class="btn btn-xs btn-outline" style="opacity:.45;cursor:not-allowed" title="Hamarosan"><svg class="ico ico-sm"><use href="#i-upload"/></svg> Mozgatás</span>
|
|
</div>
|
|
|
|
</div>
|
|
</details>
|
|
|
|
</div>
|
|
<div class="drive-agent-extra" id="agent-extra-/mnt/felhom-drives/felhom-usb"></div>
|
|
</div>
|
|
<div class="storage-path-actions">
|
|
|
|
<form method="POST" action="/settings/storage/default" style="display:inline">
|
|
<input type="hidden" name="_csrf" value="ee8f0976099202660a6865daf2fe0e15217659da12a012a5dfd9233ce4cb157c">
|
|
<input type="hidden" name="storage_path" value="/mnt/felhom-drives/felhom-usb">
|
|
<button type="submit" class="btn btn-xs btn-outline">Legyen alapértelmezett</button>
|
|
</form>
|
|
|
|
|
|
<form method="POST" action="/settings/storage/schedulable" style="display:inline">
|
|
<input type="hidden" name="_csrf" value="ee8f0976099202660a6865daf2fe0e15217659da12a012a5dfd9233ce4cb157c">
|
|
<input type="hidden" name="storage_path" value="/mnt/felhom-drives/felhom-usb">
|
|
<input type="hidden" name="schedulable" value="false">
|
|
<button type="submit" class="btn btn-xs btn-outline" title="A meghajtó kimarad az új alkalmazás-telepítésekből. A rajta lévő alkalmazások változatlanul futnak.">Új telepítések letiltása</button>
|
|
</form>
|
|
|
|
|
|
<button class="btn btn-xs btn-danger-outline" onclick="storageDisconnect('\/mnt\/felhom-drives\/felhom-usb', 'Tárhely (felhom-usb)', 3 )" title="Az itt tárolt alkalmazások leállnak, a meghajtó biztonságosan kihúzható. Az adatok megmaradnak; a meghajtó később újra csatlakoztatható.">Biztonságos leválasztás</button>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="migrate-inline" style="display:inline-flex;gap:.35rem;align-items:center">
|
|
<select id="migrate-target-/mnt/felhom-drives/felhom-usb" class="btn btn-xs btn-outline">
|
|
<option value="">Áthelyezés ide…</option>
|
|
<option value="/mnt/felhom-drives/felhom-flash">Tárhely (felhom-flash) (/mnt/felhom-drives/felhom-flash)</option><option value="/mnt/felhom-drives/teszt_enroll">teszt_enroll (/mnt/felhom-drives/teszt_enroll)</option>
|
|
</select>
|
|
<button class="btn btn-xs btn-outline" onclick="storageMigrateAll('\/mnt\/felhom-drives\/felhom-usb','Tárhely (felhom-usb)')">Összes adat áthelyezése</button>
|
|
</span>
|
|
|
|
<button class="btn btn-xs btn-danger-outline" onclick="storageDecommission('\/mnt\/felhom-drives\/felhom-usb','Tárhely (felhom-usb)', 3 )" title="A meghajtó végleges kivonása a rendszerből. Ha céltárolót választ, előbb minden adat átkerül oda; áthelyezés nélkül az adatok a meghajtón maradnak.">Végleges leszerelés</button>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="storage-path-item">
|
|
<div class="storage-path-header">
|
|
<div class="storage-path-info">
|
|
<div class="storage-path-label-wrap" id="label-wrap-/mnt/felhom-drives/felhom-flash">
|
|
<span class="storage-path-label" id="label-display-/mnt/felhom-drives/felhom-flash">Tárhely (felhom-flash)</span>
|
|
<button class="btn btn-xs btn-ghost" onclick="editStorageLabel('\/mnt\/felhom-drives\/felhom-flash', 'Tárhely (felhom-flash)')" title="Átnevezés"><svg class="ico ico-sm"><use href="#i-pencil"/></svg></button>
|
|
</div>
|
|
<span class="storage-path-path mono">/mnt/felhom-drives/felhom-flash</span>
|
|
</div>
|
|
<div class="storage-path-badges">
|
|
|
|
|
|
<span class="tag tag-run"><span class="dot"></span>Aktív</span>
|
|
<span class="badge" style="background:rgba(255,165,0,0.15);color:var(--warn)">USB</span>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="storage-path-details">
|
|
|
|
<div class="storage-path-disk">
|
|
<div class="system-info-header">
|
|
<span class="system-info-value">4.0 GB / 117.1 GB</span>
|
|
</div>
|
|
<div class="meter nominal">
|
|
<div class="meter-track">
|
|
<div class="meter-fill" style="width:3%"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="storage-path-fsinfo mono form-hint">
|
|
ext4 · /dev/sdd1[/felhom-data] · Flash Drive
|
|
</div>
|
|
|
|
|
|
<div class="storage-path-meta">
|
|
|
|
<span class="form-hint">Nincs alkalmazás ezen a tárolón</span>
|
|
|
|
</div>
|
|
<div class="drive-agent-extra" id="agent-extra-/mnt/felhom-drives/felhom-flash"></div>
|
|
</div>
|
|
<div class="storage-path-actions">
|
|
|
|
<form method="POST" action="/settings/storage/default" style="display:inline">
|
|
<input type="hidden" name="_csrf" value="ee8f0976099202660a6865daf2fe0e15217659da12a012a5dfd9233ce4cb157c">
|
|
<input type="hidden" name="storage_path" value="/mnt/felhom-drives/felhom-flash">
|
|
<button type="submit" class="btn btn-xs btn-outline">Legyen alapértelmezett</button>
|
|
</form>
|
|
|
|
|
|
<form method="POST" action="/settings/storage/schedulable" style="display:inline">
|
|
<input type="hidden" name="_csrf" value="ee8f0976099202660a6865daf2fe0e15217659da12a012a5dfd9233ce4cb157c">
|
|
<input type="hidden" name="storage_path" value="/mnt/felhom-drives/felhom-flash">
|
|
<input type="hidden" name="schedulable" value="false">
|
|
<button type="submit" class="btn btn-xs btn-outline" title="A meghajtó kimarad az új alkalmazás-telepítésekből. A rajta lévő alkalmazások változatlanul futnak.">Új telepítések letiltása</button>
|
|
</form>
|
|
|
|
|
|
<button class="btn btn-xs btn-danger-outline" onclick="storageDisconnect('\/mnt\/felhom-drives\/felhom-flash', 'Tárhely (felhom-flash)', 0 )" title="Az itt tárolt alkalmazások leállnak, a meghajtó biztonságosan kihúzható. Az adatok megmaradnak; a meghajtó később újra csatlakoztatható.">Biztonságos leválasztás</button>
|
|
|
|
|
|
|
|
|
|
<button class="btn btn-xs btn-danger-outline" onclick="storageDecommission('\/mnt\/felhom-drives\/felhom-flash','Tárhely (felhom-flash)', 0 )" title="A meghajtó végleges kivonása a rendszerből. Ha céltárolót választ, előbb minden adat átkerül oda; áthelyezés nélkül az adatok a meghajtón maradnak.">Végleges leszerelés</button>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="storage-path-item">
|
|
<div class="storage-path-header">
|
|
<div class="storage-path-info">
|
|
<div class="storage-path-label-wrap" id="label-wrap-/mnt/felhom-drives/teszt_enroll">
|
|
<span class="storage-path-label" id="label-display-/mnt/felhom-drives/teszt_enroll">teszt_enroll</span>
|
|
<button class="btn btn-xs btn-ghost" onclick="editStorageLabel('\/mnt\/felhom-drives\/teszt_enroll', 'teszt_enroll')" title="Átnevezés"><svg class="ico ico-sm"><use href="#i-pencil"/></svg></button>
|
|
</div>
|
|
<span class="storage-path-path mono">/mnt/felhom-drives/teszt_enroll</span>
|
|
</div>
|
|
<div class="storage-path-badges">
|
|
|
|
|
|
<span class="tag tag-run"><span class="dot"></span>Aktív</span>
|
|
<span class="badge" style="background:rgba(255,165,0,0.15);color:var(--warn)">USB</span>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="storage-path-details">
|
|
|
|
<div class="storage-path-disk">
|
|
<div class="system-info-header">
|
|
<span class="system-info-value">0.0 GB / 58.2 GB</span>
|
|
</div>
|
|
<div class="meter nominal">
|
|
<div class="meter-track">
|
|
<div class="meter-fill" style="width:0%"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="storage-path-fsinfo mono form-hint">
|
|
ext4 · /dev/sdb[/felhom-data] · SD/MMC/MS PRO
|
|
</div>
|
|
|
|
|
|
<div class="storage-path-meta">
|
|
|
|
<span class="form-hint">Nincs alkalmazás ezen a tárolón</span>
|
|
|
|
</div>
|
|
<div class="drive-agent-extra" id="agent-extra-/mnt/felhom-drives/teszt_enroll"></div>
|
|
</div>
|
|
<div class="storage-path-actions">
|
|
|
|
<form method="POST" action="/settings/storage/default" style="display:inline">
|
|
<input type="hidden" name="_csrf" value="ee8f0976099202660a6865daf2fe0e15217659da12a012a5dfd9233ce4cb157c">
|
|
<input type="hidden" name="storage_path" value="/mnt/felhom-drives/teszt_enroll">
|
|
<button type="submit" class="btn btn-xs btn-outline">Legyen alapértelmezett</button>
|
|
</form>
|
|
|
|
|
|
<form method="POST" action="/settings/storage/schedulable" style="display:inline">
|
|
<input type="hidden" name="_csrf" value="ee8f0976099202660a6865daf2fe0e15217659da12a012a5dfd9233ce4cb157c">
|
|
<input type="hidden" name="storage_path" value="/mnt/felhom-drives/teszt_enroll">
|
|
<input type="hidden" name="schedulable" value="false">
|
|
<button type="submit" class="btn btn-xs btn-outline" title="A meghajtó kimarad az új alkalmazás-telepítésekből. A rajta lévő alkalmazások változatlanul futnak.">Új telepítések letiltása</button>
|
|
</form>
|
|
|
|
|
|
<button class="btn btn-xs btn-danger-outline" onclick="storageDisconnect('\/mnt\/felhom-drives\/teszt_enroll', 'teszt_enroll', 0 )" title="Az itt tárolt alkalmazások leállnak, a meghajtó biztonságosan kihúzható. Az adatok megmaradnak; a meghajtó később újra csatlakoztatható.">Biztonságos leválasztás</button>
|
|
|
|
|
|
|
|
|
|
<button class="btn btn-xs btn-danger-outline" onclick="storageDecommission('\/mnt\/felhom-drives\/teszt_enroll','teszt_enroll', 0 )" title="A meghajtó végleges kivonása a rendszerből. Ha céltárolót választ, előbb minden adat átkerül oda; áthelyezés nélkül az adatok a meghajtón maradnak.">Végleges leszerelés</button>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="migrate-progress" style="display:none;margin-top:1rem;padding:1rem;border:1px solid var(--blue);border-radius:6px;background:rgba(0,136,204,0.06)">
|
|
<strong>Adatok áthelyezése</strong>
|
|
<div id="migrate-progress-body" style="margin-top:.5rem">…</div>
|
|
</div>
|
|
<script>
|
|
|
|
function migFmtGB(b){ return (Number(b||0)/1e9).toFixed(1)+' GB'; }
|
|
function migRender(job){
|
|
var names={stop:'Alkalmazások leállítása',copy:'Adatok másolása',verify:'Ellenőrzés',flip:'Újratelepítés',redeploy:'Újratelepítés',cleanup:'Forrás törlése'};
|
|
var s=names[job.phase]||job.phase;
|
|
if(job.current_app) s+=': '+job.current_app;
|
|
if(job.phase==='copy'&&job.bytes_total>0){ s+=' ('+Math.floor(100*job.bytes_done/job.bytes_total)+'% — '+migFmtGB(job.bytes_done)+'/'+migFmtGB(job.bytes_total)+')'; }
|
|
return s+'…';
|
|
}
|
|
function migWatch(){
|
|
var panel=document.getElementById('migrate-progress');
|
|
var body=document.getElementById('migrate-progress-body');
|
|
if(panel) panel.style.display='block';
|
|
function tick(){
|
|
fetch('/api/storage/migrate/status').then(function(r){return r.json();}).then(function(d){
|
|
var job=d.data&&d.data.job;
|
|
if(!job){ if(body) body.textContent='Nincs folyamatban migráció.'; return; }
|
|
if(body) body.innerHTML=migRender(job);
|
|
if(job.phase==='done'){ if(body) body.innerHTML+='<br><strong>Kész</strong>'; setTimeout(function(){location.reload();},1500); return; }
|
|
if(job.phase==='aborted'){ if(body) body.innerHTML+='<br><strong style="color:var(--danger,#c0392b)">Megszakadt: '+(job.error||'')+'</strong><br>A forrás adatai érintetlenek.'; return; }
|
|
setTimeout(tick,1500);
|
|
}).catch(function(){ setTimeout(tick,2000); });
|
|
}
|
|
tick();
|
|
}
|
|
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; }
|
|
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); });
|
|
}});
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
(function(){ fetch('/api/storage/migrate/status').then(function(r){return r.json();}).then(function(d){ var job=d.data&&d.data.job; if(job && job.phase!=='done' && job.phase!=='aborted'){ migWatch(); } }).catch(function(){}); })();
|
|
</script>
|
|
|
|
<div style="margin-top:1rem;display:flex;gap:.75rem;flex-wrap:wrap">
|
|
<a href="/storage/init" class="btn btn-sm btn-outline"><svg class="ico ico-sm"><use href="#i-plus"/></svg> Új meghajtó inicializálása</a>
|
|
<a href="/storage/attach" class="btn btn-sm btn-outline"><svg class="ico ico-sm"><use href="#i-link"/></svg> Meglévő meghajtó csatolása</a>
|
|
</div>
|
|
|
|
<div id="agent-warn-note"></div>
|
|
|
|
<div style="margin-top:1.5rem" id="agent-unregistered-wrap" hidden>
|
|
<div class="section-h"><h3>Nem regisztrált meghajtók</h3><span class="hint">az ügynök által észlelt, még nem regisztrált adatmeghajtók</span></div>
|
|
<div id="agent-unregistered" class="drive-list"></div>
|
|
</div>
|
|
|
|
<div style="margin-top:1.5rem" id="agent-system-wrap" hidden>
|
|
<div class="section-h"><h3>Rendszermeghajtók</h3><span class="hint">védett — csak operátori aláírással módosíthatók</span></div>
|
|
<div id="agent-system" class="drive-list"></div>
|
|
</div>
|
|
<div id="confirm-root"></div>
|
|
<div id="dialog-root"></div>
|
|
<script>
|
|
window.__registeredPaths=["\/mnt\/felhom-drives\/felhom-usb","\/mnt\/felhom-drives\/felhom-flash","\/mnt\/felhom-drives\/teszt_enroll",];
|
|
(function(){
|
|
function esc(s){ return String(s==null?'':s).replace(/[&<>"]/g,function(c){return {'&':'&','<':'<','>':'>','"':'"'}[c];}); }
|
|
function hum(b){ if(!b||b<=0) return ''; var u=['B','KB','MB','GB','TB'],i=0,v=b; while(v>=1024&&i<u.length-1){v/=1024;i++;} return (v>=10||i===0?Math.round(v):v.toFixed(1))+' '+u[i]; }
|
|
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>';
|
|
function classTag(d){
|
|
if(d.class==='fast') return '<span class="tag">gyors</span>';
|
|
if(d.class==='slow') return '<span class="tag tag-off">lassú</span>';
|
|
return '';
|
|
}
|
|
function roleTag(role){
|
|
if(role==='system') return '<span class="tag">'+LOCK_ICO+'Rendszer — védett</span>';
|
|
if(role==='backup') return '<span class="tag">'+LOCK_ICO+'Biztonsági mentés — védett</span>';
|
|
if(role==='user-data') return '<span class="tag tag-run"><span class="dot"></span>Felhasználói adat</span>';
|
|
return '<span class="tag">'+LOCK_ICO+'Védett</span>';
|
|
}
|
|
function dataTag(d){ return d.data_bearing ? '<span class="tag tag-warn" title="'+esc(d.data_reason)+'">Adatot tartalmaz</span>' : ''; }
|
|
|
|
|
|
|
|
|
|
function regKey(d){ return d.guest_path || d.mount_path; }
|
|
function regTag(d, registered){
|
|
if(!d.mount_path) return '';
|
|
return registered[regKey(d)] ? '<span class="tag tag-run"><span class="dot"></span>Regisztrálva</span>' : '<span class="tag tag-off"><span class="dot"></span>Nem regisztrált</span>';
|
|
}
|
|
|
|
|
|
|
|
function appBackingTag(d){
|
|
if(d.type==='lvmthin') return '<span class="tag">Alkalmazás-rendszer</span>';
|
|
if(d.role==='user-data') return '<span class="tag">Alkalmazás-adatok</span>';
|
|
return '';
|
|
}
|
|
|
|
|
|
function purposeDesc(d){
|
|
if(d.type==='lvmthin') return 'Belső SSD — a szerver rendszere, a Docker és a telepített alkalmazások adatbázisai itt találhatók.';
|
|
if(d.type==='local'||d.type==='dir') return 'Host tárhely — rendszer-sablonok, ISO-k, host szintű mentések. Nem tárol alkalmazásadatot.';
|
|
if(d.type==='pbs'||d.role==='backup') return 'A biztonsági mentések tárhelye.';
|
|
if(d.role==='user-data') return 'Külső adattároló — a telepített alkalmazások nagy méretű fájljai (média, dokumentumok) ide kerülnek. Más meghajtók biztonsági mentési céljaként is szolgálhat.';
|
|
return '';
|
|
}
|
|
function capBar(d){
|
|
if(!d.total_bytes || d.total_bytes<=0) return '';
|
|
var pct = d.used_fraction ? d.used_fraction*100 : (d.used_bytes/d.total_bytes*100);
|
|
pct = Math.max(0, Math.min(100, pct));
|
|
return '<div class="drive-cap meter '+usageColorClass(pct)+'"><div class="meter-track"><div class="meter-fill" style="width:'+pct.toFixed(1)+'%"></div></div>'
|
|
+'<div class="drive-cap-label">'+hum(d.used_bytes)+' / '+hum(d.total_bytes)+' ('+pct.toFixed(0)+'%)</div></div>';
|
|
}
|
|
function actions(d, registered, hasSafeDisconnect){
|
|
|
|
if(d.role!=='user-data' || !d.mount_path || d.mount_path.indexOf('/mnt/')!==0) return '';
|
|
var dev = esc(d.backing_device||''), mpRaw = esc(d.mount_path), reg = esc(regKey(d));
|
|
var btns = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!registered[regKey(d)]){
|
|
btns += '<button class="btn btn-xs btn-primary" onclick="registerDrive(\''+mpRaw+'\')">Regisztrálás</button> ';
|
|
}
|
|
|
|
|
|
if(!hasSafeDisconnect){
|
|
btns += '<button class="btn btn-xs btn-danger-outline" onclick="confirmEject(\''+reg+'\')" title="A meghajtó lecsatolása és törlése a nyilvántartásból. Az adatok megmaradnak.">Leválasztás</button>';
|
|
}
|
|
if(d.backing_device){ btns += (btns?' ':'') + '<button class="btn btn-xs btn-danger-outline" onclick="confirmWipe(\''+dev+'\',\''+reg+'\')" title="A meghajtó formázása — a rajta lévő MINDEN adat véglegesen törlődik.">Formázás…</button>'; }
|
|
return btns ? '<div class="drive-actions">'+btns+'</div>' : '';
|
|
}
|
|
|
|
|
|
|
|
function driveRow(d, registered, withActions){
|
|
var sub = esc(d.type)+' · '+esc(d.backing_device||'—')+(d.mount_path?' · '+esc(regKey(d)):'');
|
|
var badges = roleTag(d.role)+appBackingTag(d)+classTag(d)+dataTag(d);
|
|
if(withActions) badges += regTag(d, registered);
|
|
var purpose = purposeDesc(d);
|
|
return '<div class="drive-card role-'+esc(d.role||'system')+'">'
|
|
+'<div class="drive-card-top"><div class="drive-id"><span class="drive-name">'+esc(d.name)+'</span><span class="drive-sub">'+sub+'</span></div>'
|
|
+'<div class="drive-badges">'+badges+'</div></div>'
|
|
+(purpose?'<div class="drive-purpose">'+esc(purpose)+'</div>':'')
|
|
+(d.durable_id?'<div class="drive-sub mono">'+esc(d.durable_id)+'</div>':'')
|
|
+capBar(d)
|
|
+(withActions?actions(d,registered):'')
|
|
+'</div>';
|
|
}
|
|
function enrichCard(d, registered){
|
|
var slot=document.getElementById('agent-extra-'+regKey(d));
|
|
if(!slot) return false;
|
|
var card=slot.closest('.storage-path-item');
|
|
var hasSafeDisconnect=!!(card && card.querySelector('[onclick^="storageDisconnect"]'));
|
|
var extra='<div class="metarows">'
|
|
+'<span class="metarow">'+roleTag(d.role)+'</span>'
|
|
+(d.class?'<span class="metarow">'+classTag(d)+'</span>':'')
|
|
+(d.durable_id?'<span class="metarow mono" title="Tartós azonosító">'+esc(d.durable_id)+'</span>':'')
|
|
+'</div>'
|
|
+actions(d,registered,hasSafeDisconnect);
|
|
slot.innerHTML=extra;
|
|
return true;
|
|
}
|
|
async function load(){
|
|
var warn=document.getElementById('agent-warn-note');
|
|
try{
|
|
var r=await fetch('/api/disks'); var j=await r.json();
|
|
if(!j.ok) throw new Error(j.error||'Nem elérhető');
|
|
var disks=(j.data&&j.data.disks)||[];
|
|
var registered={}; (window.__registeredPaths||[]).forEach(function(p){registered[p]=true;});
|
|
var sysHtml='', unregHtml='';
|
|
disks.forEach(function(d){
|
|
if(d.role==='user-data'){
|
|
if(registered[regKey(d)] && enrichCard(d, registered)) return;
|
|
unregHtml+=driveRow(d, registered, true);
|
|
}else{
|
|
sysHtml+=driveRow(d, registered, false);
|
|
}
|
|
});
|
|
var sysWrap=document.getElementById('agent-system-wrap');
|
|
var unregWrap=document.getElementById('agent-unregistered-wrap');
|
|
if(sysHtml){ document.getElementById('agent-system').innerHTML=sysHtml; sysWrap.hidden=false; }
|
|
if(unregHtml){ document.getElementById('agent-unregistered').innerHTML=unregHtml; unregWrap.hidden=false; }
|
|
}catch(e){
|
|
if(warn) warn.innerHTML='<div class="alert alert-warning" style="margin-top:1rem">Az ügynök nem elérhető — élő meghajtóadatok nélkül.</div>';
|
|
}
|
|
}
|
|
|
|
|
|
function closeModal(){ document.getElementById('confirm-root').innerHTML=''; }
|
|
window.__closeConfirm=closeModal;
|
|
async function openConfirm(opts){
|
|
|
|
var apps=[], copies=[];
|
|
try{
|
|
var r=await fetch('/api/storage/impact?where='+encodeURIComponent(opts.mount));
|
|
var j=await r.json(); if(j.ok && j.data){ apps=j.data.apps||[]; copies=j.data.backup_copies||[]; }
|
|
}catch(e){}
|
|
var appsHtml = apps.length
|
|
? '<p>A művelet után a következő alkalmazások <strong>nem fognak működni</strong>:</p><ul class="confirm-apps">'+apps.map(function(a){return '<li>'+esc(a)+'</li>';}).join('')+'</ul>'
|
|
: '<p class="form-hint">Ehhez a meghajtóhoz jelenleg nincs telepített alkalmazás rendelve.</p>';
|
|
|
|
var copiesHtml = copies.length
|
|
? '<div class="alert alert-warning" style="margin-top:.5rem">Ez a meghajtó más alkalmazások <strong>biztonsági másolatait</strong> is tárolja — a törlés ezeket is eltávolítja:<ul class="confirm-apps">'+copies.map(function(a){return '<li>'+esc(a)+'</li>';}).join('')+'</ul><span class="form-hint">(A másolatok redundánsak — az eredetik a forrás-meghajtón maradnak.)</span></div>'
|
|
: '';
|
|
var root=document.getElementById('confirm-root');
|
|
root.innerHTML='<div class="confirm-overlay" onclick="if(event.target===this)__closeConfirm()"><div class="confirm-box">'
|
|
+'<h3>'+esc(opts.title)+'</h3>'
|
|
+'<div class="alert alert-warning">'+esc(opts.danger)+'</div>'
|
|
+appsHtml
|
|
+copiesHtml
|
|
+'<div class="confirm-input"><label>Megerősítéshez írja be a csatlakoztatási nevet: <strong class="mono">'+esc(opts.mountName)+'</strong></label>'
|
|
+'<input type="text" id="confirm-type" class="form-control" autocomplete="off" placeholder="'+esc(opts.mountName)+'" oninput="document.getElementById(\'confirm-go\').disabled=(this.value!==\''+esc(opts.mountName)+'\')"></div>'
|
|
+'<div class="form-actions"><button id="confirm-go" class="btn btn-danger-outline" disabled>Megerősítés</button>'
|
|
+'<button class="btn btn-outline" onclick="__closeConfirm()">Mégsem</button></div>'
|
|
+'<div id="confirm-result" style="margin-top:.6rem"></div></div></div>';
|
|
document.getElementById('confirm-go').onclick=opts.onConfirm;
|
|
}
|
|
|
|
|
|
|
|
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; }
|
|
location.reload();
|
|
}catch(e){ alert('Hiba: '+e.message); }
|
|
};
|
|
window.confirmEject=function(where){
|
|
|
|
|
|
var name=where.split('/').filter(Boolean).pop()||where;
|
|
openConfirm({title:'Meghajtó leválasztása', mount:where, mountName:name,
|
|
danger:'A meghajtó leválasztásra kerül. Az adatok megmaradnak, de az ott tárolt alkalmazások elvesztik a tárhelyüket, amíg újra nem csatolja.',
|
|
onConfirm:async function(){
|
|
var out=document.getElementById('confirm-result'); out.innerHTML='<p class="form-hint">Leválasztás folyamatban…</p>';
|
|
try{
|
|
var r=await fetch('/api/storage/eject',{method:'POST',headers:Object.assign({'Content-Type':'application/json'},csrfHeaders()),body:JSON.stringify({where:where})});
|
|
var j=await r.json(); if(!j.ok){ out.innerHTML='<div class="alert alert-error">Hiba: '+esc(j.error||'')+'</div>'; return; }
|
|
location.reload();
|
|
}catch(e){ out.innerHTML='<div class="alert alert-error">Hiba: '+esc(e.message)+'</div>'; }
|
|
}});
|
|
};
|
|
window.confirmWipe=function(device, where){
|
|
|
|
var name=where.split('/').filter(Boolean).pop()||where;
|
|
openConfirm({title:'Meghajtó törlése (formázás)', mount:where, mountName:name,
|
|
danger:'FIGYELEM: a meghajtón lévő ÖSSZES ADAT véglegesen törlődik (formázás). Ez nem vonható vissza.',
|
|
onConfirm:async function(){
|
|
var out=document.getElementById('confirm-result'); out.innerHTML='<p class="form-hint">Törlés folyamatban…</p>';
|
|
try{
|
|
var r=await fetch('/api/storage/wipe',{method:'POST',headers:Object.assign({'Content-Type':'application/json'},csrfHeaders()),body:JSON.stringify({device:device, where:where, mount_name:name})});
|
|
var j=await r.json(); if(!j.ok){ out.innerHTML='<div class="alert alert-error">Hiba: '+esc(j.error||'')+'</div>'; return; }
|
|
location.reload();
|
|
}catch(e){ out.innerHTML='<div class="alert alert-error">Hiba: '+esc(e.message)+'</div>'; }
|
|
}});
|
|
};
|
|
load();
|
|
})();
|
|
</script>
|
|
|
|
<details class="storage-add-details">
|
|
<summary class="btn btn-sm btn-outline" style="margin-top:.75rem;cursor:pointer">Már csatlakoztatott tárhely hozzáadása kézzel</summary>
|
|
<form method="POST" action="/settings/storage/add" class="storage-add-form">
|
|
<input type="hidden" name="_csrf" value="ee8f0976099202660a6865daf2fe0e15217659da12a012a5dfd9233ce4cb157c">
|
|
<div class="form-group">
|
|
<label for="storage_path">Elérési út</label>
|
|
<input type="text" id="storage_path" name="storage_path" class="form-control"
|
|
placeholder="/mnt/hdd_1" required>
|
|
<span class="form-hint">Pl. /mnt/hdd_1 — a meghajtónak már csatolva kell lennie</span>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="storage_label">Megnevezés (opcionális)</label>
|
|
<input type="text" id="storage_label" name="storage_label" class="form-control"
|
|
placeholder="Külső HDD 1TB">
|
|
</div>
|
|
<label class="toggle" style="margin-bottom:1rem">
|
|
<input type="checkbox" name="storage_default" value="true">
|
|
<span class="toggle-label">Legyen alapértelmezett új telepítéseknél</span>
|
|
</label>
|
|
<button type="submit" class="btn btn-primary">Hozzáadás</button>
|
|
</form>
|
|
</details>
|
|
</div>
|
|
|
|
<script>
|
|
|
|
|
|
|
|
function escText(s){var d=document.createElement('div');d.textContent=String(s==null?'':s);return d.innerHTML;}
|
|
function closeDialog(){ var r=document.getElementById('dialog-root'); if(r) r.innerHTML=''; }
|
|
function openDialog(opts){
|
|
var root=document.getElementById('dialog-root');
|
|
if(!root) return;
|
|
var typeGate=opts.typeToConfirm||'';
|
|
var html='<div class="confirm-overlay" onclick="if(event.target===this)document.getElementById(\'dialog-cancel\').click()"><div class="confirm-box">'
|
|
+'<h3>'+escText(opts.title||'Megerősítés')+'</h3>'
|
|
+'<p style="white-space:pre-line">'+escText(opts.message||'')+'</p>';
|
|
if(typeGate){
|
|
html+='<div class="confirm-input"><label>Megerősítéshez írja be: <strong class="mono">'+escText(typeGate)+'</strong></label>'
|
|
+'<input type="text" id="dialog-type" class="form-control" autocomplete="off" placeholder="'+escText(typeGate)+'"></div>';
|
|
}
|
|
html+='<div class="form-actions"><button id="dialog-go" class="btn '+(typeGate?'btn-danger-outline':'btn-primary')+'"'+(typeGate?' disabled':'')+'>'+escText(opts.confirmLabel||'Megerősítés')+'</button>'
|
|
+'<button type="button" class="btn btn-outline" id="dialog-cancel">Mégsem</button></div>'
|
|
+'</div></div>';
|
|
root.innerHTML=html;
|
|
var go=document.getElementById('dialog-go');
|
|
if(typeGate){
|
|
document.getElementById('dialog-type').oninput=function(){ go.disabled=(this.value.trim()!==typeGate); };
|
|
}
|
|
go.onclick=function(){ closeDialog(); if(opts.onConfirm) opts.onConfirm(); };
|
|
document.getElementById('dialog-cancel').onclick=function(){ closeDialog(); if(opts.onCancel) opts.onCancel(); };
|
|
}
|
|
|
|
function storageRemoveDialog(ev, form, msg){
|
|
ev.preventDefault();
|
|
openDialog({title:'Meghajtó eltávolítása', message:msg, confirmLabel:'Eltávolítás', onConfirm:function(){ form.submit(); }});
|
|
return false;
|
|
}
|
|
|
|
function editStorageLabel(path, currentLabel) {
|
|
var wrap = document.getElementById('label-wrap-' + path);
|
|
if (!wrap) return;
|
|
var csrfTok = (document.querySelector('meta[name="csrf-token"]') || {}).content || '';
|
|
wrap.innerHTML = '<form method="POST" action="/settings/storage/label" style="display:inline-flex;gap:.5rem;align-items:center">' +
|
|
'<input type="hidden" name="_csrf" value="' + csrfTok + '">' +
|
|
'<input type="hidden" name="storage_path" value="' + path + '">' +
|
|
'<input type="text" name="storage_label" class="form-control" value="' + currentLabel.replace(/"/g, '"') + '" style="width:200px;padding:.3rem .5rem;font-size:.9rem" maxlength="50">' +
|
|
'<button type="submit" class="btn btn-xs btn-primary">OK</button>' +
|
|
'<button type="button" class="btn btn-xs btn-outline" onclick="cancelEditLabel(\'' + path + '\', \'' + currentLabel.replace(/'/g, "\\'") + '\')">×</button>' +
|
|
'</form>';
|
|
wrap.querySelector('input[name=storage_label]').focus();
|
|
}
|
|
function storageDisconnect(path, label, appCount) {
|
|
var msg = 'Biztos leválasztja a meghajtót: ' + label + '?';
|
|
if (appCount > 0) msg += '\n\nA rajta futó ' + appCount + ' alkalmazás le fog állni.';
|
|
msg += '\n\nA meghajtó ezután biztonságosan eltávolítható.';
|
|
openDialog({title:'Meghajtó leválasztása', message:msg, confirmLabel:'Leválasztás', onConfirm:function(){ doStorageDisconnect(path); }});
|
|
}
|
|
function doStorageDisconnect(path) {
|
|
fetch('/api/storage/disconnect', {
|
|
method: 'POST',
|
|
headers: Object.assign({'Content-Type': 'application/json'}, csrfHeaders()),
|
|
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ó.');
|
|
location.reload();
|
|
} else {
|
|
alert('Hiba: ' + (data.error || 'ismeretlen'));
|
|
}
|
|
}).catch(function(e) { alert('Hiba: ' + e); });
|
|
}
|
|
function storageReconnect(path) {
|
|
var actionsDiv = document.getElementById('storage-actions-' + path);
|
|
if (actionsDiv) actionsDiv.innerHTML = '<span class="form-hint">Csatlakoztatás...</span>';
|
|
fetch('/api/storage/reconnect', {
|
|
method: 'POST',
|
|
headers: Object.assign({'Content-Type': 'application/json'}, csrfHeaders()),
|
|
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'));
|
|
if (actionsDiv) actionsDiv.innerHTML = '<button class="btn btn-xs btn-primary" onclick="storageReconnect(\'' + path + '\')">Csatlakoztatás</button>';
|
|
}
|
|
}).catch(function(e) {
|
|
alert('Hiba: ' + e);
|
|
if (actionsDiv) actionsDiv.innerHTML = '<button class="btn btn-xs btn-primary" onclick="storageReconnect(\'' + path + '\')">Csatlakoztatás</button>';
|
|
});
|
|
}
|
|
function storageRestartApps(path) {
|
|
fetch('/api/storage/restart-apps', {
|
|
method: 'POST',
|
|
headers: Object.assign({'Content-Type': 'application/json'}, csrfHeaders()),
|
|
body: JSON.stringify({where: 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(', '));
|
|
location.reload();
|
|
} else {
|
|
alert('Hiba: ' + (data.error || 'ismeretlen'));
|
|
}
|
|
}).catch(function(e) { alert('Hiba: ' + e); });
|
|
}
|
|
|
|
|
|
function storageDecommission(path, label, appCount) {
|
|
var sel = document.getElementById('migrate-target-' + path);
|
|
var target = sel ? sel.value : '';
|
|
if (target) {
|
|
openDialog({title:'Leszerelés áthelyezéssel', confirmLabel:'Leszerelés',
|
|
message:'Leszerelés áthelyezéssel: minden adat átmásolása ide: ' + target + ', majd a(z) ' + label + ' leszerelése?\n\nAz adatok NEM törlődnek.',
|
|
onConfirm:function(){ doStorageDecommission({where: path, mode: 'migrate', target: target}); }});
|
|
} else {
|
|
var name = path.split('/').pop();
|
|
openDialog({title:'Meghajtó leszerelése', confirmLabel:'Leszerelés', typeToConfirm:name,
|
|
message:'A(z) ' + label + ' leszereléséhez (áthelyezés nélkül) írja be a meghajtó nevét megerősítésként.' +
|
|
(appCount > 0 ? '\n\nFIGYELEM: ' + appCount + ' alkalmazás leáll (az adatok megmaradnak).' : ''),
|
|
onConfirm:function(){ doStorageDecommission({where: path, mode: 'anyway', mount_name: name}); }});
|
|
}
|
|
}
|
|
function doStorageDecommission(body) {
|
|
fetch('/api/storage/decommission', {
|
|
method: 'POST',
|
|
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); });
|
|
}
|
|
|
|
|
|
function storageReEnroll(path, label) {
|
|
openDialog({title:'Visszacsatlakoztatás', confirmLabel:'Visszacsatlakoztatás',
|
|
message:'Visszacsatlakoztatja a(z) ' + label + ' meghajtót?\n\nAz adatok érintetlenek; a leállított alkalmazások újraindulnak.',
|
|
onConfirm:function(){ doStorageReEnroll(path); }});
|
|
}
|
|
function doStorageReEnroll(path) {
|
|
fetch('/api/storage/reconnect', {
|
|
method: 'POST',
|
|
headers: Object.assign({'Content-Type': 'application/json'}, csrfHeaders()),
|
|
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); });
|
|
}
|
|
function cancelEditLabel(path, label) {
|
|
var wrap = document.getElementById('label-wrap-' + path);
|
|
if (!wrap) return;
|
|
|
|
wrap.innerHTML = '';
|
|
var span = document.createElement('span');
|
|
span.className = 'storage-path-label';
|
|
span.id = 'label-display-' + path;
|
|
span.textContent = label;
|
|
var btn = document.createElement('button');
|
|
btn.className = 'btn btn-xs btn-ghost';
|
|
btn.setAttribute('title', 'Átnevezés');
|
|
btn.innerHTML = '<svg class="ico ico-sm"><use href="#i-pencil"/></svg>';
|
|
btn.addEventListener('click', function() { editStorageLabel(path, label); });
|
|
wrap.appendChild(span);
|
|
wrap.appendChild(document.createTextNode(' '));
|
|
wrap.appendChild(btn);
|
|
}
|
|
</script>
|
|
|
|
</main>
|
|
<script>
|
|
document.addEventListener('click', function(e) {
|
|
if (e.target.closest('a, button, .btn, input, select, textarea, .stack-actions, .stack-detail-actions')) return;
|
|
var card = e.target.closest('[data-href]');
|
|
if (card) window.location.href = card.dataset.href;
|
|
});
|
|
async function checkBeforeDeploy(e, name) {
|
|
try {
|
|
var resp = await fetch('/api/stacks/' + name);
|
|
var data = await resp.json();
|
|
if (data.ok && data.data && data.data.deployed) {
|
|
e.preventDefault();
|
|
showAlert('Ez az alkalmazás már telepítve van.');
|
|
window.location.reload();
|
|
return false;
|
|
}
|
|
} catch(err) {}
|
|
return true;
|
|
}
|
|
async function syncTemplates() {
|
|
const btn = document.getElementById('sync-btn');
|
|
const toast = document.getElementById('sync-toast');
|
|
if (!btn) return;
|
|
const origText = btn.innerHTML;
|
|
btn.disabled = true;
|
|
btn.innerHTML = '↻ Frissítés...';
|
|
btn.classList.add('loading');
|
|
try {
|
|
const resp = await fetch('/api/sync', {
|
|
method: 'POST',
|
|
headers: Object.assign({'Content-Type': 'application/json'}, csrfHeaders())
|
|
});
|
|
const data = await resp.json();
|
|
if (toast) {
|
|
toast.textContent = data.ok ? (data.message || 'Sablonok frissítve') : ('Hiba: ' + (data.error || 'Ismeretlen hiba'));
|
|
toast.className = 'sync-toast ' + (data.ok ? 'sync-toast-ok' : 'sync-toast-err');
|
|
toast.style.display = 'block';
|
|
setTimeout(function() { toast.style.display = 'none'; }, 5000);
|
|
}
|
|
if (data.ok && data.data && (data.data.new_apps && data.data.new_apps.length > 0 || data.data.updated && data.data.updated.length > 0)) {
|
|
setTimeout(function() { window.location.reload(); }, 1500);
|
|
}
|
|
} catch (err) {
|
|
if (toast) {
|
|
toast.textContent = 'Hálózati hiba: ' + err.message;
|
|
toast.className = 'sync-toast sync-toast-err';
|
|
toast.style.display = 'block';
|
|
setTimeout(function() { toast.style.display = 'none'; }, 5000);
|
|
}
|
|
}
|
|
btn.innerHTML = origText;
|
|
btn.disabled = false;
|
|
btn.classList.remove('loading');
|
|
}
|
|
async function stackAction(event, name, action) {
|
|
const btn = event.currentTarget;
|
|
const origText = btn.textContent;
|
|
btn.disabled = true;
|
|
btn.textContent = 'Folyamatban...';
|
|
btn.classList.add('loading');
|
|
try {
|
|
const resp = await fetch('/api/stacks/' + name + '/' + action, {
|
|
method: 'POST',
|
|
headers: Object.assign({'Content-Type': 'application/json'}, csrfHeaders())
|
|
});
|
|
const data = await resp.json();
|
|
if (!data.ok) {
|
|
showAlert('Hiba: ' + (data.error || 'Ismeretlen hiba'));
|
|
btn.textContent = origText;
|
|
btn.disabled = false;
|
|
btn.classList.remove('loading');
|
|
return;
|
|
}
|
|
window.location.reload();
|
|
} catch (err) {
|
|
showAlert('Hálózati hiba: ' + err.message);
|
|
btn.textContent = origText;
|
|
btn.disabled = false;
|
|
btn.classList.remove('loading');
|
|
}
|
|
}
|
|
async function deleteOrphanStack(name) {
|
|
var modal = document.createElement('div');
|
|
modal.className = 'modal-overlay';
|
|
modal.id = 'delete-modal';
|
|
modal.innerHTML = '<div class="modal-card"><h3>Betöltés...</h3></div>';
|
|
modal.addEventListener('click', function(e) { if (e.target === modal) closeDeleteModal(); });
|
|
document.body.appendChild(modal);
|
|
try {
|
|
var resp = await fetch('/api/stacks/' + name + '/hdd-data');
|
|
var data = await resp.json();
|
|
var hddInfo = '';
|
|
var checkboxHTML = '';
|
|
if (data.ok && data.data && data.data.has_hdd_data) {
|
|
hddInfo = '<div class="modal-hdd-info"><strong>Felhasználói adatok a merevlemezen:</strong>';
|
|
data.data.hdd_paths.forEach(function(p) {
|
|
hddInfo += '<div class="modal-hdd-path">' + p.path + ' (' + (p.exists ? p.size_human : 'nem létezik') + ')</div>';
|
|
});
|
|
hddInfo += '</div>';
|
|
checkboxHTML = '<label class="modal-checkbox"><input type="checkbox" id="delete-hdd-check"> Felhasználói adatok törlése a merevlemezről</label>';
|
|
}
|
|
modal.querySelector('.modal-card').innerHTML =
|
|
'<h3>Alkalmazás törlése: ' + name + '</h3>' +
|
|
'<p style="color:var(--text-2);font-size:.9rem;margin-bottom:.75rem">Ez a művelet eltávolítja a konténereket, a köteteket és a konfigurációs fájlokat.</p>' +
|
|
'<div class="alert alert-warning" style="margin-bottom:.75rem">Ez a művelet nem visszavonható!</div>' +
|
|
hddInfo + checkboxHTML +
|
|
'<div class="modal-actions">' +
|
|
'<button class="btn btn-outline" onclick="closeDeleteModal()">Mégsem</button>' +
|
|
'<button class="btn btn-danger" id="confirm-delete-btn" onclick="confirmDelete(\'' + name + '\')">Törlés</button>' +
|
|
'</div>';
|
|
} catch (err) {
|
|
modal.querySelector('.modal-card').innerHTML =
|
|
'<h3>Hiba</h3><p style="color:var(--text-2)">Nem sikerült lekérni az adatokat: ' + err.message + '</p>' +
|
|
'<div class="modal-actions"><button class="btn btn-outline" onclick="closeDeleteModal()">Bezárás</button></div>';
|
|
}
|
|
}
|
|
function closeDeleteModal() {
|
|
var modal = document.getElementById('delete-modal');
|
|
if (modal) modal.remove();
|
|
}
|
|
async function confirmDelete(name) {
|
|
var btn = document.getElementById('confirm-delete-btn');
|
|
var checkbox = document.getElementById('delete-hdd-check');
|
|
var removeHDD = checkbox ? checkbox.checked : false;
|
|
btn.disabled = true;
|
|
btn.textContent = 'Törlés folyamatban...';
|
|
try {
|
|
var resp = await fetch('/api/stacks/' + name, {
|
|
method: 'DELETE',
|
|
headers: Object.assign({'Content-Type': 'application/json'}, csrfHeaders()),
|
|
body: JSON.stringify({remove_hdd_data: removeHDD})
|
|
});
|
|
var data = await resp.json();
|
|
if (data.ok) {
|
|
var modal = document.getElementById('delete-modal');
|
|
var removedInfo = '';
|
|
if (data.data && data.data.hdd_paths_removed && data.data.hdd_paths_removed.length > 0) {
|
|
removedInfo = '<p style="color:var(--text-2);font-size:.85rem;margin-top:.5rem">Törölt adatok: ' + data.data.hdd_paths_removed.join(', ') + '</p>';
|
|
}
|
|
var preservedInfo = '';
|
|
if (data.data && data.data.hdd_paths_preserved && data.data.hdd_paths_preserved.length > 0) {
|
|
preservedInfo = '<p style="color:var(--text-2);font-size:.85rem;margin-top:.5rem">Megőrzött adatok: ' + data.data.hdd_paths_preserved.join(', ') + '</p>';
|
|
}
|
|
modal.querySelector('.modal-card').innerHTML =
|
|
'<h3>Sikeresen törölve!</h3>' +
|
|
'<p style="color:var(--text-2)">Az alkalmazás (' + name + ') törölve lett.</p>' +
|
|
removedInfo + preservedInfo +
|
|
'<div class="modal-actions"><button class="btn btn-primary" onclick="window.location.href=\'/stacks\'">Bezárás</button></div>';
|
|
} else {
|
|
showAlert('Hiba: ' + (data.error || 'Ismeretlen hiba'));
|
|
btn.disabled = false;
|
|
btn.textContent = 'Törlés';
|
|
}
|
|
} catch (err) {
|
|
showAlert('Hálózati hiba: ' + err.message);
|
|
btn.disabled = false;
|
|
btn.textContent = 'Törlés';
|
|
}
|
|
}
|
|
async function removeStack(name) {
|
|
var modal = document.createElement('div');
|
|
modal.className = 'modal-overlay';
|
|
modal.id = 'remove-modal';
|
|
modal.innerHTML = '<div class="modal-card"><h3>Betöltés...</h3></div>';
|
|
modal.addEventListener('click', function(e) { if (e.target === modal) closeRemoveModal(); });
|
|
document.body.appendChild(modal);
|
|
try {
|
|
var [hddResp, backupResp] = await Promise.all([
|
|
fetch('/api/stacks/' + name + '/hdd-data').then(function(r) { return r.json(); }),
|
|
fetch('/api/stacks/' + name + '/backup-data').then(function(r) { return r.json(); })
|
|
]);
|
|
var sections = '';
|
|
|
|
sections += '<div class="modal-section">' +
|
|
'<strong>Mindig törlődik:</strong>' +
|
|
'<ul style="margin:.25rem 0;padding-left:1.2rem;color:var(--text-2);font-size:.85rem">' +
|
|
'<li>Docker kötetek (adatbázis, alkalmazás konfiguráció)</li>' +
|
|
'<li>Telepítési konfiguráció (app.yaml)</li>' +
|
|
'<li>Másodlagos mentés ütemezése</li>' +
|
|
'</ul></div>';
|
|
|
|
var hddCheckbox = '';
|
|
if (hddResp.ok && hddResp.data && hddResp.data.has_hdd_data) {
|
|
var hddPaths = '';
|
|
hddResp.data.hdd_paths.forEach(function(p) {
|
|
hddPaths += '<div class="modal-hdd-path">' + p.path + ' (' + (p.exists ? p.size_human : 'nem létezik') + ')</div>';
|
|
});
|
|
sections += '<div class="modal-section">' +
|
|
'<strong>Felhasználói adatok a merevlemezen:</strong>' + hddPaths +
|
|
'<label class="modal-checkbox"><input type="checkbox" id="remove-hdd-check"> Felhasználói adatok törlése</label>' +
|
|
'<div class="alert alert-info" style="margin-top:.5rem;font-size:.8rem" id="remove-hdd-keep-warning">' +
|
|
'Ha újratelepíti az alkalmazást, az adatokat újra importálnia kell, mivel az adatbázis törlődik. A megtartott adatok a továbbiakban NEM lesznek automatikusan mentve.' +
|
|
'</div></div>';
|
|
hddCheckbox = '\x3Cscript>document.getElementById("remove-hdd-check").addEventListener("change",function(){document.getElementById("remove-hdd-keep-warning").style.display=this.checked?"none":"";});<\/script>';
|
|
}
|
|
|
|
var backupCheckbox = '';
|
|
if (backupResp.ok && backupResp.data && backupResp.data.has_backups) {
|
|
var bkPaths = '';
|
|
backupResp.data.backup_paths.forEach(function(p) {
|
|
if (p.exists) bkPaths += '<div class="modal-hdd-path">' + p.path + ' (' + p.size_human + ')</div>';
|
|
});
|
|
if (bkPaths) {
|
|
sections += '<div class="modal-section">' +
|
|
'<strong>Mentési adatok:</strong>' + bkPaths +
|
|
'<label class="modal-checkbox"><input type="checkbox" id="remove-backup-check"> Mentési adatok törlése</label>' +
|
|
'<div class="alert alert-info" style="margin-top:.5rem;font-size:.8rem">' +
|
|
'Az éjszakai restic pillanatképek nem törölhetők egyenként — a megőrzési szabályok szerint automatikusan elavulnak.' +
|
|
'</div></div>';
|
|
}
|
|
}
|
|
modal.querySelector('.modal-card').innerHTML =
|
|
'<h3>Alkalmazás eltávolítása: ' + name + '</h3>' +
|
|
'<p style="color:var(--text-2);font-size:.9rem;margin-bottom:.75rem">Az alkalmazás visszaáll "Nincs telepítve" állapotba. A sablon megmarad, újratelepíthető.</p>' +
|
|
'<div class="alert alert-warning" style="margin-bottom:.75rem">Ez a művelet nem visszavonható!</div>' +
|
|
sections +
|
|
'<div class="modal-actions">' +
|
|
'<button class="btn btn-outline" onclick="closeRemoveModal()">Mégsem</button>' +
|
|
'<button class="btn btn-danger" id="confirm-remove-btn" onclick="confirmRemoveStack(\'' + name + '\')">Eltávolítás</button>' +
|
|
'</div>' + hddCheckbox;
|
|
} catch (err) {
|
|
modal.querySelector('.modal-card').innerHTML =
|
|
'<h3>Hiba</h3><p style="color:var(--text-2)">Nem sikerült lekérni az adatokat: ' + err.message + '</p>' +
|
|
'<div class="modal-actions"><button class="btn btn-outline" onclick="closeRemoveModal()">Bezárás</button></div>';
|
|
}
|
|
}
|
|
function closeRemoveModal() {
|
|
var modal = document.getElementById('remove-modal');
|
|
if (modal) modal.remove();
|
|
}
|
|
async function confirmRemoveStack(name) {
|
|
var btn = document.getElementById('confirm-remove-btn');
|
|
var hddCheck = document.getElementById('remove-hdd-check');
|
|
var backupCheck = document.getElementById('remove-backup-check');
|
|
var removeHDD = hddCheck ? hddCheck.checked : false;
|
|
var removeBackups = backupCheck ? backupCheck.checked : false;
|
|
btn.disabled = true;
|
|
btn.textContent = 'Eltávolítás folyamatban...';
|
|
try {
|
|
var resp = await fetch('/api/stacks/' + name + '/remove', {
|
|
method: 'POST',
|
|
headers: Object.assign({'Content-Type': 'application/json'}, csrfHeaders()),
|
|
body: JSON.stringify({remove_hdd_data: removeHDD, remove_backups: removeBackups})
|
|
});
|
|
var data = await resp.json();
|
|
if (data.ok) {
|
|
var modal = document.getElementById('remove-modal');
|
|
var removedInfo = '';
|
|
if (data.data && data.data.hdd_paths_removed && data.data.hdd_paths_removed.length > 0) {
|
|
removedInfo += '<p style="color:var(--text-2);font-size:.85rem;margin-top:.5rem">Törölt adatok: ' + data.data.hdd_paths_removed.join(', ') + '</p>';
|
|
}
|
|
if (data.data && data.data.backup_paths_removed && data.data.backup_paths_removed.length > 0) {
|
|
removedInfo += '<p style="color:var(--text-2);font-size:.85rem;margin-top:.5rem">Törölt mentések: ' + data.data.backup_paths_removed.join(', ') + '</p>';
|
|
}
|
|
var preservedInfo = '';
|
|
if (data.data && data.data.hdd_paths_preserved && data.data.hdd_paths_preserved.length > 0) {
|
|
preservedInfo = '<p style="color:var(--text-2);font-size:.85rem;margin-top:.5rem">Megőrzött adatok: ' + data.data.hdd_paths_preserved.join(', ') + '</p>';
|
|
}
|
|
modal.querySelector('.modal-card').innerHTML =
|
|
'<h3>Sikeresen eltávolítva!</h3>' +
|
|
'<p style="color:var(--text-2)">Az alkalmazás (' + name + ') eltávolítva. Újratelepíthető a Telepítés gombbal.</p>' +
|
|
removedInfo + preservedInfo +
|
|
'<div class="modal-actions"><button class="btn btn-primary" onclick="window.location.href=\'/stacks\'">Bezárás</button></div>';
|
|
} else {
|
|
showAlert('Hiba: ' + (data.error || 'Ismeretlen hiba'));
|
|
btn.disabled = false;
|
|
btn.textContent = 'Eltávolítás';
|
|
}
|
|
} catch (err) {
|
|
showAlert('Hálózati hiba: ' + err.message);
|
|
btn.disabled = false;
|
|
btn.textContent = 'Eltávolítás';
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |