v1.1.27: busy lock — block operations while another is running

This commit is contained in:
2026-07-29 13:30:53 +04:00
parent 8cc7f54b23
commit edb2d0d526
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -29,6 +29,7 @@ let svcInstances=[], selectedInst=null, selectedOp=null, pollTimer=null;
let currentSvcId=1; // динамический — обновляется при selectService()
let currentSvcName=''; // имя текущего сервиса (колонка «тип инстанса»)
let currentSvcShort=''; // краткое имя (redis, postgres) для displayName
let busy=false; // блокировка: запрет операций пока идёт другая
const AUTOTEST_PREFIX='autotest-';
// Первый сервис из списка (рендерится Jinja2)
@@ -73,6 +74,7 @@ async function toggleInstance(iuid){
document.getElementById('params-area').style.display='none';
const opsEl=document.getElementById('ops-'+iuid);
if(busy){opsEl.innerHTML='<span style="color:var(--muted);font-size:11px;">⏳ операция выполняется...</span>';opsEl.classList.add('open');return;}
if(opsEl.classList.contains('open')){opsEl.classList.remove('open');return;}
document.querySelectorAll('.inst-ops').forEach(e=>e.classList.remove('open'));
@@ -96,6 +98,7 @@ function opClass(opName){
}
async function startCreate(){
if(busy) return;
selectedInst=null; stopPoll();
document.querySelectorAll('[data-iuid]').forEach(e=>e.classList.remove('active'));
document.querySelectorAll('.inst-ops').forEach(e=>e.classList.remove('open'));
@@ -117,6 +120,7 @@ function makeCreateDisplayName(){
}
function runOp(opName,opId){
if(busy) return;
stopPoll();
selectedOp={opId,opName,svcId:currentSvcId};
if(opName==='modify'){
@@ -274,6 +278,7 @@ function validateJson(el,quiet){
}
function setFinishedState(statusText, statusClass, statusError, statusDuration, instanceName){
busy=false;
const btn=document.getElementById('btn-test');
btn.disabled=false;
btn.textContent='Готово';
@@ -293,6 +298,7 @@ function setRunningState(opName, displayName){
}
async function executeOp(params){
busy=true;
stopPoll();
const isCreate=selectedOp?.opName==='create';
const displayNameInput=document.getElementById('param-displayname');