From a742c1b034a3e7f605ba98da7fa8fc6ce0d534ff Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sun, 9 Jul 2023 18:10:10 +0100 Subject: [PATCH] stuff --- build.gradle | 2 +- .../controller/api/pipeline/Controller.java | 14 ++++++++----- src/main/resources/static/js/pipeline.js | 21 +++++++++++++++---- src/main/resources/templates/pipeline.html | 4 ++++ 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index 9d69535c..5342c96d 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { } group = 'stirling.software' -version = '0.10.3' +version = '0.11.0' sourceCompatibility = '17' repositories { diff --git a/src/main/java/stirling/software/SPDF/controller/api/pipeline/Controller.java b/src/main/java/stirling/software/SPDF/controller/api/pipeline/Controller.java index 308927e6..1c32c2ef 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/pipeline/Controller.java +++ b/src/main/java/stirling/software/SPDF/controller/api/pipeline/Controller.java @@ -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 { diff --git a/src/main/resources/static/js/pipeline.js b/src/main/resources/static/js/pipeline.js index d92fd220..ad77d970 100644 --- a/src/main/resources/static/js/pipeline.js +++ b/src/main/resources/static/js/pipeline.js @@ -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; diff --git a/src/main/resources/templates/pipeline.html b/src/main/resources/templates/pipeline.html index 7dd60c7f..c1ea9354 100644 --- a/src/main/resources/templates/pipeline.html +++ b/src/main/resources/templates/pipeline.html @@ -33,6 +33,10 @@
+
+ + +