Skip to content

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Frooodle committed Jul 9, 2023
1 parent 6e726ac commit a742c1b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = 'stirling.software'
version = '0.10.3'
version = '0.11.0'
sourceCompatibility = '17'

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,13 @@ private void handleDirectory(Path dir) throws Exception {
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;
}

// 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");
Expand Down Expand Up @@ -191,13 +189,18 @@ private void handleDirectory(Path dir) throws Exception {
// 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);
Expand All @@ -206,6 +209,7 @@ private void handleDirectory(Path dir) throws Exception {
outputPath = Paths.get(".", outputDir);
}

logger.info("outputPath={}", outputPath);

if (!Files.exists(outputPath)) {
try {
Expand Down
21 changes: 17 additions & 4 deletions src/main/resources/static/js/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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++) {
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/templates/pipeline.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ <h2 class="card-title">Pipeline Configuration</h2>

<!-- 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 -->
Expand Down

0 comments on commit a742c1b

Please sign in to comment.