Окно обновления показывает только отчёт своей попытки (не ошибку прошлой); кружки шагов мастера кликабельны

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014FsEKyJrYF69Cj9ZXzFLRi
This commit is contained in:
zuevav
2026-09-24 22:25:38 +03:00
parent 8b44d510eb
commit 56643cbe56
2 changed files with 18 additions and 11 deletions
@@ -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 @@
</div>
<div class="wizard-progress" style="max-width:860px">
<div class="wstep {{if .Done.License}}done{{end}} {{if eq .Step 1}}current{{end}}"><span class="bub">{{if .Done.License}}✓{{else}}1{{end}}</span><span class="lbl">Лицензия</span></div>
<div class="wstep {{if .Done.Postgres}}done{{end}} {{if eq .Step 2}}current{{end}}"><span class="bub">{{if .Done.Postgres}}✓{{else}}2{{end}}</span><span class="lbl">База bj</span></div>
<div class="wstep {{if .Done.Depo}}done{{end}} {{if eq .Step 3}}current{{end}}"><span class="bub">{{if .Done.Depo}}✓{{else}}3{{end}}</span><span class="lbl">Учёт DEPO</span></div>
<div class="wstep {{if .Done.Crypto}}done{{end}} {{if eq .Step 4}}current{{end}}"><span class="bub">{{if .Done.Crypto}}✓{{else}}4{{end}}</span><span class="lbl">Валидата</span></div>
<div class="wstep {{if .Done.Certs}}done{{end}} {{if eq .Step 5}}current{{end}}"><span class="bub">{{if .Done.Certs}}✓{{else}}5{{end}}</span><span class="lbl">Сертификаты</span></div>
<div class="wstep {{if .Done.NSD}}done{{end}} {{if eq .Step 6}}current{{end}}"><span class="bub">{{if .Done.NSD}}✓{{else}}6{{end}}</span><span class="lbl">Шлюз НРД</span></div>
<div class="wstep {{if .Done.TestRun}}done{{end}} {{if eq .Step 7}}current{{end}}"><span class="bub">{{if .Done.TestRun}}✓{{else}}7{{end}}</span><span class="lbl">Проверка</span></div>
<a href="/admin/wizard?step=1" title="Перейти к шагу 1" class="wstep {{if .Done.License}}done{{end}} {{if eq .Step 1}}current{{end}}"><span class="bub">{{if .Done.License}}✓{{else}}1{{end}}</span><span class="lbl">Лицензия</span></a>
<a href="/admin/wizard?step=2" title="Перейти к шагу 2" class="wstep {{if .Done.Postgres}}done{{end}} {{if eq .Step 2}}current{{end}}"><span class="bub">{{if .Done.Postgres}}✓{{else}}2{{end}}</span><span class="lbl">База bj</span></a>
<a href="/admin/wizard?step=3" title="Перейти к шагу 3" class="wstep {{if .Done.Depo}}done{{end}} {{if eq .Step 3}}current{{end}}"><span class="bub">{{if .Done.Depo}}✓{{else}}3{{end}}</span><span class="lbl">Учёт DEPO</span></a>
<a href="/admin/wizard?step=4" title="Перейти к шагу 4" class="wstep {{if .Done.Crypto}}done{{end}} {{if eq .Step 4}}current{{end}}"><span class="bub">{{if .Done.Crypto}}✓{{else}}4{{end}}</span><span class="lbl">Валидата</span></a>
<a href="/admin/wizard?step=5" title="Перейти к шагу 5" class="wstep {{if .Done.Certs}}done{{end}} {{if eq .Step 5}}current{{end}}"><span class="bub">{{if .Done.Certs}}✓{{else}}5{{end}}</span><span class="lbl">Сертификаты</span></a>
<a href="/admin/wizard?step=6" title="Перейти к шагу 6" class="wstep {{if .Done.NSD}}done{{end}} {{if eq .Step 6}}current{{end}}"><span class="bub">{{if .Done.NSD}}✓{{else}}6{{end}}</span><span class="lbl">Шлюз НРД</span></a>
<a href="/admin/wizard?step=7" title="Перейти к шагу 7" class="wstep {{if .Done.TestRun}}done{{end}} {{if eq .Step 7}}current{{end}}"><span class="bub">{{if .Done.TestRun}}✓{{else}}7{{end}}</span><span class="lbl">Проверка</span></a>
</div>
<p style="text-align:center;margin:-14px 0 18px;font-size:13px"><a href="/admin/">Пропустить мастер и перейти в систему →</a> <span class="muted">— вернуться к нему можно из «Настройка → Мастер настройки»</span></p>
+9 -4
View File
@@ -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;