f100cef842
- deploy.html: stacked memory bar -> meter track with two segments (committed solid blue, new app 35%-opacity blue), neutral threshold ticks; integration status badges -> tags; meta pills -> metarows; 3-step deploy progress icons -> sprite (check/x/triangle-alert/ spinning rotate-cw); emoji -> icons or plain text incl. the JS confirm string. - backups.html: storage bars -> meters, disconnected drives render an empty track with a neutral 'Leválasztva' (no red), drive-state badges -> warn tags, checkmark/warning glyphs -> sprite icons, JS flash/info strings de-emojified. - monitoring.html: bars -> meters in both template and JS-generated host-storage markup (usageColorClass now emits nominal/warn/crit); Chart.js palette per spec (cpu #2EA8F5, memory #8E7CE8, temp #E0A93E, load #5EC4B6 — categorical data series keep distinct hues); tooltip/ grid/tick colors moved to v2 literals; mem-dist palette rebalanced. - Templates repo-wide: legacy var(--*) names in inline styles and JS string literals renamed to v2 tokens (old names no longer resolve). - style.css: memory-bar family rewritten for the two-segment meter, .ico-spin animation added (reduced-motion respected).
224 lines
8.6 KiB
HTML
224 lines
8.6 KiB
HTML
{{define "app_export"}}
|
|
{{template "layout_start" .}}
|
|
|
|
<div class="page-header">
|
|
<div style="display:flex;align-items:center;gap:1rem">
|
|
<a href="/stacks" class="btn btn-sm btn-outline">← Alkalmazások</a>
|
|
<h2>{{.Stack.Meta.DisplayName}} — Exportálás</h2>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card" style="max-width:700px">
|
|
<h3>Mentés helye</h3>
|
|
<select id="destDrive" onchange="loadEstimate()" style="width:100%;padding:.5rem;margin-bottom:1rem">
|
|
<option value="">Válassz tárolót...</option>
|
|
{{range .Drives}}
|
|
<option value="{{.Path}}">{{if .Label}}{{.Label}} ({{.Path}}){{else}}{{.Path}}{{end}}</option>
|
|
{{end}}
|
|
</select>
|
|
|
|
<div id="estimateBox" style="display:none;background:var(--bg-2);border-radius:8px;padding:1rem;margin-bottom:1.5rem">
|
|
<div style="display:flex;justify-content:space-between;margin-bottom:.25rem">
|
|
<span>Konfiguráció:</span>
|
|
<span id="estConfig">-</span>
|
|
</div>
|
|
<div style="display:flex;justify-content:space-between;margin-bottom:.25rem">
|
|
<span>Felhasználói adatok:</span>
|
|
<span id="estData">-</span>
|
|
</div>
|
|
<div style="display:flex;justify-content:space-between;font-weight:600;margin-bottom:.25rem;border-top:1px solid var(--line);padding-top:.5rem">
|
|
<span>Összesen:</span>
|
|
<span><span id="estTotal">-</span> <span id="estFree" style="color:var(--text-3)">(szabad: -)</span></span>
|
|
</div>
|
|
<div style="display:flex;justify-content:space-between">
|
|
<span>Becsült idő:</span>
|
|
<span id="estTime">-</span>
|
|
</div>
|
|
<div id="estWarning" style="display:none;color:var(--crit);margin-top:.5rem;font-weight:600"></div>
|
|
</div>
|
|
|
|
<h3>Jelszó (opcionális)</h3>
|
|
<div style="display:flex;gap:.5rem;margin-bottom:1rem">
|
|
<input type="password" id="exportPassword" placeholder="Titkosítási jelszó" style="flex:1;padding:.5rem">
|
|
<button class="btn btn-sm btn-outline" onclick="togglePw()" type="button" title="Jelszó mutatása">👁</button>
|
|
</div>
|
|
|
|
<label style="display:flex;align-items:flex-start;gap:.5rem;margin-bottom:.5rem;cursor:pointer">
|
|
<input type="checkbox" id="stopApp" checked style="margin-top:3px">
|
|
<div>
|
|
<strong>Alkalmazás leállítása mentés előtt (ajánlott)</strong>
|
|
<div style="color:var(--text-3);font-size:.85rem">Az adatok konzisztenciája érdekében javasolt leállítani az alkalmazást mentés közben.</div>
|
|
</div>
|
|
</label>
|
|
|
|
<button id="startBtn" class="btn btn-primary" onclick="startExport()" style="margin-top:1rem;width:100%" disabled>
|
|
Exportálás indítása
|
|
</button>
|
|
</div>
|
|
|
|
<div id="progressCard" class="card" style="max-width:700px;display:none">
|
|
<h3>Folyamat</h3>
|
|
<div id="progressSteps"></div>
|
|
<div id="progressError" style="display:none;color:var(--crit);margin-top:1rem;font-weight:600"></div>
|
|
</div>
|
|
|
|
<div id="doneCard" class="card" style="max-width:700px;display:none">
|
|
<h3 style="color:var(--blue)">Kész!</h3>
|
|
<div style="margin-bottom:1rem">
|
|
<span id="doneFile" style="font-weight:600"></span>
|
|
<span id="doneSize" style="color:var(--text-3)"></span>
|
|
</div>
|
|
<a id="doneFBLink" href="#" target="_blank" class="btn btn-outline">Megnyitás FileBrowser-ben ↗</a>
|
|
</div>
|
|
|
|
<script>
|
|
var stackName = '{{.Stack.Name}}';
|
|
var domain = '{{.Stack.Meta.Subdomain}}' ? '{{.Stack.Meta.Subdomain}}.{{$.CSRFToken}}' : '';
|
|
var pollTimer = null;
|
|
|
|
function csrfH() {
|
|
var el = document.querySelector('meta[name="csrf-token"]');
|
|
return el ? {'X-CSRF-Token': el.content, 'Content-Type': 'application/json'} : {'Content-Type': 'application/json'};
|
|
}
|
|
|
|
function togglePw() {
|
|
var inp = document.getElementById('exportPassword');
|
|
inp.type = inp.type === 'password' ? 'text' : 'password';
|
|
}
|
|
|
|
async function loadEstimate() {
|
|
var drive = document.getElementById('destDrive').value;
|
|
var box = document.getElementById('estimateBox');
|
|
var btn = document.getElementById('startBtn');
|
|
|
|
if (!drive) {
|
|
box.style.display = 'none';
|
|
btn.disabled = true;
|
|
return;
|
|
}
|
|
|
|
try {
|
|
var resp = await fetch('/api/export/estimate?stack=' + encodeURIComponent(stackName) + '&drive=' + encodeURIComponent(drive));
|
|
var data = await resp.json();
|
|
if (!data.ok) {
|
|
box.style.display = 'none';
|
|
btn.disabled = true;
|
|
return;
|
|
}
|
|
var est = data.data;
|
|
document.getElementById('estConfig').textContent = est.config_size_human;
|
|
document.getElementById('estData').textContent = est.data_size_human;
|
|
document.getElementById('estTotal').textContent = '~' + est.total_size_human;
|
|
document.getElementById('estFree').textContent = '(szabad: ' + est.dest_free_human + ')';
|
|
document.getElementById('estTime').textContent = '~' + est.estimated_minutes + ' perc';
|
|
|
|
var warn = document.getElementById('estWarning');
|
|
if (!est.fits_on_dest) {
|
|
warn.textContent = 'Nincs elég szabad hely a kiválasztott tárolón!';
|
|
warn.style.display = 'block';
|
|
btn.disabled = true;
|
|
} else {
|
|
warn.style.display = 'none';
|
|
btn.disabled = false;
|
|
}
|
|
box.style.display = 'block';
|
|
} catch(e) {
|
|
console.error('Estimate error:', e);
|
|
}
|
|
}
|
|
|
|
async function startExport() {
|
|
var drive = document.getElementById('destDrive').value;
|
|
var password = document.getElementById('exportPassword').value;
|
|
var stopApp = document.getElementById('stopApp').checked;
|
|
|
|
document.getElementById('startBtn').disabled = true;
|
|
document.getElementById('progressCard').style.display = 'block';
|
|
document.getElementById('doneCard').style.display = 'none';
|
|
|
|
try {
|
|
var resp = await fetch('/api/export/start', {
|
|
method: 'POST',
|
|
headers: csrfH(),
|
|
body: JSON.stringify({
|
|
stack_name: stackName,
|
|
dest_drive: drive,
|
|
password: password,
|
|
stop_app: stopApp
|
|
})
|
|
});
|
|
var data = await resp.json();
|
|
if (!data.ok) {
|
|
showError(data.error || 'Hiba történt');
|
|
return;
|
|
}
|
|
pollStatus();
|
|
} catch(e) {
|
|
showError(e.message);
|
|
}
|
|
}
|
|
|
|
function pollStatus() {
|
|
if (pollTimer) clearInterval(pollTimer);
|
|
pollTimer = setInterval(async function() {
|
|
try {
|
|
var resp = await fetch('/api/export/status');
|
|
var data = await resp.json();
|
|
renderSteps(data.steps || []);
|
|
|
|
if (data.error) {
|
|
showError(data.error);
|
|
clearInterval(pollTimer);
|
|
return;
|
|
}
|
|
|
|
if (data.done && !data.error) {
|
|
clearInterval(pollTimer);
|
|
showDone(data);
|
|
}
|
|
} catch(e) {
|
|
console.error('Poll error:', e);
|
|
}
|
|
}, 1000);
|
|
}
|
|
|
|
function renderSteps(steps) {
|
|
var html = '';
|
|
for (var i = 0; i < steps.length; i++) {
|
|
var s = steps[i];
|
|
var icon = '○'; // pending
|
|
if (s.status === 'running') icon = '⟳';
|
|
if (s.status === 'done') icon = '✓';
|
|
if (s.status === 'failed') icon = '✗';
|
|
var cls = s.status === 'failed' ? 'color:var(--crit)' : s.status === 'done' ? 'color:var(--blue)' : s.status === 'running' ? 'color:var(--blue)' : '';
|
|
html += '<div style="padding:.25rem 0;' + cls + '">' + icon + ' ' + s.label;
|
|
if (s.error) html += ' <span style="font-size:.85rem">(' + s.error + ')</span>';
|
|
html += '</div>';
|
|
}
|
|
document.getElementById('progressSteps').innerHTML = html;
|
|
}
|
|
|
|
function showError(msg) {
|
|
var el = document.getElementById('progressError');
|
|
el.textContent = msg;
|
|
el.style.display = 'block';
|
|
document.getElementById('startBtn').disabled = false;
|
|
}
|
|
|
|
function showDone(data) {
|
|
document.getElementById('progressCard').style.display = 'none';
|
|
document.getElementById('doneCard').style.display = 'block';
|
|
var fileName = (data.output_path || '').split('/').pop();
|
|
document.getElementById('doneFile').textContent = fileName;
|
|
document.getElementById('doneSize').textContent = data.output_size ? '(' + data.output_size + ')' : '';
|
|
|
|
// Build FileBrowser link to the exports directory
|
|
var drive = document.getElementById('destDrive').value;
|
|
var fbPath = drive + '/felhom-data/exports/';
|
|
document.getElementById('doneFBLink').href = 'https://files.' + location.hostname.split('.').slice(-2).join('.') + '/files' + fbPath;
|
|
}
|
|
</script>
|
|
|
|
{{template "layout_end" .}}
|
|
{{end}}
|