v1.1.15: dynamic stages-box — inline after instance, not below all

This commit is contained in:
2026-07-29 09:43:29 +04:00
parent 735bf4d3d6
commit b23ea0ee4e
3 changed files with 14 additions and 7 deletions
+13 -5
View File
@@ -37,7 +37,7 @@ async function selectService(svcId){
currentSvcId=svcId;
selectedInst=null; selectedOp=null; stopPoll();
document.getElementById('params-area').style.display='none';
document.getElementById('stages-box').style.display='none';
document.querySelectorAll('.stages-box').forEach(e=>e.remove());
// Подсветить активный сервис в боковой панели
document.querySelectorAll('.svc-item').forEach(e=>e.classList.remove('active'));
const svcEl=document.querySelector(`.svc-item[onclick*="${svcId}"]`);
@@ -135,7 +135,7 @@ function findInstName(){
function showParams(opId,opName){
selectedOp={opId,opName,svcId:currentSvcId};
document.getElementById('params-area').style.display='block';
document.getElementById('stages-box').style.display='none';
document.querySelectorAll('.stages-box').forEach(e=>e.remove());
document.getElementById('test-status').textContent='';
const isCreate=opName==='create';
@@ -304,8 +304,15 @@ async function executeOp(params){
btn.textContent=selectedOp.opName+'...';
btn.disabled=true;
setRunningState(selectedOp.opName, displayName);
document.getElementById('stages-box').style.display='block';
document.getElementById('stages-box').innerHTML='';
// Создать динамический stages-box после инстанса
const instId=selectedInst||'';
const afterEl=instId?document.getElementById('ops-'+instId):null;
document.querySelectorAll('.stages-box').forEach(e=>e.remove());
const stagesBox=document.createElement('div');
stagesBox.className='stages-box';
stagesBox.style.cssText='max-height:200px;overflow-y:auto;padding:4px 8px;margin-left:16px;background:var(--brand-grey-light);border-radius:4px;';
if(afterEl){afterEl.after(stagesBox);}
else{document.getElementById('inst-list').appendChild(stagesBox);}
try{
const r=await fetch('/api/test',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({
@@ -348,7 +355,8 @@ function showStages(stages){
const icon=done?(s.isSuccessful?'✅':'❌'):'⏳';
html+=`<div style="font-size:11px;padding:2px 0;">${icon} ${s.stage}${(s.duration||0).toFixed(1)}s</div>`;
});
document.getElementById('stages-box').innerHTML=html;
const boxes=document.querySelectorAll('.stages-box');
if(boxes.length) boxes[boxes.length-1].innerHTML=html;
}
function stopPoll(){