v1.2.3: instance_ref shows cloud instances + bigger CRUD buttons
scenario-form.js: - showScenarioEditor loads /api/instances/list alongside services - renderStepRow: non-create instance_ref dropdown shows: 🆕 outputs from previous create steps ☁ existing cloud instances filtered by service_id - Removed separate instance_uid text field (now in dropdown) scenario-list.js: - CRUD buttons: ✏📋🗑 bigger (13px, padding), vertical layout - Run button: full-width, left-aligned
This commit is contained in:
@@ -17,11 +17,15 @@ async function showScenarioEditor(def) {
|
||||
services: [], opsCache: {}
|
||||
} : { defId: null, version: 1, name: '', steps: [], services: [], opsCache: {} };
|
||||
|
||||
// Загрузить список сервисов
|
||||
// Загрузить список сервисов и облачные инстансы
|
||||
try {
|
||||
const r = await fetch('/api/services');
|
||||
scenarioEditorState.services = await r.json();
|
||||
} catch (e) { scenarioEditorState.services = []; }
|
||||
const [svcR, instR] = await Promise.all([
|
||||
fetch('/api/services').then(r => r.json()),
|
||||
fetch('/api/instances/list').then(r => r.json())
|
||||
]);
|
||||
scenarioEditorState.services = svcR || [];
|
||||
scenarioEditorState.cloudInstances = instR || [];
|
||||
} catch (e) { scenarioEditorState.services = []; scenarioEditorState.cloudInstances = []; }
|
||||
renderEditor();
|
||||
}
|
||||
|
||||
@@ -110,10 +114,18 @@ function renderStepRow(idx, step) {
|
||||
if (op === 'create') {
|
||||
html += `<input type="text" id="step-${idx}-output" value="${_esc(out)}" placeholder="output (имя для ссылок)" style="width:180px;padding:3px;font-size:11px;">`;
|
||||
} else if (op) {
|
||||
let refOpts = '<option value="">— instance_ref —</option>';
|
||||
prevOutputs.forEach(o => { refOpts += `<option value="${o}" ${o == ref ? 'selected' : ''}>${_esc(o)}</option>`; });
|
||||
html += `<select id="step-${idx}-ref" style="padding:3px;font-size:11px;">${refOpts}</select>`;
|
||||
html += `<input type="text" id="step-${idx}-uid" value="${_esc(step.instance_uid || '')}" placeholder="или явный UUID" style="width:280px;padding:3px;font-size:11px;">`;
|
||||
// Предыдущие output'ы + облачные инстансы этого сервиса
|
||||
let refOpts = '<option value="">— инстанс —</option>';
|
||||
// output'ы из предыдущих create-шагов
|
||||
prevOutputs.forEach(o => { refOpts += `<option value="${o}" ${o == ref ? 'selected' : ''}>🆕 ${_esc(o)}</option>`; });
|
||||
// Облачные инстансы того же сервиса
|
||||
const cloudInsts = (st.cloudInstances || []).filter(i => i.serviceId == svcId && i.explainedStatus !== 'deleted');
|
||||
if (cloudInsts.length) refOpts += '<option disabled>── облако ──</option>';
|
||||
cloudInsts.forEach(i => {
|
||||
const sel = i.instanceUid == ref ? 'selected' : '';
|
||||
refOpts += `<option value="${i.instanceUid}" ${sel}>☁ ${_esc(i.displayName)} (${_esc(i.explainedStatus || '?')})</option>`;
|
||||
});
|
||||
html += `<select id="step-${idx}-ref" style="padding:3px;font-size:11px;max-width:400px;">${refOpts}</select>`;
|
||||
}
|
||||
html += '</div>';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user