diff --git a/site/app.py b/site/app.py index dcb3447..86a5ffd 100644 --- a/site/app.py +++ b/site/app.py @@ -6,7 +6,7 @@ from routes.main import bp as main_bp from routes.api import bp as api_bp from routes.api_test import bp as api_test_bp -VERSION = "1.0.44" +VERSION = "1.0.45" app = Flask(__name__, template_folder="templates", static_folder="static") app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-dev.ngcloud.ru/api/v1/svc") diff --git a/site/templates/index.html b/site/templates/index.html index cff57d6..55d6c27 100644 --- a/site/templates/index.html +++ b/site/templates/index.html @@ -248,7 +248,10 @@ async function executeOp(params){ document.getElementById('test-status').innerHTML=` ${sd.status} ${sd.error||''} ${sd.duration||''}s`; btn.disabled=false; btn.textContent='Готово'; - if(sd.status==='OK'&&selectedOp.opName==='create') await selectService(SVC_ID); + if(sd.status==='OK'){ + if(selectedOp.opName==='create'){await selectService(SVC_ID);} + else{await refreshInstances();} + } } },2000); }catch(e){ @@ -271,6 +274,20 @@ function showStages(stages){ function stopPoll(){ if(pollTimer){clearInterval(pollTimer);pollTimer=null;} } + +async function refreshInstances(){ + const r=await fetch('/api/operations/'+SVC_ID); + const d=await r.json(); + svcInstances=d.instances||[]; + // обновить только бейджи статусов + svcInstances.forEach(i=>{ + const el=document.querySelector(`[data-iuid="${i.instanceUid}"] .badge`); + if(el){ + el.textContent=i.explainedStatus||'?'; + el.className='badge '+(i.explainedStatus==='running'?'badge-success':''); + } + }); +} \ No newline at end of file