diff --git a/site/app.py b/site/app.py index 6fbbeb2..d92fd99 100644 --- a/site/app.py +++ b/site/app.py @@ -19,7 +19,7 @@ from routes.api_scenario_run import bp_run as api_scenario_run_bp from routes.api_scenario_defs import bp_defs as api_scenario_defs_bp # Версия — меняется при КАЖДОМ изменении кода. Показывается в топбаре UI. -VERSION = "1.2.5" +VERSION = "1.2.6" 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") diff --git a/site/static/js/scenario-form.js b/site/static/js/scenario-form.js index 6772a36..e8492ff 100644 --- a/site/static/js/scenario-form.js +++ b/site/static/js/scenario-form.js @@ -221,15 +221,19 @@ function renderStepRow(idx, step) { } else if (op) { let refOpts = ''; prevOutputs.forEach(o => { refOpts += ``; }); - if (st.cloudInstances && st.cloudInstances.length) { + // Облачные autotest-* инстансы (только если раскрыты) + if (step._showCloud && st.cloudInstances) { refOpts += ''; st.cloudInstances.forEach(i => { - if (i.explainedStatus === 'deleted') return; + const dn = i.displayName || ''; + if (!dn.startsWith('autotest-') || i.explainedStatus === 'deleted') return; const sel = i.instanceUid == ref ? 'selected' : ''; - refOpts += ``; + refOpts += ``; }); } - html += `
`; + const btnLabel = step._showCloud ? '➖ Скрыть облако' : '📥 Из облака'; + html += `
`; + html += `
`; } // Параметры — свёрнутый
, заполняется асинхронно в loadStepParams @@ -242,15 +246,20 @@ function renderStepRow(idx, step) { // ── Действия ── function onOpChange(idx) { - // Сброс params при смене операции (несовместимы) scenarioEditorState.steps[idx].params = {}; scenarioEditorState.steps[idx]._svcOpId = null; renderEditor(); } +function toggleCloudInstances(idx) { + snapshotAllParams(); + scenarioEditorState.steps[idx]._showCloud = !scenarioEditorState.steps[idx]._showCloud; + renderEditor(); +} + function addStep() { snapshotAllParams(); - scenarioEditorState.steps.push({ service_id: '', operation: '', output: '', instance_ref: '', instance_uid: '', params: {} }); + scenarioEditorState.steps.push({ service_id: '', operation: '', output: '', instance_ref: '', instance_uid: '', params: {}, _showCloud: false }); renderEditor(); } diff --git a/site/static/js/scenario-list.js b/site/static/js/scenario-list.js index de08fd5..9a16ef2 100644 --- a/site/static/js/scenario-list.js +++ b/site/static/js/scenario-list.js @@ -41,7 +41,8 @@ async function loadScenarios(){ const last=verHistory[0]; const icon=last.status==='OK'?'✅':last.status==='FAIL'?'❌':last.status==='RUNNING'?'⏳':'⏱'; const time=last.created_at?last.created_at.replace('T',' ').substring(0,19):'?'; - html+=`
Последний: ${icon} ${_esc(last.scenario_name)} — ${last.status} (шаг ${last.current_step}/${last.total_steps}) ${last.duration_sec!=null?last.duration_sec.toFixed(1)+'s':''} — ${time}
`; + const runningStyle = last.status==='RUNNING' ? 'background:#fef3c7;padding:2px 4px;border-radius:3px;' : ''; + html+=`
Последний: ${icon} ${_esc(last.scenario_name)} — ${last.status} (шаг ${last.current_step}/${last.total_steps}) ${last.duration_sec!=null?last.duration_sec.toFixed(1)+'s':''} — ${time}
`; if(last.error_log) html+=`
${_esc(last.error_log)}
`; } body.innerHTML=html; @@ -68,7 +69,8 @@ async function runScenario(defId){ if(!last||last.error) return; const icon=last.status==='OK'?'✅':last.status==='FAIL'?'❌':last.status==='RUNNING'?'⏳':'⏱'; const time=last.created_at?last.created_at.replace('T',' ').substring(0,19):'?'; - let html=`
${icon} ${_esc(last.scenario_name)} — ${last.status} (шаг ${last.current_step}/${last.total_steps}) ${last.duration_sec!=null?last.duration_sec.toFixed(1)+'s':''} — ${time}
`; + const runningBg = last.status==='RUNNING' ? 'background:#fef3c7;padding:2px 4px;border-radius:3px;' : ''; + let html=`
${icon} ${_esc(last.scenario_name)} — ${last.status} (шаг ${last.current_step}/${last.total_steps}) ${last.duration_sec!=null?last.duration_sec.toFixed(1)+'s':''} — ${time}
`; if(last.error_log) html+=`
${_esc(last.error_log)}
`; body.innerHTML=html; if(last.status!=='RUNNING'){