add branch validation to queue

This commit is contained in:
2025-12-22 15:04:06 +01:00
parent 26b1f256f4
commit 5f4eaaaa20
4 changed files with 394 additions and 40 deletions

View File

@@ -54,7 +54,8 @@
<script>
let validatedBranch = null;
let availableScenarios = [];
let organizedData = {};
let scenarioMap = {};
document.getElementById('branchForm').addEventListener('submit', function(e) {
e.preventDefault();
@@ -101,7 +102,8 @@ function validateBranch() {
nextBtn.style.display = 'inline-block';
validatedBranch = branchName;
availableScenarios = data.scenarios;
organizedData = data.organized_data || {};
scenarioMap = data.scenario_map || {};
// Log debug info
if (data.debug) {
@@ -118,7 +120,8 @@ function validateBranch() {
nextBtn.style.display = 'none';
validatedBranch = null;
availableScenarios = [];
organizedData = {};
scenarioMap = {};
// Log debug info for troubleshooting
console.error('Branch validation failed:', data.error);
@@ -143,7 +146,7 @@ function validateBranch() {
}
function proceedToStep2() {
if (!validatedBranch || !availableScenarios.length) {
if (!validatedBranch || Object.keys(organizedData).length === 0) {
alert('Please validate the branch first');
return;
}
@@ -159,11 +162,17 @@ function proceedToStep2() {
branchInput.value = validatedBranch;
form.appendChild(branchInput);
const scenariosInput = document.createElement('input');
scenariosInput.type = 'hidden';
scenariosInput.name = 'scenarios';
scenariosInput.value = JSON.stringify(availableScenarios);
form.appendChild(scenariosInput);
const organizedDataInput = document.createElement('input');
organizedDataInput.type = 'hidden';
organizedDataInput.name = 'organized_data';
organizedDataInput.value = JSON.stringify(organizedData);
form.appendChild(organizedDataInput);
const scenarioMapInput = document.createElement('input');
scenarioMapInput.type = 'hidden';
scenarioMapInput.name = 'scenario_map';
scenarioMapInput.value = JSON.stringify(scenarioMap);
form.appendChild(scenarioMapInput);
document.body.appendChild(form);
form.submit();
@@ -181,7 +190,8 @@ document.getElementById('branch_name').addEventListener('input', function() {
nextBtn.style.display = 'none';
validatedBranch = null;
availableScenarios = [];
organizedData = {};
scenarioMap = {};
});
</script>
{% endblock %}