Fix: refresh instance status badges after any operation, v1.0.45
This commit is contained in:
+1
-1
@@ -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")
|
||||
|
||||
@@ -248,7 +248,10 @@ async function executeOp(params){
|
||||
document.getElementById('test-status').innerHTML=` <span class="badge ${cls}">${sd.status}</span> ${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':'');
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user