From c5f1ff697f7180f2b3d45df755a862468799eafd Mon Sep 17 00:00:00 2001 From: werner daehn Date: Mon, 17 Feb 2025 09:19:56 +0100 Subject: [PATCH] UI cleanup --- README.md | 11 +++++++++-- WebContent/ui5/Config.controller.js | 1 + WebContent/ui5/Config.view.xml | 5 ----- .../io/rtdi/bigdata/rulesservice/RulesService.java | 3 +++ .../rulesservice/config/RuleFileDefinition.java | 12 ++++++++---- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 26a645c..3164f21 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ For example [http://localhost:80/](http://localhost:80/) might do the trick if t The default login for this startup method is: **rtdi / rtdi!io** -The better start command is to mount two host directories into the container, the rtdiconfig directory where all settings made when configuring the connector will be stored permanently and the security directory for web server specific settings like user database and SSL certificates. +The better start command is to mount two host directories into the container, the `/home/dir/rulesservice` (choose yours) directory where all settings related to the rules service are stored (with the sub directories `settings` for the Kafka connection details and `definitions` with the rule files) and the `/home/dir/security` directory for web server specific settings like user database and SSL certificates. docker run -d -p 80:8080 -p 443:8443 --rm \ -v /home/dir/rulesservice:/apps/rulesservice \ @@ -59,7 +59,14 @@ The better start command is to mount two host directories into the container, th -For proper start commands, especially https and security related, see the [ConnectorRootApp](https://github.com/rtdi/ConnectorRootApp) project, this application is based on. +For more details, especially https and security related, see the [ConnectorRootApp](https://github.com/rtdi/ConnectorRootApp) project, this application is based on. + +if the `settings` or `definitions` directories should point to somewhere else, the `context.xml` of the tomcat webserver can get additional environments in the `` root node: + +``` + + +``` ### Step 1: Connect to Kafka diff --git a/WebContent/ui5/Config.controller.js b/WebContent/ui5/Config.controller.js index 58253ce..821f63d 100644 --- a/WebContent/ui5/Config.controller.js +++ b/WebContent/ui5/Config.controller.js @@ -25,6 +25,7 @@ return Controller.extend("io.rtdi.bigdata.rulesservice.ui5.Config", { "Content-Type": "application/json;charset=utf-8" } post.loadData("../rest/config", json, true, "POST", false, true, headers); + model.loadData("../rest/config"); }, }); }); diff --git a/WebContent/ui5/Config.view.xml b/WebContent/ui5/Config.view.xml index cccb9ae..d66e85b 100644 --- a/WebContent/ui5/Config.view.xml +++ b/WebContent/ui5/Config.view.xml @@ -23,11 +23,6 @@ inverted="true" icon="{= %{/schemaregconnected} ? 'sap-icon://sys-enter-2' : 'sap-icon://error' }" state="{= %{/schemaregconnected} ? 'Success' : 'Error' }" /> - <ce:CodeEditor id="properties" value="{/properties}" height="300px" type="properties" visible="{/admin}" /> diff --git a/src/main/java/io/rtdi/bigdata/rulesservice/RulesService.java b/src/main/java/io/rtdi/bigdata/rulesservice/RulesService.java index 1123807..27ac9f8 100644 --- a/src/main/java/io/rtdi/bigdata/rulesservice/RulesService.java +++ b/src/main/java/io/rtdi/bigdata/rulesservice/RulesService.java @@ -494,6 +494,9 @@ public List<TopicRule> saveTopicRules(List<TopicRule> input) { public void saveConfig(ServiceSettings input) throws IOException { String properties = input.getProperties(); + if (!settingsdir.toFile().exists()) { + settingsdir.toFile().mkdirs(); + } Files.writeString(settingsdir.resolve("kafka.properties"), properties, StandardCharsets.UTF_8); close(); try { diff --git a/src/main/java/io/rtdi/bigdata/rulesservice/config/RuleFileDefinition.java b/src/main/java/io/rtdi/bigdata/rulesservice/config/RuleFileDefinition.java index a3be1fe..aa7a182 100644 --- a/src/main/java/io/rtdi/bigdata/rulesservice/config/RuleFileDefinition.java +++ b/src/main/java/io/rtdi/bigdata/rulesservice/config/RuleFileDefinition.java @@ -228,11 +228,15 @@ public static List<RuleFileName> getAllRuleFiles(Path rootdir, String subjectnam } public static List<RuleFileName> getAllRuleFiles(Path rootdir) { - File[] subjectnamedirs = rootdir.toFile().listFiles(); List<RuleFileName> ret = new ArrayList<>(); - for (File f : subjectnamedirs) { - if (f.isDirectory()) { - ret.addAll(getAllRuleFiles(rootdir, f.getName())); + if (rootdir.toFile().exists()) { + File[] subjectnamedirs = rootdir.toFile().listFiles(); + if (subjectnamedirs != null && subjectnamedirs.length > 0) { + for (File f : subjectnamedirs) { + if (f.isDirectory()) { + ret.addAll(getAllRuleFiles(rootdir, f.getName())); + } + } } } return ret;