pipeline enhance for MI

This commit is contained in:
Anthony Stirling 2023-12-31 13:05:38 +00:00
parent eda91cc556
commit f535387ac4
3 changed files with 521 additions and 482 deletions

View file

@ -138,7 +138,7 @@ public class PipelineProcessor {
hasErrors = true; hasErrors = true;
} }
outputFiles = newOutputFiles;
} }
} else { } else {
@ -177,11 +177,13 @@ public class PipelineProcessor {
} }
} }
logPrintStream.close(); logPrintStream.close();
outputFiles = newOutputFiles;
} }
if (hasErrors) { if (hasErrors) {
logger.error("Errors occurred during processing. Log: {}", logStream.toString()); logger.error("Errors occurred during processing. Log: {}", logStream.toString());
} }
return outputFiles; return outputFiles;
} }

View file

@ -185,7 +185,8 @@ fetch('v1/api-docs')
if (!operation || !operation.description) { if (!operation || !operation.description) {
console.log(operationPath); console.log(operationPath);
} }
if (operation && !ignoreOperations.includes(operationPath) && !operation.description.includes("Type:MISO")) { //!operation.description.includes("Type:MISO")
if (operation && !ignoreOperations.includes(operationPath)) {
let operationTag = operation.tags[0]; // This assumes each operation has exactly one tag let operationTag = operation.tags[0]; // This assumes each operation has exactly one tag
if (!operationsByTag[operationTag]) { if (!operationsByTag[operationTag]) {
operationsByTag[operationTag] = []; operationsByTag[operationTag] = [];
@ -273,6 +274,7 @@ document.getElementById('addOperationBtn').addEventListener('click', function()
event.preventDefault(); event.preventDefault();
if (listItem.previousElementSibling) { if (listItem.previousElementSibling) {
pipelineList.insertBefore(listItem, listItem.previousElementSibling); pipelineList.insertBefore(listItem, listItem.previousElementSibling);
updateConfigInDropdown();
} }
}); });
@ -280,13 +282,16 @@ document.getElementById('addOperationBtn').addEventListener('click', function()
event.preventDefault(); event.preventDefault();
if (listItem.nextElementSibling) { if (listItem.nextElementSibling) {
pipelineList.insertBefore(listItem.nextElementSibling, listItem); pipelineList.insertBefore(listItem.nextElementSibling, listItem);
updateConfigInDropdown();
} }
}); });
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(); hideOrShowPipelineHeader();
updateConfigInDropdown();
}); });
listItem.querySelector('.pipelineSettings').addEventListener('click', function(event) { listItem.querySelector('.pipelineSettings').addEventListener('click', function(event) {
@ -466,10 +471,26 @@ document.getElementById('addOperationBtn').addEventListener('click', function()
// } // }
//} //}
} }
updateConfigInDropdown();
hideOrShowPipelineHeader(); hideOrShowPipelineHeader();
}); });
function updateConfigInDropdown() {
let pipelineSelect = document.getElementById('pipelineSelect');
let selectedOption = pipelineSelect.options[pipelineSelect.selectedIndex];
// Get the current configuration as JSON
let pipelineConfigJson = configToJson();
console.log("pipelineConfigJson", pipelineConfigJson);
if (!pipelineConfigJson) {
console.error("Failed to update configuration: Invalid configuration");
return;
}
// Update the value of the selected option with the new configuration
selectedOption.value = pipelineConfigJson;
}
var saveBtn = document.getElementById('savePipelineBtn'); var saveBtn = document.getElementById('savePipelineBtn');
@ -479,10 +500,10 @@ document.getElementById('addOperationBtn').addEventListener('click', function()
// Add the event listener // Add the event listener
saveBtn.addEventListener('click', savePipeline); saveBtn.addEventListener('click', savePipeline);
console.log("saveBtn", saveBtn) console.log("saveBtn", saveBtn)
function savePipeline() {
if (validatePipeline() === false) { function configToJson() {
return; if (!validatePipeline()) {
return null; // Return null if validation fails
} }
var pipelineName = document.getElementById('pipelineName').value; var pipelineName = document.getElementById('pipelineName').value;
@ -509,11 +530,23 @@ document.getElementById('addOperationBtn').addEventListener('click', function()
"parameters": parameters "parameters": parameters
}); });
} }
console.log("Downloading..");
return JSON.stringify(pipelineConfig, null, 2);
}
function savePipeline() {
let pipelineConfigJson = configToJson();
if (!pipelineConfigJson) {
console.error("Failed to save pipeline: Invalid configuration");
return;
}
let pipelineName = document.getElementById('pipelineName').value;
console.log("Downloading...");
let a = document.createElement('a'); let a = document.createElement('a');
a.href = URL.createObjectURL(new Blob([JSON.stringify(pipelineConfig, null, 2)], { a.href = URL.createObjectURL(new Blob([pipelineConfigJson], { type: 'application/json' }));
type: 'application/json'
}));
a.download = pipelineName + '.json'; a.download = pipelineName + '.json';
a.style.display = 'none'; a.style.display = 'none';
@ -522,7 +555,9 @@ document.getElementById('addOperationBtn').addEventListener('click', function()
document.body.removeChild(a); document.body.removeChild(a);
} }
async function processPipelineConfig(configString) { async function processPipelineConfig(configString) {
console.log("configString",configString);
let pipelineConfig = JSON.parse(configString); let pipelineConfig = JSON.parse(configString);
let pipelineList = document.getElementById('pipelineList'); let pipelineList = document.getElementById('pipelineList');

View file

@ -48,6 +48,8 @@
<div class="center-element"> <div class="center-element">
<div class="element-margin"> <div class="element-margin">
<select id="pipelineSelect" class="custom-select"> <select id="pipelineSelect" class="custom-select">
<option value="{&quot;name&quot;:&quot;Custom&quot;,&quot;pipeline&quot;:[],&quot;_examples&quot;:{&quot;outputDir&quot;:&quot;{outputFolder}/{folderName}&quot;,&quot;outputFileName&quot;:&quot;{filename}-{pipelineName}-{date}-{time}&quot;},&quot;outputDir&quot;:&quot;{outputFolder}&quot;,&quot;outputFileName&quot;:&quot;{filename}&quot;}" th:text="Custom"></option>
<th:block th:each="config : ${pipelineConfigsWithNames}"> <th:block th:each="config : ${pipelineConfigsWithNames}">
<option th:value="${config.json}" th:text="${config.name}"></option> <option th:value="${config.json}" th:text="${config.name}"></option>
</th:block> </th:block>