diff --git a/internal/lkgateway/web/templates/admin_wizard.html b/internal/lkgateway/web/templates/admin_wizard.html index 7c347c0..fc3038a 100644 --- a/internal/lkgateway/web/templates/admin_wizard.html +++ b/internal/lkgateway/web/templates/admin_wizard.html @@ -4,6 +4,8 @@ .wiz-head h1 { font-size:26px; font-weight:720; letter-spacing:-0.02em; margin:0 0 6px; } .wiz-head p { color:var(--muted); margin:0; } .wizard-progress { display:flex; align-items:center; justify-content:center; gap:0; margin:24px auto 28px; max-width:680px; } +a.wstep { text-decoration:none; cursor:pointer; } +a.wstep:hover .bub { box-shadow:0 0 0 4px var(--accent-weak); } .wstep { display:flex; flex-direction:column; align-items:center; gap:7px; flex:1; position:relative; } .wstep .bub { width:34px; height:34px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:14px; font-weight:650; background:var(--card-2); border:1.5px solid var(--border-strong); color:var(--muted); z-index:1; transition:all .2s; } .wstep .lbl { font-size:12px; color:var(--muted); font-weight:550; } @@ -27,13 +29,13 @@
Пропустить мастер и перейти в систему → — вернуться к нему можно из «Настройка → Мастер настройки»
diff --git a/internal/lkgateway/web/templates/layout.html b/internal/lkgateway/web/templates/layout.html index ba2a541..c8fdc24 100644 --- a/internal/lkgateway/web/templates/layout.html +++ b/internal/lkgateway/web/templates/layout.html @@ -601,6 +601,10 @@ label { font-size:13px; font-weight:500; } function run(form){ var note='', startVer=null, target='', seenActive=false, postDone=false, lost=false, t0=Date.now(), seq0=null; show(); stageEl.textContent='Отправка запроса…'; bar.style.width='3%'; detail.textContent=''; + // номер последнего отчёта до отправки: отчёт прошлой попытки (например, с ошибкой) не показываем + fetch('/admin/setup/update/progress',{cache:'no-store',credentials:'same-origin'}).then(function(r){ return r.json(); }) + .then(function(p){ seq0=p.seq; startVer=p.version; }).catch(function(){ seq0=0; }).then(send); + function send(){ var xhr=new XMLHttpRequest(); xhr.open('POST', form.action); var file=form.querySelector('input[type=file]'); if(file && file.files.length){ @@ -609,15 +613,17 @@ label { font-size:13px; font-weight:500; } } xhr.onloadend=function(){ postDone=true; }; xhr.send(new FormData(form)); + setTimeout(poll, 400); + } function poll(){ fetch('/admin/setup/update/progress',{cache:'no-store',credentials:'same-origin'}).then(function(r){ if(!r.ok) throw 0; return r.json(); }).then(function(p){ - if(startVer===null){ startVer=p.version; seq0=p.seq; } + if(startVer===null){ startVer=p.version; } if(p.target) target=p.target; if(p.note) note=p.note; if(lost){ // bj вернулся после перезапуска if(!target || p.version===target || p.version!==startVer){ finish('Готово: bj перезапущен, работает версия '+p.version+'.', true); detail.textContent=note ? note.charAt(0).toUpperCase()+note.slice(1)+'.' : ''; return; } } - var fresh = p.seq!==seq0 || seenActive || postDone; + var fresh = p.seq!==seq0; // только отчёт этой попытки if(p.active){ seenActive=true; var steps=p.steps||4, base=(p.step-1)/steps*100, part=100/steps; if(p.total>0 && p.step===2){ base+=part*Math.min(1,p.done/p.total); detail.textContent='Скачано '+mb(p.done)+' из '+mb(p.total); } @@ -628,7 +634,7 @@ label { font-size:13px; font-weight:500; } if(p.error){ finish('Обновление не выполнено', false); detail.textContent=p.error; return; } if(target && p.version!==target){ stageEl.textContent='Шаг 4 из 4: перезапуск bj'; bar.style.width='90%'; detail.textContent='Ждём, пока bj поднимется с новой версией…'; } else { finish('Готово', true); detail.textContent=p.result||''; return; } - } else if(postDone && Date.now()-t0>4000 && !seenActive){ + } else if(postDone && !fresh && Date.now()-t0>8000){ finish('Готово', true); detail.textContent='Результат — в строке «Последняя проверка».'; return; } setTimeout(poll, 800); @@ -638,7 +644,6 @@ label { font-size:13px; font-weight:500; } setTimeout(poll, 1500); }); } - setTimeout(poll, 400); } document.addEventListener('submit', function(e){ var f=e.target; if(!f || !f.action || e.defaultPrevented) return;