This commit is contained in:
Anthony Stirling 2023-07-09 18:10:10 +01:00
parent 6e726ac2a6
commit a742c1b034
4 changed files with 31 additions and 10 deletions

View file

@ -8,7 +8,7 @@ plugins {
}
group = 'stirling.software'
version = '0.10.3'
version = '0.11.0'
sourceCompatibility = '17'
repositories {

View file

@ -120,7 +120,6 @@ public class Controller {
if (config.getOperations() == null || config.getOutputDir() == null || config.getName() == null) {
throw new IOException("Invalid JSON format");
}
logger.info("Parsed PipelineConfig: {}", config);
} catch (IOException e) {
logger.error("Error parsing PipelineConfig: {}", jsonString, e);
return;
@ -128,7 +127,6 @@ public class Controller {
// For each operation in the pipeline
for (PipelineOperation operation : config.getOperations()) {
logger.info("Processing operation: {}", operation.toString());
// Collect all files based on fileInput
File[] files;
String fileInput = (String) operation.getParameters().get("fileInput");
@ -191,13 +189,18 @@ public class Controller {
// If the environment variable is not set, use the default value
outputFolder = finishedFoldersDir;
}
logger.info("outputDir 0={}", outputDir);
// Replace the placeholders in the outputDir string
outputDir = outputDir.replace("{outputFolder}", outputFolder);
outputDir = outputDir.replace("{folderName}", dir.toString());
logger.info("outputDir 1={}", outputDir);
outputDir = outputDir.replace("\\watchedFolders", "");
Path outputPath;
outputDir = outputDir.replace("//watchedFolders", "");
outputDir = outputDir.replace("\\\\watchedFolders", "");
outputDir = outputDir.replace("/watchedFolders", "");
Path outputPath;
logger.info("outputDir 2={}", outputDir);
if (Paths.get(outputDir).isAbsolute()) {
// If it's an absolute path, use it directly
outputPath = Paths.get(outputDir);
@ -206,6 +209,7 @@ public class Controller {
outputPath = Paths.get(".", outputDir);
}
logger.info("outputPath={}", outputPath);
if (!Files.exists(outputPath)) {
try {

View file

@ -74,7 +74,13 @@ document.getElementById('submitConfigBtn').addEventListener('click', function()
"pipeline": [{
"operation": selectedOperation,
"parameters": parameters
}]
}],
"_examples": {
"outputDir" : "{outputFolder}/{folderName}",
"outputFileName" : "{filename}-{pipelineName}-{date}-{time}"
},
"outputDir" : "httpWebRequest",
"outputFileName" : "{filename}"
};
let pipelineConfigJson = JSON.stringify(pipelineConfig, null, 2);
@ -340,10 +346,17 @@ document.getElementById('addOperationBtn').addEventListener('click', function()
if (validatePipeline() === false) {
return;
}
var pipelineName = document.getElementById('pipelineName').value;
let pipelineList = document.getElementById('pipelineList').children;
let pipelineConfig = {
"name": "uniquePipelineName",
"pipeline": []
"name": pipelineName,
"pipeline": [],
"_examples": {
"outputDir" : "{outputFolder}/{folderName}",
"outputFileName" : "{filename}-{pipelineName}-{date}-{time}"
},
"outputDir" : "httpWebRequest",
"outputFileName" : "{filename}"
};
for (let i = 0; i < pipelineList.length; i++) {
@ -381,7 +394,7 @@ document.getElementById('addOperationBtn').addEventListener('click', function()
while (pipelineList.firstChild) {
pipelineList.removeChild(pipelineList.firstChild);
}
document.getElementById('pipelineName').value = pipelineConfig.name
pipelineConfig.pipeline.forEach(operationConfig => {
let operationsDropdown = document.getElementById('operationsDropdown');
operationsDropdown.value = operationConfig.operation;

View file

@ -33,6 +33,10 @@
<!-- Pipeline Configuration Body -->
<div class="card-body">
<div class="mb-3">
<label for="pipelineName" class="form-label">Pipeline Name</label>
<input type="text" id="pipelineName" class="form-control" placeholder="Enter pipeline name here">
</div>
<div class="mb-3">
<select id="operationsDropdown" class="form-select">
<!-- Options will be dynamically populated here -->