From 8d9bf338fcf0c8f9d47be2e2bb067dccc75db0c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Sun, 26 Jul 2026 14:31:10 +0400 Subject: [PATCH] Fix: refresh instance status badges after any operation, v1.0.45 --- site/app.py | 2 +- site/templates/index.html | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) 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