enableAlphaFunctionality

This commit is contained in:
Anthony Stirling 2023-12-26 20:10:37 +00:00
parent 0fb0cb8bca
commit 05977aa3a6
5 changed files with 35 additions and 10 deletions

View File

@ -56,9 +56,8 @@ public class ApiDocService {
JsonNode pathNode = entry.getValue();
if (pathNode.has("post")) {
JsonNode postNode = pathNode.get("post");
String operation = path.substring(1); // Assuming operation name is the path without leading '/'
ApiEndpoint endpoint = new ApiEndpoint(operation, postNode);
apiDocumentation.put(operation, endpoint);
ApiEndpoint endpoint = new ApiEndpoint(path, postNode);
apiDocumentation.put(path, endpoint);
}
});
} catch (Exception e) {
@ -68,7 +67,6 @@ public class ApiDocService {
}
public boolean isValidOperation(String operationName, Map<String, Object> parameters) {
System.out.println(apiDocumentation);
if (!apiDocumentation.containsKey(operationName)) {
return false;
}

View File

@ -72,8 +72,14 @@ public class PipelineController {
@Autowired
private ApiDocService apiDocService;
@Scheduled(fixedRate = 60000)
public void scanFolders() {
if(!Boolean.TRUE.equals(applicationProperties.getSystem().getEnableAlphaFunctionality())) {
return;
}
Path watchedFolderPath = Paths.get(watchedFoldersDir);
if (!Files.exists(watchedFolderPath)) {
try {
@ -453,6 +459,10 @@ public class PipelineController {
@PostMapping("/handleData")
public ResponseEntity<byte[]> handleData(@ModelAttribute HandleDataRequest request) {
if(!Boolean.TRUE.equals(applicationProperties.getSystem().getEnableAlphaFunctionality())) {
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
MultipartFile[] files = request.getFileInput();
String jsonString = request.getJson();
if(files == null) {

View File

@ -176,6 +176,19 @@ public class ApplicationProperties {
private String customStaticFilePath;
private Integer maxFileSize;
private Boolean enableAlphaFunctionality;
public Boolean getEnableAlphaFunctionality() {
return enableAlphaFunctionality;
}
public void setEnableAlphaFunctionality(Boolean enableAlphaFunctionality) {
this.enableAlphaFunctionality = enableAlphaFunctionality;
}
public String getDefaultLocale() {
return defaultLocale;
}
@ -218,12 +231,13 @@ public class ApplicationProperties {
@Override
public String toString() {
return "System [defaultLocale=" + defaultLocale + ", googlevisibility=" + googlevisibility + ", rootURIPath="
+ rootURIPath + ", customStaticFilePath=" + customStaticFilePath + ", maxFileSize=" + maxFileSize
+ "]";
return "System [defaultLocale=" + defaultLocale + ", googlevisibility=" + googlevisibility
+ ", rootURIPath=" + rootURIPath + ", customStaticFilePath=" + customStaticFilePath
+ ", maxFileSize=" + maxFileSize + ", enableAlphaFunctionality=" + enableAlphaFunctionality + "]";
}
}
public static class Ui {

View File

@ -9,6 +9,7 @@ security:
system:
defaultLocale: 'en-US' # Set the default language (e.g. 'de-DE', 'fr-FR', etc)
googlevisibility: false # 'true' to allow Google visibility (via robots.txt), 'false' to disallow
enableAlphaFunctionality: false # Set to enable functionality which might need more testing before it fully goes live (This feature might make no changes)
#ui:
# appName: exampleAppName # Application's visible name

View File

@ -343,7 +343,7 @@ document.getElementById('addOperationBtn').addEventListener('click', function()
parameterInput = document.createElement('input');
parameterInput.type = 'text';
parameterInput.className = "form-control";
parameterInput.value = "automatedFileInput";
parameterInput.value = "FileInputPathToBeInputtedManuallyOffline";
} else {
parameterInput = document.createElement('input');
parameterInput.type = 'text';
@ -480,7 +480,7 @@ document.getElementById('addOperationBtn').addEventListener('click', function()
"outputDir": "{outputFolder}/{folderName}",
"outputFileName": "{filename}-{pipelineName}-{date}-{time}"
},
"outputDir": "httpWebRequest",
"outputDir": "{outputFolder}",
"outputFileName": "{filename}"
};
@ -488,6 +488,8 @@ document.getElementById('addOperationBtn').addEventListener('click', function()
let operationName = pipelineList[i].querySelector('.operationName').textContent;
let parameters = operationSettings[operationName] || {};
parameters['fileInput'] = 'automated';
pipelineConfig.pipeline.push({
"operation": operationName,
"parameters": parameters