mild cleanup

This commit is contained in:
Anthony Stirling 2023-12-27 12:51:17 +00:00
parent 61ff0248da
commit f5c285a70f
2 changed files with 17 additions and 2 deletions

View file

@ -274,11 +274,13 @@ document.getElementById('addOperationBtn').addEventListener('click', function()
listItem.querySelector('.remove').addEventListener('click', function(event) { listItem.querySelector('.remove').addEventListener('click', function(event) {
event.preventDefault(); event.preventDefault();
pipelineList.removeChild(listItem); pipelineList.removeChild(listItem);
hideOrShowPipelineHeader();
}); });
listItem.querySelector('.pipelineSettings').addEventListener('click', function(event) { listItem.querySelector('.pipelineSettings').addEventListener('click', function(event) {
event.preventDefault(); event.preventDefault();
showpipelineSettingsModal(selectedOperation); showpipelineSettingsModal(selectedOperation);
hideOrShowPipelineHeader();
}); });
function showpipelineSettingsModal(operation) { function showpipelineSettingsModal(operation) {
@ -452,7 +454,7 @@ document.getElementById('addOperationBtn').addEventListener('click', function()
// } // }
//} //}
} }
hideOrShowPipelineHeader();
}); });
@ -572,6 +574,7 @@ document.getElementById('addOperationBtn').addEventListener('click', function()
processPipelineConfig(event.target.result); processPipelineConfig(event.target.result);
}; };
reader.readAsText(e.target.files[0]); reader.readAsText(e.target.files[0]);
hideOrShowPipelineHeader();
}); });
document.getElementById('pipelineSelect').addEventListener('change', function(e) { document.getElementById('pipelineSelect').addEventListener('change', function(e) {
@ -580,3 +583,15 @@ document.getElementById('addOperationBtn').addEventListener('click', function()
}); });
function hideOrShowPipelineHeader() {
var pipelineHeader = document.getElementById('pipelineHeader');
var pipelineList = document.getElementById('pipelineList');
if (pipelineList.children.length === 0) {
// Hide the pipeline header if there are no items in the pipeline list
pipelineHeader.style.display = 'none';
} else {
// Show the pipeline header if there are items in the pipeline list
pipelineHeader.style.display = 'block';
}
}

View file

@ -157,7 +157,7 @@
<button id="addOperationBtn" class="btn btn-primary">Add <button id="addOperationBtn" class="btn btn-primary">Add
operation</button> operation</button>
</div> </div>
<h3>Pipeline:</h3> <h3 id="pipelineHeader" style="display: none;">Pipeline:</h3>
<ol id="pipelineList" class="list-group"> <ol id="pipelineList" class="list-group">
<!-- Pipeline operations will be dynamically populated here --> <!-- Pipeline operations will be dynamically populated here -->
</ol> </ol>