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
+1 -1
View File
@@ -18,7 +18,7 @@ from routes.api import bp as api_bp
from routes.api_test import bp as api_test_bp from routes.api_test import bp as api_test_bp
# Версия — меняется при КАЖДОМ изменении кода. Показывается в топбаре UI. # Версия — меняется при КАЖДОМ изменении кода. Показывается в топбаре UI.
VERSION = "1.1.14" VERSION = "1.1.15"
app = Flask(__name__, template_folder="templates", static_folder="static") app = Flask(__name__, template_folder="templates", static_folder="static")
app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-test.ngcloud.ru/api/v1/svc") app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-test.ngcloud.ru/api/v1/svc")
+13 -5
View File
@@ -37,7 +37,7 @@ async function selectService(svcId){
currentSvcId=svcId; currentSvcId=svcId;
selectedInst=null; selectedOp=null; stopPoll(); selectedInst=null; selectedOp=null; stopPoll();
document.getElementById('params-area').style.display='none'; 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')); document.querySelectorAll('.svc-item').forEach(e=>e.classList.remove('active'));
const svcEl=document.querySelector(`.svc-item[onclick*="${svcId}"]`); const svcEl=document.querySelector(`.svc-item[onclick*="${svcId}"]`);
@@ -135,7 +135,7 @@ function findInstName(){
function showParams(opId,opName){ function showParams(opId,opName){
selectedOp={opId,opName,svcId:currentSvcId}; selectedOp={opId,opName,svcId:currentSvcId};
document.getElementById('params-area').style.display='block'; 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=''; document.getElementById('test-status').textContent='';
const isCreate=opName==='create'; const isCreate=opName==='create';
@@ -304,8 +304,15 @@ async function executeOp(params){
btn.textContent=selectedOp.opName+'...'; btn.textContent=selectedOp.opName+'...';
btn.disabled=true; btn.disabled=true;
setRunningState(selectedOp.opName, displayName); setRunningState(selectedOp.opName, displayName);
document.getElementById('stages-box').style.display='block'; // Создать динамический stages-box после инстанса
document.getElementById('stages-box').innerHTML=''; 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{ try{
const r=await fetch('/api/test',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({ 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?'✅':'❌'):'⏳'; const icon=done?(s.isSuccessful?'✅':'❌'):'⏳';
html+=`<div style="font-size:11px;padding:2px 0;">${icon} ${s.stage}${(s.duration||0).toFixed(1)}s</div>`; 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(){ function stopPoll(){
-1
View File
@@ -117,7 +117,6 @@
<button class="btn btn-primary btn-sm" id="btn-test" style="display:none;">Запустить</button> <button class="btn btn-primary btn-sm" id="btn-test" style="display:none;">Запустить</button>
<span id="test-status" style="font-size:11px;margin-left:8px;"></span> <span id="test-status" style="font-size:11px;margin-left:8px;"></span>
</div> </div>
<div id="stages-box" style="display:none;max-height:200px;overflow-y:auto;"></div>
</div> </div>
<div id="create-btn-area" style="padding:0 8px 8px;"> <div id="create-btn-area" style="padding:0 8px 8px;">
<div class="inst-item" style="border-top:1px solid var(--brand-gray);padding-top:8px;margin-top:4px;" onclick="startCreate()"> <div class="inst-item" style="border-top:1px solid var(--brand-gray);padding-top:8px;margin-top:4px;" onclick="startCreate()">