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' group = 'stirling.software'
version = '0.10.3' version = '0.11.0'
sourceCompatibility = '17' sourceCompatibility = '17'
repositories { repositories {

View file

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

View file

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

View file

@ -33,6 +33,10 @@
<!-- Pipeline Configuration Body --> <!-- Pipeline Configuration Body -->
<div class="card-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"> <div class="mb-3">
<select id="operationsDropdown" class="form-select"> <select id="operationsDropdown" class="form-select">
<!-- Options will be dynamically populated here --> <!-- Options will be dynamically populated here -->