Шаг: выбери операцию → укажи цель. Create: выбери сервис + задай output (имя, например d1). Другие шаги смогут ссылаться на него. Остальные операции: выбери инстанс — 🆕 из create-шагов этого сценария или ☁ из облака. Параметры: key = value (символические коды, как в API).
Пример: durationMs = 5000 [↑][↓] — порядок шагов, [✕] — удалить шаг.
`;
// Шаги
html += '
Шаги
';
st.steps.forEach((s, idx) => { html += renderStepRow(idx, s); });
html += ``;
// Кнопки
html += '
';
html += ``;
html += ``;
html += '
';
openModal(html);
}
function renderStepRow(idx, step) {
const st = scenarioEditorState;
const op = step.operation;
const out = step.output || '';
const ref = step.instance_ref || '';
// Output refs из предыдущих create-шагов
const prevOutputs = [];
for (let i = 0; i < idx; i++) {
const s = st.steps[i];
if (s.operation === 'create' && s.output) prevOutputs.push(s.output);
}
let html = `
`;
html += `
`;
html += `Шаг ${idx+1}`;
if (idx > 0) html += ``;
if (idx < st.steps.length - 1) html += ``;
html += ``;
html += `
`;
// 1. Операция ВСЕГДА первая
const allOps = ['create', 'delete', 'modify', 'suspend', 'resume', 'redeploy'];
let opOpts = '';
allOps.forEach(o => { opOpts += ``; });
html += ``;
// 2. В зависимости от операции
if (op === 'create') {
// Сервис
let svcOpts = '';
st.services.forEach(s => {
svcOpts += ``;
});
html += ``;
html += ``;
} else if (op) {
// Инстанс — облачные + предыдущие output'ы
let refOpts = '';
// output'ы из create-шагов
prevOutputs.forEach(o => { refOpts += ``; });
// Облачные инстансы
if (st.cloudInstances && st.cloudInstances.length) {
refOpts += '';
st.cloudInstances.forEach(i => {
if (i.explainedStatus === 'deleted') return;
const sel = i.instanceUid == ref ? 'selected' : '';
refOpts += ``;
});
}
html += ``;
}
// Параметры
html += `