From 485769f86b66f66196afca143bbeb00d504abad9 Mon Sep 17 00:00:00 2001 From: "r.wunsch@ist-software.com" Date: Thu, 23 Nov 2023 20:43:33 +0000 Subject: [PATCH 01/71] [maven-release-plugin] prepare for next development iteration --- commons/pom.xml | 2 +- console/pom.xml | 2 +- corecfg/pom.xml | 2 +- jslibs/pom.xml | 2 +- osgi/pckginstall/pom.xml | 2 +- osgi/pom.xml | 2 +- package/aem/pom.xml | 2 +- package/cleanup/pom.xml | 2 +- package/commons/pom.xml | 2 +- package/console/pom.xml | 2 +- package/jslibs/pom.xml | 2 +- package/pckgmgr/pom.xml | 2 +- package/pom.xml | 2 +- package/setup/bundle/pom.xml | 2 +- package/setup/hook/pom.xml | 2 +- package/setup/pom.xml | 2 +- package/sling/pom.xml | 2 +- package/usermgr/pom.xml | 2 +- pckgmgr/pom.xml | 2 +- pom.xml | 4 ++-- setup/pom.xml | 2 +- setup/slingfeature/pom.xml | 2 +- setup/util/pom.xml | 2 +- test/pom.xml | 2 +- usermgr/pom.xml | 2 +- xtracts/debugutil/pom.xml | 2 +- xtracts/pom.xml | 2 +- xtracts/users-graph/bundle/pom.xml | 2 +- xtracts/users-graph/package/pom.xml | 2 +- xtracts/users-graph/pom.xml | 2 +- 30 files changed, 31 insertions(+), 31 deletions(-) diff --git a/commons/pom.xml b/commons/pom.xml index 3af6633de..ad17dfdd0 100644 --- a/commons/pom.xml +++ b/commons/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-commons diff --git a/console/pom.xml b/console/pom.xml index a7b4440ef..224bb5581 100644 --- a/console/pom.xml +++ b/console/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-console diff --git a/corecfg/pom.xml b/corecfg/pom.xml index 03584124f..3b2e50dff 100644 --- a/corecfg/pom.xml +++ b/corecfg/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-config diff --git a/jslibs/pom.xml b/jslibs/pom.xml index 1ee47ad6b..43ec36260 100644 --- a/jslibs/pom.xml +++ b/jslibs/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-jslibs diff --git a/osgi/pckginstall/pom.xml b/osgi/pckginstall/pom.xml index 4ae25684b..3e9fdb84a 100644 --- a/osgi/pckginstall/pom.xml +++ b/osgi/pckginstall/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes.osgi composum-nodes-osgi - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-osgi-package-installer diff --git a/osgi/pom.xml b/osgi/pom.xml index 3a6e44bd2..e4ef4938c 100644 --- a/osgi/pom.xml +++ b/osgi/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.2.3 + 4.2.4-SNAPSHOT com.composum.nodes.osgi diff --git a/package/aem/pom.xml b/package/aem/pom.xml index f9ca03b93..2edd39687 100644 --- a/package/aem/pom.xml +++ b/package/aem/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-package - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-aem-package diff --git a/package/cleanup/pom.xml b/package/cleanup/pom.xml index 90b12bd75..76e224a50 100644 --- a/package/cleanup/pom.xml +++ b/package/cleanup/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-package - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-cleanup-package diff --git a/package/commons/pom.xml b/package/commons/pom.xml index 05de25837..39ec595e0 100644 --- a/package/commons/pom.xml +++ b/package/commons/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-package - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-commons-bundle diff --git a/package/console/pom.xml b/package/console/pom.xml index b70a84529..ef12294e4 100644 --- a/package/console/pom.xml +++ b/package/console/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-package - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-console-bundle diff --git a/package/jslibs/pom.xml b/package/jslibs/pom.xml index 57132dc83..a0cb0f215 100644 --- a/package/jslibs/pom.xml +++ b/package/jslibs/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-package - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-jslibs-package diff --git a/package/pckgmgr/pom.xml b/package/pckgmgr/pom.xml index 59615035a..051ce2482 100644 --- a/package/pckgmgr/pom.xml +++ b/package/pckgmgr/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-package - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-pckgmgr-bundle diff --git a/package/pom.xml b/package/pom.xml index 7ebfedd12..53752b8a3 100644 --- a/package/pom.xml +++ b/package/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-package diff --git a/package/setup/bundle/pom.xml b/package/setup/bundle/pom.xml index 29b44768e..768711e6b 100644 --- a/package/setup/bundle/pom.xml +++ b/package/setup/bundle/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes.setup composum-nodes-package-setup - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-package-setup-bundle diff --git a/package/setup/hook/pom.xml b/package/setup/hook/pom.xml index 41f94ef03..3dae117ab 100644 --- a/package/setup/hook/pom.xml +++ b/package/setup/hook/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes.setup composum-nodes-package-setup - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-package-setup-hook diff --git a/package/setup/pom.xml b/package/setup/pom.xml index d19c6bddb..45b3018c1 100644 --- a/package/setup/pom.xml +++ b/package/setup/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-package - 4.2.3 + 4.2.4-SNAPSHOT com.composum.nodes.setup diff --git a/package/sling/pom.xml b/package/sling/pom.xml index 66a6f6f91..0a617e92b 100644 --- a/package/sling/pom.xml +++ b/package/sling/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-package - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-sling-package diff --git a/package/usermgr/pom.xml b/package/usermgr/pom.xml index 5b7107572..d4f3c1065 100644 --- a/package/usermgr/pom.xml +++ b/package/usermgr/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-package - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-usermgr-bundle diff --git a/pckgmgr/pom.xml b/pckgmgr/pom.xml index 5d36d4dd3..275167095 100644 --- a/pckgmgr/pom.xml +++ b/pckgmgr/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-pckgmgr diff --git a/pom.xml b/pom.xml index 9be999730..a36e83c6f 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ com.composum.nodes composum-nodes - 4.2.3 + 4.2.4-SNAPSHOT pom Composum Nodes @@ -31,7 +31,7 @@ scm:git:https://github.com/ist-dresden/composum.git scm:git:https://github.com/ist-dresden/composum.git https://github.com/ist-dresden/composum.git - composum-nodes-4.2.3 + composum-nodes-3.4.3 diff --git a/setup/pom.xml b/setup/pom.xml index bb65951d0..cad8d9a6f 100644 --- a/setup/pom.xml +++ b/setup/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.2.3 + 4.2.4-SNAPSHOT com.composum.nodes.setup diff --git a/setup/slingfeature/pom.xml b/setup/slingfeature/pom.xml index 26fb01cd7..217c07a20 100644 --- a/setup/slingfeature/pom.xml +++ b/setup/slingfeature/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes.setup composum-nodes-setup - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-slingfeature diff --git a/setup/util/pom.xml b/setup/util/pom.xml index 56cca4941..860971677 100644 --- a/setup/util/pom.xml +++ b/setup/util/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes.setup composum-nodes-setup - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-setup-util diff --git a/test/pom.xml b/test/pom.xml index 1ced40349..f9b12b6ec 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.2.3 + 4.2.4-SNAPSHOT com.composum.nodes.test diff --git a/usermgr/pom.xml b/usermgr/pom.xml index c2c518c5c..edc10cae7 100644 --- a/usermgr/pom.xml +++ b/usermgr/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-usermgr diff --git a/xtracts/debugutil/pom.xml b/xtracts/debugutil/pom.xml index 37e754f84..86e8a1402 100644 --- a/xtracts/debugutil/pom.xml +++ b/xtracts/debugutil/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.2.3 + 4.2.4-SNAPSHOT ../../pom.xml diff --git a/xtracts/pom.xml b/xtracts/pom.xml index 8d8ffed44..b4541664a 100644 --- a/xtracts/pom.xml +++ b/xtracts/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-xtracts diff --git a/xtracts/users-graph/bundle/pom.xml b/xtracts/users-graph/bundle/pom.xml index cb03deb98..132fbecfa 100644 --- a/xtracts/users-graph/bundle/pom.xml +++ b/xtracts/users-graph/bundle/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-users-graph - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-users-graph-bundle diff --git a/xtracts/users-graph/package/pom.xml b/xtracts/users-graph/package/pom.xml index 52b91f37d..41845341b 100644 --- a/xtracts/users-graph/package/pom.xml +++ b/xtracts/users-graph/package/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-users-graph - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-users-graph-package diff --git a/xtracts/users-graph/pom.xml b/xtracts/users-graph/pom.xml index a8aa5e80e..d1c39b636 100644 --- a/xtracts/users-graph/pom.xml +++ b/xtracts/users-graph/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-xtracts - 4.2.3 + 4.2.4-SNAPSHOT composum-nodes-users-graph From 62a44f8c375360a38b1d96fe8f26528ad7a641c7 Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Thu, 7 Dec 2023 16:50:45 +0100 Subject: [PATCH 02/71] add 'search by node name' predefined query --- .../libs/composum/nodes/browser/query/templates.json | 10 ++++++++++ test/pom.xml | 1 + 2 files changed, 11 insertions(+) diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/query/templates.json b/console/src/main/resources/root/libs/composum/nodes/browser/query/templates.json index 7fa201907..4339fc18a 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/query/templates.json +++ b/console/src/main/resources/root/libs/composum/nodes/browser/query/templates.json @@ -65,5 +65,15 @@ "order": 150, "jcr:description": "\u003cp\u003eis searching for a node with a specific uuid\u003c/p\u003e", "xpath": "/jcr:root//*[@jcr:uuid\u003d\u0027${uuid}\u0027]" + }, + "by-nodename": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "composum/nodes/browser/query/template", + "jcr:title": "search by node name", + "group": "Nodes", + "order": 170, + "jcr:description": "\u003cp\u003eis searching for a node with a name matching a pattern with % as placeholder\u003c/p\u003e", + "sql2": "SELECT * FROM [nt:base] AS node WHERE ISDESCENDANTNODE(node, '${root_path.path}') AND NAME(node) LIKE '${nodenamepattern}'", + "xpath": "/jcr:root${root_path.path}//element(*, nt:base)[jcr:like(fn:name(), \u0027${namepattern}\u0027)]" } } diff --git a/test/pom.xml b/test/pom.xml index f9b12b6ec..ca7587cce 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -28,6 +28,7 @@ + hp.stoerr Hans-Peter Störr hp.stoerr@ist-software.com IST GmbH Dresden From a4319a12f2a8e9c7441fdb7d6c9013c463350c4b Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Thu, 7 Dec 2023 17:08:32 +0100 Subject: [PATCH 03/71] closes #308 set master branch automatically after release --- .github/workflows/createerelease.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/createerelease.yml b/.github/workflows/createerelease.yml index b40d40656..ee48fc589 100644 --- a/.github/workflows/createerelease.yml +++ b/.github/workflows/createerelease.yml @@ -177,6 +177,15 @@ jobs: pwd $MVNCMD nexus-staging:drop + - name: Set master branch to released version + if: ${{ github.event.inputs.dryrun == 'false' }} + run: | + # we are now at the "prepare for next development iteration" commit, the commit with the release is the previous one. + # We need to set the master branch to that commit, and then push it. + git branch temp develop~1 + git push origin temp:master + git branch -d temp + - name: List target files even if recipe fails if: always() run: | From 4ee43600594d72d0256534365539d7921a827f6a Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Thu, 7 Dec 2023 18:13:10 +0100 Subject: [PATCH 04/71] closes #316 return all restrictions if there are multiple restrictions --- .../com/composum/sling/nodes/servlet/SecurityServlet.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/console/src/main/java/com/composum/sling/nodes/servlet/SecurityServlet.java b/console/src/main/java/com/composum/sling/nodes/servlet/SecurityServlet.java index 3375ff979..737f1ec9c 100644 --- a/console/src/main/java/com/composum/sling/nodes/servlet/SecurityServlet.java +++ b/console/src/main/java/com/composum/sling/nodes/servlet/SecurityServlet.java @@ -500,8 +500,10 @@ protected void writeRestrictions(JsonWriter writer, JackrabbitAccessControlEntry writer.name("restrictions").beginArray(); for (String name : restrictionNames) { try { - Value value = entry.getRestriction(name); - writer.value(name + "=" + (value != null ? value.toString() : "")); + Value[] restrictions = entry.getRestrictions(name); + for (Value restriction : restrictions) { + writer.value(name + "=" + (restriction != null ? restriction.toString() : "")); + } } catch (Exception ex) { writer.value(name + ":" + ex.toString()); } From f35f1a7e1e134d627a3ac765c3b5139ecdb8d9e8 Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Wed, 20 Dec 2023 16:25:39 +0100 Subject: [PATCH 05/71] very raw frame for initial caconfig view --- .gitignore | 2 - .../sling/nodes/components/CAConfigModel.java | 29 ++++++++ .../nodes/browser/components/caconfig.json | 4 ++ .../browser/components/caconfig/caconfig.jsp | 13 ++++ .../browser/components/caconfig/content.jsp | 8 +++ .../browser/components/caconfig/toolbar.jsp | 12 ++++ .../composum/nodes/browser/tabs/caconfig.jsp | 5 ++ .../composum/nodes/browser/views/std/tabs.jsp | 3 + features/HowtoCreateBrowserView.md | 5 ++ features/README.md | 3 + features/SlingContextAwareConfiguration.md | 66 +++++++++++++++++++ 11 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java create mode 100644 console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig.json create mode 100644 console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/caconfig.jsp create mode 100644 console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp create mode 100644 console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/toolbar.jsp create mode 100644 console/src/main/resources/root/libs/composum/nodes/browser/tabs/caconfig.jsp create mode 100644 features/HowtoCreateBrowserView.md create mode 100644 features/README.md create mode 100644 features/SlingContextAwareConfiguration.md diff --git a/.gitignore b/.gitignore index 90c96f053..7578915e6 100644 --- a/.gitignore +++ b/.gitignore @@ -16,8 +16,6 @@ Servers build # Maven target -# Groovy -.groovy # some source repos .svn # File Vault diff --git a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java new file mode 100644 index 000000000..f67d8e790 --- /dev/null +++ b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java @@ -0,0 +1,29 @@ +package com.composum.sling.nodes.components; + +import org.apache.sling.api.resource.Resource; + +import com.composum.sling.core.BeanContext; +import com.composum.sling.core.Restricted; +import com.composum.sling.nodes.console.ConsoleServletBean; +import com.composum.sling.nodes.servlet.NodeServlet; + +@Restricted(key = NodeServlet.SERVICE_KEY) +public class CAConfigModel extends ConsoleServletBean { + + public CAConfigModel(BeanContext context, Resource resource) { + super(context, resource); + } + + public CAConfigModel(BeanContext context) { + super(context); + } + + public CAConfigModel() { + super(); + } + + public String getHallo() { + return "Hello there from the model!"; + } + +} diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig.json b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig.json new file mode 100644 index 000000000..8880dae25 --- /dev/null +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig.json @@ -0,0 +1,4 @@ +{ + "jcr:primaryType": "sling:Folder", + "sling:resourceType": "composum/nodes/browser/components/caconfig" +} diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/caconfig.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/caconfig.jsp new file mode 100644 index 000000000..47347a3ee --- /dev/null +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/caconfig.jsp @@ -0,0 +1,13 @@ +<%@page session="false" pageEncoding="utf-8" %> +<%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> +<%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +
+ +
+ +
+
+
diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp new file mode 100644 index 000000000..b6401d07a --- /dev/null +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp @@ -0,0 +1,8 @@ +<%@page session="false" pageEncoding="utf-8" %> +<%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> +<%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + ${model.hallo} + diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/toolbar.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/toolbar.jsp new file mode 100644 index 000000000..5c54d8e96 --- /dev/null +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/toolbar.jsp @@ -0,0 +1,12 @@ +<%@page session="false" pageEncoding="utf-8" %> +<%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> +<%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> + +
+
+ +
+
diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/tabs/caconfig.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/tabs/caconfig.jsp new file mode 100644 index 000000000..f47d10a96 --- /dev/null +++ b/console/src/main/resources/root/libs/composum/nodes/browser/tabs/caconfig.jsp @@ -0,0 +1,5 @@ +<%@page session="false" pageEncoding="utf-8" %> +<%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> +<%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> + + diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/views/std/tabs.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/views/std/tabs.jsp index 913e0371f..b101baa82 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/views/std/tabs.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/views/std/tabs.jsp @@ -28,4 +28,7 @@ title="${cpn:i18n(slingRequest,'Versions')}">${cpn:i18n(slingRequest,'Versions')} + ${cpn:i18n(slingRequest,'CA Config')} diff --git a/features/HowtoCreateBrowserView.md b/features/HowtoCreateBrowserView.md new file mode 100644 index 000000000..38b76026e --- /dev/null +++ b/features/HowtoCreateBrowserView.md @@ -0,0 +1,5 @@ +# Tipps how to create a new browser view + +- The corresponding components are here: console/src/main/resources/root/libs/composum/nodes/browser/components . references is the last component that is best used as a reference. +- In console/src/main/resources/root/libs/composum/nodes/browser/views/std/tabs.jsp the new view is added to the tabs. +- console/src/main/resources/root/libs/composum/nodes/browser/tabs needs an entry for the new view, which just should include the component (compare references.jsp) diff --git a/features/README.md b/features/README.md new file mode 100644 index 000000000..f1d2da0fe --- /dev/null +++ b/features/README.md @@ -0,0 +1,3 @@ +# Nodes Features Documentation + +This directory contains some documentation about new features for Nodes. diff --git a/features/SlingContextAwareConfiguration.md b/features/SlingContextAwareConfiguration.md new file mode 100644 index 000000000..1d5a6a622 --- /dev/null +++ b/features/SlingContextAwareConfiguration.md @@ -0,0 +1,66 @@ +# Editor for Sling Context-Aware Configuration + +## Links + +https://sling.apache.org/documentation/bundles/context-aware-configuration/context-aware-configuration-default-implementation.html + +## Background + +In the Composum Browser, it's possible to select a resource in the JCR resource tree on the left. On the right, there +are various view tabs that can be selected. One of them will be the CAConfig view. A view tab typically has an action +bar on top with several buttons, and then the view content. If actions in the action bar apply to one or more items from +the view content, the view content typically has radio buttons or checkboxes to select the items the action applies to, +and then the action bar buttons are enabled and apply to the selected items. For operations that need parameters a +dialog is opened. Goal of this specification is to define the new views and the actions in the action bar for the +CAConfig view depending on the resource type, and the dialogs that are opened for the operations if necessary. + +## Basic idea for the feature + +We want to integrate viewing and editing of Sling Context-Aware Configuration (CAConfiguration) into the Composum Nodes +Browser. +One tension that plays a role here is that the browser is focused on editing a specific JCR resource, while the +CAConfiguration resolution is dependent on the resource and it's parent resources and the tree of the actual +configurations at /conf that is referred from the resource and / or it's parents. +Also, the editor should use the metadata from the `ConfigurationManager` to provide a good editing experience, and +perhaps validation. +The editor should represent and allow the user to edit the inheritance done through the attributes +sling:configCollectionInherit or sling:configPropertyInherit. + +The editor is implemented as an additional view "CAConfig" for the resource in the browser, which has different modi. +There are the following types of resources, which have different views: + +1. resources outside /conf, the configuration fallbacks /apps/conf and /libs/conf and /content: the view should not be + shown at all. +2. resources in /content: this is a readonly view what the configuration of the resource is, as taken from the hierarchy + in /conf observing inheritance etc. Editing is only possible on the configuration resources in /conf. + +For resources in /conf//sling:configs, /apps/conf//sling:configs and /libs/conf//sling:configs : + +3. sling:configs node +4. sling:configs/x.y.z.config for collections +5. sling:configs/x.y.z.config node for non-collections +6. sling:configs/x.y.z.config/subnode for collections + +## Supported operations + +The editor should support the following operations: + +- create / update / delete a configuration +- create / update / delete a configuration collection +- go from a resource in /content to the configuration resource in /conf . The hierarchy of offered configuration + resources is determined by the `ConfigurationManager` service. +- (possibly) create a new configuration resource in /conf that is more specific than currently existing ones, and + possibly also create the parent resources in /conf that are needed for this. (Likely that needs an assumed pattern: + /conf/{path} for /content/{path}, and we add a sling:configRef attribute.); +- setting sling:configPropertyInherit / sling:configCollectionInherit attributes for configurations. + +## Basic implementation decisions + +For resources in /content the configuration editor is read only - there is no button to add/delete/update a +configuration. It just offers to go to the relevant /conf resource, and there you have the buttons to add/delete/update. + +## User stories + + + +PROMPT: print a possible continuation of this specfication from here. From 9e1d6175fee3fc0a075632b8020f97a7d9bb432a Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Thu, 21 Dec 2023 17:04:31 +0100 Subject: [PATCH 06/71] raw partial display of configuration --- console/pom.xml | 8 ++ .../sling/nodes/components/CAConfigModel.java | 79 ++++++++++++++++++- .../browser/components/caconfig/content.jsp | 70 +++++++++++++++- features/SlingContextAwareConfiguration.md | 8 +- 4 files changed, 161 insertions(+), 4 deletions(-) diff --git a/console/pom.xml b/console/pom.xml index 224bb5581..fa725117a 100644 --- a/console/pom.xml +++ b/console/pom.xml @@ -222,6 +222,14 @@ org.apache.sling org.apache.sling.discovery.api + + org.apache.sling + org.apache.sling.caconfig.api + + + org.apache.sling + org.apache.sling.caconfig.impl + diff --git a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java index f67d8e790..676322625 100644 --- a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java +++ b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java @@ -1,6 +1,19 @@ package com.composum.sling.nodes.components; +import static java.util.Objects.requireNonNull; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.SortedSet; +import java.util.stream.Collectors; + import org.apache.sling.api.resource.Resource; +import org.apache.sling.caconfig.management.ConfigurationData; +import org.apache.sling.caconfig.management.ConfigurationManager; +import org.apache.sling.caconfig.management.ValueInfo; +import org.apache.sling.caconfig.spi.metadata.ConfigurationMetadata; import com.composum.sling.core.BeanContext; import com.composum.sling.core.Restricted; @@ -10,6 +23,8 @@ @Restricted(key = NodeServlet.SERVICE_KEY) public class CAConfigModel extends ConsoleServletBean { + protected ConfigurationManager configurationManager; + public CAConfigModel(BeanContext context, Resource resource) { super(context, resource); } @@ -22,8 +37,68 @@ public CAConfigModel() { super(); } - public String getHallo() { - return "Hello there from the model!"; + protected ConfigurationManager getConfigurationManager() { + if (configurationManager == null) { + configurationManager = context.getService(ConfigurationManager.class); + } + return configurationManager; + } + + /** + * Returns all configuration metadata. + */ + public List getAllMetaData() { + SortedSet names = getConfigurationManager().getConfigurationNames(); + return names.stream() + .map(name -> getConfigurationManager().getConfigurationMetadata(name)) + .collect(Collectors.toList()); + } + + public List getSingletonConfigurations() { + SortedSet names = getConfigurationManager().getConfigurationNames(); + return names.stream() + .filter(name -> + requireNonNull(getConfigurationManager().getConfigurationMetadata(name)).isSingleton()) + .map(SingletonConfigInfo::new) + .collect(Collectors.toList()); + } + + public class SingletonConfigInfo { + + protected final ConfigurationData configurationData; + protected final String name; + protected final ConfigurationMetadata metadata; + protected final List> valueInfos = new ArrayList<>(); + + public SingletonConfigInfo(String name) { + this.name = name; + this.metadata = getConfigurationManager().getConfigurationMetadata(name); + this.configurationData = getConfigurationManager().getConfiguration(resource, name); + + for (String propertyName : configurationData.getPropertyNames()) { + ValueInfo valueInfo = configurationData.getValueInfo(propertyName); + valueInfos.add(valueInfo); + } + Collections.sort(valueInfos, + Comparator.comparing(valueInfo -> valueInfo.getPropertyMetadata().getOrder())); + } + + public ConfigurationData getConfigurationData() { + return configurationData; + } + + public String getName() { + return name; + } + + public ConfigurationMetadata getMetadata() { + return metadata; + } + + public List> getValueInfos() { + return valueInfos; + } + } } diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp index b6401d07a..d4431ac21 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp @@ -3,6 +3,74 @@ <%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<% + try { +%> - ${model.hallo} + <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> + <%-- +
    + +
  • + ${meta.label} : ${meta.description} +
      + +
    • + ${prop.key} : ${prop.value} +
    • +
      +
    +
      + +
    • + ${propMeta.key} : ${propMeta.value} +
    • +
      +
    +
  • +
    +
+ --%> +
+ + <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> +
${config.metadata.label} ( ${config.name} ) : ${config.metadata.description} + ${config.configurationData.resourcePath} +
+
+
+ +
${propInfo.propertyMetadata.label} = ${propInfo.value}
+
+
+
description
+
${propInfo.propertyMetadata.description}
+
props
+
${propInfo.propertyMetadata.properties}
+
default
+
${propInfo.propertyMetadata.defaultValue}
+
default2
+
${propInfo.default}
+
cfgsrc
+
${propInfo.configSourcePath}
+
effval
+
${propInfo.effectiveValue}
+
inh
+
${propInfo.inherited}
+
overr
+
${propInfo.overridden}
+
name
+
${propInfo.name}
+
+
+
+
+
+
+
+<% + } catch (Exception ex) { + ex.printStackTrace(response.getWriter()); + } +%> diff --git a/features/SlingContextAwareConfiguration.md b/features/SlingContextAwareConfiguration.md index 1d5a6a622..e97ba065d 100644 --- a/features/SlingContextAwareConfiguration.md +++ b/features/SlingContextAwareConfiguration.md @@ -63,4 +63,10 @@ configuration. It just offers to go to the relevant /conf resource, and there yo -PROMPT: print a possible continuation of this specfication from here. +PROMPT: print a possible continuation of this specification from here, ignoring the lines below. + +## Debugging + +### Some JCR Queries + +- /jcr:root/content//*[@sling:configRef] From ec7b6496fa3643b0583bca442ba3a192abb03b7c Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Thu, 21 Dec 2023 17:47:18 +0100 Subject: [PATCH 07/71] display collections as well --- .../sling/nodes/components/CAConfigModel.java | 57 ++++++++-- .../browser/components/caconfig/content.jsp | 106 ++++++++++++------ 2 files changed, 117 insertions(+), 46 deletions(-) diff --git a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java index 676322625..cc1120d57 100644 --- a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java +++ b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java @@ -10,6 +10,7 @@ import java.util.stream.Collectors; import org.apache.sling.api.resource.Resource; +import org.apache.sling.caconfig.management.ConfigurationCollectionData; import org.apache.sling.caconfig.management.ConfigurationData; import org.apache.sling.caconfig.management.ConfigurationManager; import org.apache.sling.caconfig.management.ValueInfo; @@ -59,28 +60,55 @@ public List getSingletonConfigurations() { return names.stream() .filter(name -> requireNonNull(getConfigurationManager().getConfigurationMetadata(name)).isSingleton()) - .map(SingletonConfigInfo::new) + .map(name -> + new SingletonConfigInfo(name, getConfigurationManager().getConfiguration(resource, name))) .collect(Collectors.toList()); } + public List getCollectionConfigurations() { + SortedSet names = getConfigurationManager().getConfigurationNames(); + return names.stream() + .filter(name -> + requireNonNull(getConfigurationManager().getConfigurationMetadata(name)).isCollection()) + .map(name -> new CollectionConfigInfo(getConfigurationManager().getConfigurationCollection(resource, name))) + .collect(Collectors.toList()); + } + + public class CollectionConfigInfo { + + protected final ConfigurationCollectionData collectionConfigData; + protected final ConfigurationMetadata metadata; + + public CollectionConfigInfo(ConfigurationCollectionData configurationCollection) { + this.collectionConfigData = configurationCollection; + this.metadata = getConfigurationManager().getConfigurationMetadata(collectionConfigData.getConfigName()); + } + + public ConfigurationCollectionData getCollectionConfigData() { + return collectionConfigData; + } + + public ConfigurationMetadata getMetadata() { + return metadata; + } + + public List getConfigs() { + return collectionConfigData.getItems().stream() + .map(item -> new SingletonConfigInfo(collectionConfigData.getConfigName(), item)) + .collect(Collectors.toList()); + } + } + public class SingletonConfigInfo { protected final ConfigurationData configurationData; protected final String name; protected final ConfigurationMetadata metadata; - protected final List> valueInfos = new ArrayList<>(); - public SingletonConfigInfo(String name) { + public SingletonConfigInfo(String name, ConfigurationData configurationData) { this.name = name; this.metadata = getConfigurationManager().getConfigurationMetadata(name); - this.configurationData = getConfigurationManager().getConfiguration(resource, name); - - for (String propertyName : configurationData.getPropertyNames()) { - ValueInfo valueInfo = configurationData.getValueInfo(propertyName); - valueInfos.add(valueInfo); - } - Collections.sort(valueInfos, - Comparator.comparing(valueInfo -> valueInfo.getPropertyMetadata().getOrder())); + this.configurationData = configurationData; } public ConfigurationData getConfigurationData() { @@ -96,6 +124,13 @@ public ConfigurationMetadata getMetadata() { } public List> getValueInfos() { + List> valueInfos = new ArrayList<>(); + for (String propertyName : configurationData.getPropertyNames()) { + ValueInfo valueInfo = configurationData.getValueInfo(propertyName); + valueInfos.add(valueInfo); + } + Collections.sort(valueInfos, + Comparator.comparing(valueInfo -> valueInfo.getPropertyMetadata().getOrder())); return valueInfos; } diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp index d4431ac21..cba8790f4 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp @@ -31,43 +31,79 @@ --%> -
- + + <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> +
+ ${config.metadata.label} ( ${config.name} ) : ${config.metadata.description} + from ${config.configurationData.resourcePath} +
+ +
${propInfo.propertyMetadata.label} = ${propInfo.value}
+
+
+
description
+
${propInfo.propertyMetadata.description}
+
props
+
${propInfo.propertyMetadata.properties}
+
default
+
${propInfo.propertyMetadata.defaultValue}
+
default2
+
${propInfo.default}
+
cfgsrc
+
${propInfo.configSourcePath}
+
effval
+
${propInfo.effectiveValue}
+
inh
+
${propInfo.inherited}
+
overr
+
${propInfo.overridden}
+
name
+
${propInfo.name}
+
+
+
+
+
+
+ Collections +
+ + <%--@elvariable id="collection" type="com.composum.sling.nodes.components.CAConfigModel.CollectionConfigInfo"--%> +
+ ${collection.metadata.label} ( ${collection.collectionConfigData.configName} ) : ${collection.metadata.description} + props ${collection.collectionConfigData.properties} + <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> -
${config.metadata.label} ( ${config.name} ) : ${config.metadata.description} - ${config.configurationData.resourcePath} -
-
-
- -
${propInfo.propertyMetadata.label} = ${propInfo.value}
-
-
-
description
-
${propInfo.propertyMetadata.description}
-
props
-
${propInfo.propertyMetadata.properties}
-
default
-
${propInfo.propertyMetadata.defaultValue}
-
default2
-
${propInfo.default}
-
cfgsrc
-
${propInfo.configSourcePath}
-
effval
-
${propInfo.effectiveValue}
-
inh
-
${propInfo.inherited}
-
overr
-
${propInfo.overridden}
-
name
-
${propInfo.name}
-
-
-
-
-
+ from ${config.configurationData.resourcePath} +
+ +
${propInfo.propertyMetadata.label} = ${propInfo.value}
+
+
+
description
+
${propInfo.propertyMetadata.description}
+
props
+
${propInfo.propertyMetadata.properties}
+
default
+
${propInfo.propertyMetadata.defaultValue}
+
default2
+
${propInfo.default}
+
cfgsrc
+
${propInfo.configSourcePath}
+
effval
+
${propInfo.effectiveValue}
+
inh
+
${propInfo.inherited}
+
overr
+
${propInfo.overridden}
+
name
+
${propInfo.name}
+
+
+
+
-
+ <% } catch (Exception ex) { From fa45364a3ae3fcdcb9f40b1cb93cfbc3214bdade Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Thu, 21 Dec 2023 19:23:11 +0100 Subject: [PATCH 08/71] moving towards bootstrap design --- .../browser/components/caconfig/content.jsp | 165 +++++++++++------- 1 file changed, 101 insertions(+), 64 deletions(-) diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp index cba8790f4..4c6539589 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp @@ -33,76 +33,113 @@ --%> <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> -
- ${config.metadata.label} ( ${config.name} ) : ${config.metadata.description} - from ${config.configurationData.resourcePath} -
- -
${propInfo.propertyMetadata.label} = ${propInfo.value}
-
+
+
+

${config.metadata.label} ( ${config.name} )

+
+
+
+
+

${config.metadata.description}

+

Configuration location: ${config.configurationData.resourcePath}

+
+
+
+
-
description
-
${propInfo.propertyMetadata.description}
-
props
-
${propInfo.propertyMetadata.properties}
-
default
-
${propInfo.propertyMetadata.defaultValue}
-
default2
-
${propInfo.default}
-
cfgsrc
-
${propInfo.configSourcePath}
-
effval
-
${propInfo.effectiveValue}
-
inh
-
${propInfo.inherited}
-
overr
-
${propInfo.overridden}
-
name
-
${propInfo.name}
+ +
${propInfo.propertyMetadata.label} = ${propInfo.value}
+
+
+
description
+
${propInfo.propertyMetadata.description}
+
props
+
${propInfo.propertyMetadata.properties}
+
default
+
${propInfo.propertyMetadata.defaultValue}
+
default2
+
${propInfo.default}
+
cfgsrc
+
${propInfo.configSourcePath}
+
effval
+
${propInfo.effectiveValue}
+
inh
+
${propInfo.inherited}
+
overr
+
${propInfo.overridden}
+
name
+
${propInfo.name}
+
+
+
-
-
-
+ + + +
-
- Collections -
+ <%--@elvariable id="collection" type="com.composum.sling.nodes.components.CAConfigModel.CollectionConfigInfo"--%> -
- ${collection.metadata.label} ( ${collection.collectionConfigData.configName} ) : ${collection.metadata.description} - props ${collection.collectionConfigData.properties} - - <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> - from ${config.configurationData.resourcePath} -
- -
${propInfo.propertyMetadata.label} = ${propInfo.value}
-
-
-
description
-
${propInfo.propertyMetadata.description}
-
props
-
${propInfo.propertyMetadata.properties}
-
default
-
${propInfo.propertyMetadata.defaultValue}
-
default2
-
${propInfo.default}
-
cfgsrc
-
${propInfo.configSourcePath}
-
effval
-
${propInfo.effectiveValue}
-
inh
-
${propInfo.inherited}
-
overr
-
${propInfo.overridden}
-
name
-
${propInfo.name}
-
-
+
+
+

${collection.metadata.label} ( ${collection.collectionConfigData.configName} )

+
+
+
+
+

${collection.metadata.description}

+
+
+
+
+ + <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> +
+
+
+ ${config.configurationData.collectionItemName} +
+
+
+
+

from ${config.configurationData.resourcePath}

+
+
+
+
+ +
${propInfo.propertyMetadata.label} = ${propInfo.value}
+
+
+
description
+
${propInfo.propertyMetadata.description}
+
props
+
${propInfo.propertyMetadata.properties}
+
default
+
${propInfo.propertyMetadata.defaultValue}
+
default2
+
${propInfo.default}
+
cfgsrc
+
${propInfo.configSourcePath}
+
effval
+
${propInfo.effectiveValue}
+
inh
+
${propInfo.inherited}
+
overr
+
${propInfo.overridden}
+
name
+
${propInfo.name}
+
+
+
+
+
+
-
-
+ +
<% From b6406439ec06ef8e557308f3c8d57d629ebe140d Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Fri, 22 Dec 2023 11:04:31 +0100 Subject: [PATCH 09/71] partial layout of single configurations --- .../sling/nodes/components/CAConfigModel.java | 10 +- .../browser/components/caconfig/content.jsp | 139 ++++++++++++++---- 2 files changed, 117 insertions(+), 32 deletions(-) diff --git a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java index cc1120d57..607ce259b 100644 --- a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java +++ b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java @@ -126,11 +126,15 @@ public ConfigurationMetadata getMetadata() { public List> getValueInfos() { List> valueInfos = new ArrayList<>(); for (String propertyName : configurationData.getPropertyNames()) { - ValueInfo valueInfo = configurationData.getValueInfo(propertyName); - valueInfos.add(valueInfo); + if (!propertyName.startsWith("jcr:") && !propertyName.startsWith("sling:")) { + ValueInfo valueInfo = configurationData.getValueInfo(propertyName); + valueInfos.add(valueInfo); + } } Collections.sort(valueInfos, - Comparator.comparing(valueInfo -> valueInfo.getPropertyMetadata().getOrder())); + Comparator.comparingInt(valueInfo -> + valueInfo.getPropertyMetadata() != null ? valueInfo.getPropertyMetadata().getOrder() : Integer.MAX_VALUE + )); return valueInfos; } diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp index 4c6539589..e7073420b 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp @@ -1,8 +1,27 @@ +<%@ page import="java.io.PrintWriter" %> +<%@ page import="org.apache.sling.caconfig.management.ValueInfo" %> <%@page session="false" pageEncoding="utf-8" %> <%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> <%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%! + String renderAsStringOrArray(Object valueInfo) { + Object object = ((ValueInfo) valueInfo).getEffectiveValue(); + if (Object[].class.isAssignableFrom(object.getClass())) { + StringBuilder builder = new StringBuilder(); + for (Object item : (Object[]) object) { + if (builder.length() > 0) { + builder.append("
"); + } + builder.append(item); + } + return builder.toString(); + } else { + return object.toString(); + } + } +%> <% try { %> @@ -35,44 +54,92 @@ <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%>
-

${config.metadata.label} ( ${config.name} )

+

${config.metadata.label} ( ${config.name} ) + <%-- --%> +

${config.metadata.description}

-

Configuration location: ${config.configurationData.resourcePath}

+

Configuration location: ${config.configurationData.resourcePath} +

-
+ + + + + + + + + + + + -
${propInfo.propertyMetadata.label} = ${propInfo.value}
-
-
-
description
-
${propInfo.propertyMetadata.description}
-
props
-
${propInfo.propertyMetadata.properties}
-
default
-
${propInfo.propertyMetadata.defaultValue}
-
default2
-
${propInfo.default}
-
cfgsrc
-
${propInfo.configSourcePath}
-
effval
-
${propInfo.effectiveValue}
-
inh
-
${propInfo.inherited}
-
overr
-
${propInfo.overridden}
-
name
-
${propInfo.name}
-
-
+
+ + + + + + - + +
PropertyLabelValue
${propInfo.name} + ${propInfo.propertyMetadata.label} + + + + + + + + + + + <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> +
+ <%--
+ +
${propInfo.propertyMetadata.label} = ${propInfo.value}
+
+
+
description
+
${propInfo.propertyMetadata.description}
+
props
+
${propInfo.propertyMetadata.properties}
+
default
+
${propInfo.propertyMetadata.defaultValue}
+
default2
+
${propInfo.default}
+
cfgsrc
+
${propInfo.configSourcePath}
+
effval
+
${propInfo.effectiveValue}
+
inh
+
${propInfo.inherited}
+
overr
+
${propInfo.overridden}
+
name
+
${propInfo.name}
+
+
+
+
+ --%>
@@ -89,6 +156,11 @@

${collection.metadata.description}

+

Collection location: + ${collection.collectionConfigData.resourcePath} +

@@ -104,7 +176,12 @@
-

from ${config.configurationData.resourcePath}

+

Configuration location: + + ${config.configurationData.resourcePath} + +

@@ -144,6 +221,10 @@ <% } catch (Exception ex) { - ex.printStackTrace(response.getWriter()); + log.error(ex.toString(), ex); + PrintWriter writer = response.getWriter(); + writer.println("
");
+        ex.printStackTrace(writer);
+        writer.println("
"); } %> From 2e34ab6f0d2f0fafdd40c8426eee2fd42a61b58b Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Fri, 22 Dec 2023 15:22:51 +0100 Subject: [PATCH 10/71] only show ca view where it is appropriate --- .../java/com/composum/sling/nodes/browser/Browser.java | 4 ++++ .../root/libs/composum/nodes/browser/views/std/tabs.jsp | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/console/src/main/java/com/composum/sling/nodes/browser/Browser.java b/console/src/main/java/com/composum/sling/nodes/browser/Browser.java index ca192df4c..69bbff39c 100644 --- a/console/src/main/java/com/composum/sling/nodes/browser/Browser.java +++ b/console/src/main/java/com/composum/sling/nodes/browser/Browser.java @@ -771,6 +771,10 @@ public boolean isVersionable() { } } + public boolean isCaConfigRelevant() { + return resource.getPath().startsWith("/content") || resource.getPath().contains("sling:configs"); + } + public static final Pattern SETUP_SCRIPT_PATTERN = Pattern.compile(".*[\"']?acl[\"']?\\s*:\\s*[\\[{].*", Pattern.MULTILINE | Pattern.DOTALL); diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/views/std/tabs.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/views/std/tabs.jsp index b101baa82..e224ed8d2 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/views/std/tabs.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/views/std/tabs.jsp @@ -28,7 +28,9 @@ title="${cpn:i18n(slingRequest,'Versions')}">${cpn:i18n(slingRequest,'Versions')} - ${cpn:i18n(slingRequest,'CA Config')} + + ${cpn:i18n(slingRequest,'CA Config')} + From b4643cfe6063934e618d1951ae865c3458951850 Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Fri, 22 Dec 2023 15:23:30 +0100 Subject: [PATCH 11/71] partial layout for collection configurations --- .../sling/nodes/components/CAConfigModel.java | 33 ++++++ .../browser/components/caconfig/content.jsp | 105 ++++++++++++------ 2 files changed, 107 insertions(+), 31 deletions(-) diff --git a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java index 607ce259b..3bb5929f3 100644 --- a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java +++ b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java @@ -15,6 +15,8 @@ import org.apache.sling.caconfig.management.ConfigurationManager; import org.apache.sling.caconfig.management.ValueInfo; import org.apache.sling.caconfig.spi.metadata.ConfigurationMetadata; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.composum.sling.core.BeanContext; import com.composum.sling.core.Restricted; @@ -24,6 +26,8 @@ @Restricted(key = NodeServlet.SERVICE_KEY) public class CAConfigModel extends ConsoleServletBean { + private static final Logger LOG = LoggerFactory.getLogger(CAConfigModel.class); + protected ConfigurationManager configurationManager; public CAConfigModel(BeanContext context, Resource resource) { @@ -38,6 +42,35 @@ public CAConfigModel() { super(); } + public String getViewType() { + try { + if (getPath().startsWith("/content")) { + return "effectiveConfigurationsView"; + } else if (getPath().matches(".*/sling:configs($|/)]")) { + if (getName().equals("sling:configs")) { + return "listConfigurationsView"; + } else if (getResource().getParent().getName().equals("sling:configs")) { + String configName = getResource().getName(); + ConfigurationMetadata metadata = getConfigurationManager().getConfigurationMetadata(configName); + if (metadata.isCollection()) { + return "collectionView"; + } else { + return "configurationView"; + } + } else if (getResource().getParent().getParent().getName().equals("sling:configs")) { + String configName = getResource().getParent().getName(); + ConfigurationMetadata metadata = getConfigurationManager().getConfigurationMetadata(configName); + if (metadata.isCollection()) { + return "configurationView"; + } + } + } + } catch (RuntimeException e) { + LOG.error("Cannot determine view type for {}", getPath(), e); + } + return null; + } + protected ConfigurationManager getConfigurationManager() { if (configurationManager == null) { configurationManager = context.getService(ConfigurationManager.class); diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp index e7073420b..1d6711293 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp @@ -25,6 +25,8 @@ <% try { %> +

Effective configuration values

+

To edit please go to the configuration locations.

<%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> <%-- @@ -98,12 +100,12 @@ - - - + + + <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> @@ -172,6 +174,7 @@
${config.configurationData.collectionItemName} + (inherited = ${config.configurationData.inherited})
@@ -186,31 +189,71 @@
- -
${propInfo.propertyMetadata.label} = ${propInfo.value}
-
-
-
description
-
${propInfo.propertyMetadata.description}
-
props
-
${propInfo.propertyMetadata.properties}
-
default
-
${propInfo.propertyMetadata.defaultValue}
-
default2
-
${propInfo.default}
-
cfgsrc
-
${propInfo.configSourcePath}
-
effval
-
${propInfo.effectiveValue}
-
inh
-
${propInfo.inherited}
-
overr
-
${propInfo.overridden}
-
name
-
${propInfo.name}
-
-
-
+ + + + + + + + + + + + + + + + + + + + + + +
PropertyLabelValue
${propInfo.name} + ${propInfo.propertyMetadata.label} + + + + + + + + + + + <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> +
+ <%-- +
${propInfo.propertyMetadata.label} = ${propInfo.value}
+
+
+
description
+
${propInfo.propertyMetadata.description}
+
props
+
${propInfo.propertyMetadata.properties}
+
default
+
${propInfo.propertyMetadata.defaultValue}
+
default2
+
${propInfo.default}
+
cfgsrc
+
${propInfo.configSourcePath}
+
effval
+
${propInfo.effectiveValue}
+
inh
+
${propInfo.inherited}
+
overr
+
${propInfo.overridden}
+
name
+
${propInfo.name}
+
+
+
--%>
From 7a8dd315796792e0a81992766d51d00e5715ebba Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Fri, 22 Dec 2023 16:09:32 +0100 Subject: [PATCH 12/71] dispatch views --- .../sling/nodes/components/CAConfigModel.java | 2 +- .../components/caconfig/collectionView.jsp | 24 ++ .../components/caconfig/configurationView.jsp | 24 ++ .../browser/components/caconfig/content.jsp | 267 +---------------- .../caconfig/effectiveConfigurationsView.jsp | 273 ++++++++++++++++++ .../caconfig/listConfigurationsView.jsp | 24 ++ 6 files changed, 347 insertions(+), 267 deletions(-) create mode 100644 console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp create mode 100644 console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp create mode 100644 console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView.jsp create mode 100644 console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp diff --git a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java index 3bb5929f3..b7f1b6647 100644 --- a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java +++ b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java @@ -46,7 +46,7 @@ public String getViewType() { try { if (getPath().startsWith("/content")) { return "effectiveConfigurationsView"; - } else if (getPath().matches(".*/sling:configs($|/)]")) { + } else if (getPath().matches(".*/sling:configs($|/).*")) { if (getName().equals("sling:configs")) { return "listConfigurationsView"; } else if (getResource().getParent().getName().equals("sling:configs")) { diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp new file mode 100644 index 000000000..87d052715 --- /dev/null +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp @@ -0,0 +1,24 @@ +<%@ page import="java.io.PrintWriter" %> +<%@ page import="org.apache.sling.caconfig.management.ValueInfo" %> +<%@page session="false" pageEncoding="utf-8" %> +<%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> +<%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + +<% + try { +%> +

Configuration Collection

+

(TBD: lists the values for the items in this collection + inheritance setting and links to parents)

+ + <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> + +<% + } catch (Exception ex) { + log.error(ex.toString(), ex); + PrintWriter writer = response.getWriter(); + writer.println("
");
+        ex.printStackTrace(writer);
+        writer.println("
"); + } +%> diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp new file mode 100644 index 000000000..2ad16cf38 --- /dev/null +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp @@ -0,0 +1,24 @@ +<%@ page import="java.io.PrintWriter" %> +<%@ page import="org.apache.sling.caconfig.management.ValueInfo" %> +<%@page session="false" pageEncoding="utf-8" %> +<%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> +<%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + +<% + try { +%> +

Configuration Edit

+

(TBD: lists the values this configuration + inheritance settings, possibly links to the parents, everything editable)

+ + <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> + +<% + } catch (Exception ex) { + log.error(ex.toString(), ex); + PrintWriter writer = response.getWriter(); + writer.println("
");
+        ex.printStackTrace(writer);
+        writer.println("
"); + } +%> diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp index 1d6711293..b9cc7ce58 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp @@ -1,273 +1,8 @@ -<%@ page import="java.io.PrintWriter" %> -<%@ page import="org.apache.sling.caconfig.management.ValueInfo" %> <%@page session="false" pageEncoding="utf-8" %> <%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> <%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> -<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%! - String renderAsStringOrArray(Object valueInfo) { - Object object = ((ValueInfo) valueInfo).getEffectiveValue(); - if (Object[].class.isAssignableFrom(object.getClass())) { - StringBuilder builder = new StringBuilder(); - for (Object item : (Object[]) object) { - if (builder.length() > 0) { - builder.append("
"); - } - builder.append(item); - } - return builder.toString(); - } else { - return object.toString(); - } - } -%> -<% - try { -%> -

Effective configuration values

-

To edit please go to the configuration locations.

<%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> - <%-- -
    - -
  • - ${meta.label} : ${meta.description} -
      - -
    • - ${prop.key} : ${prop.value} -
    • -
      -
    -
      - -
    • - ${propMeta.key} : ${propMeta.value} -
    • -
      -
    -
  • -
    -
- --%> - - <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> -
-
-

${config.metadata.label} ( ${config.name} ) - <%-- --%> -

-
-
-
-
-

${config.metadata.description}

-

Configuration location: ${config.configurationData.resourcePath} -

-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - -
PropertyLabelValue
${propInfo.name} - ${propInfo.propertyMetadata.label} - - - - - - - - - - - <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> -
- <%--
- -
${propInfo.propertyMetadata.label} = ${propInfo.value}
-
-
-
description
-
${propInfo.propertyMetadata.description}
-
props
-
${propInfo.propertyMetadata.properties}
-
default
-
${propInfo.propertyMetadata.defaultValue}
-
default2
-
${propInfo.default}
-
cfgsrc
-
${propInfo.configSourcePath}
-
effval
-
${propInfo.effectiveValue}
-
inh
-
${propInfo.inherited}
-
overr
-
${propInfo.overridden}
-
name
-
${propInfo.name}
-
-
-
-
- --%> -
-
-
-
- - - - <%--@elvariable id="collection" type="com.composum.sling.nodes.components.CAConfigModel.CollectionConfigInfo"--%> -
-
-

${collection.metadata.label} ( ${collection.collectionConfigData.configName} )

-
-
-
-
-

${collection.metadata.description}

-

Collection location: - ${collection.collectionConfigData.resourcePath} -

-
-
-
-
- - <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> -
-
-
- ${config.configurationData.collectionItemName} - (inherited = ${config.configurationData.inherited}) -
-
-
-
-

Configuration location: - - ${config.configurationData.resourcePath} - -

-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - -
PropertyLabelValue
${propInfo.name} - ${propInfo.propertyMetadata.label} - - - - - - - - - - - <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> -
- <%-- -
${propInfo.propertyMetadata.label} = ${propInfo.value}
-
-
-
description
-
${propInfo.propertyMetadata.description}
-
props
-
${propInfo.propertyMetadata.properties}
-
default
-
${propInfo.propertyMetadata.defaultValue}
-
default2
-
${propInfo.default}
-
cfgsrc
-
${propInfo.configSourcePath}
-
effval
-
${propInfo.effectiveValue}
-
inh
-
${propInfo.inherited}
-
overr
-
${propInfo.overridden}
-
name
-
${propInfo.name}
-
-
-
--%> -
-
-
-
-
-
- + -<% - } catch (Exception ex) { - log.error(ex.toString(), ex); - PrintWriter writer = response.getWriter(); - writer.println("
");
-        ex.printStackTrace(writer);
-        writer.println("
"); - } -%> diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView.jsp new file mode 100644 index 000000000..1d6711293 --- /dev/null +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView.jsp @@ -0,0 +1,273 @@ +<%@ page import="java.io.PrintWriter" %> +<%@ page import="org.apache.sling.caconfig.management.ValueInfo" %> +<%@page session="false" pageEncoding="utf-8" %> +<%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> +<%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + +<%! + String renderAsStringOrArray(Object valueInfo) { + Object object = ((ValueInfo) valueInfo).getEffectiveValue(); + if (Object[].class.isAssignableFrom(object.getClass())) { + StringBuilder builder = new StringBuilder(); + for (Object item : (Object[]) object) { + if (builder.length() > 0) { + builder.append("
"); + } + builder.append(item); + } + return builder.toString(); + } else { + return object.toString(); + } + } +%> +<% + try { +%> +

Effective configuration values

+

To edit please go to the configuration locations.

+ + <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> + <%-- +
    + +
  • + ${meta.label} : ${meta.description} +
      + +
    • + ${prop.key} : ${prop.value} +
    • +
      +
    +
      + +
    • + ${propMeta.key} : ${propMeta.value} +
    • +
      +
    +
  • +
    +
+ --%> + + <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> +
+
+

${config.metadata.label} ( ${config.name} ) + <%-- --%> +

+
+
+
+
+

${config.metadata.description}

+

Configuration location: ${config.configurationData.resourcePath} +

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
PropertyLabelValue
${propInfo.name} + ${propInfo.propertyMetadata.label} + + + + + + + + + + + <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> +
+ <%--
+ +
${propInfo.propertyMetadata.label} = ${propInfo.value}
+
+
+
description
+
${propInfo.propertyMetadata.description}
+
props
+
${propInfo.propertyMetadata.properties}
+
default
+
${propInfo.propertyMetadata.defaultValue}
+
default2
+
${propInfo.default}
+
cfgsrc
+
${propInfo.configSourcePath}
+
effval
+
${propInfo.effectiveValue}
+
inh
+
${propInfo.inherited}
+
overr
+
${propInfo.overridden}
+
name
+
${propInfo.name}
+
+
+
+
+ --%> +
+
+
+
+ + + + <%--@elvariable id="collection" type="com.composum.sling.nodes.components.CAConfigModel.CollectionConfigInfo"--%> +
+
+

${collection.metadata.label} ( ${collection.collectionConfigData.configName} )

+
+
+
+
+

${collection.metadata.description}

+

Collection location: + ${collection.collectionConfigData.resourcePath} +

+
+
+
+
+ + <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> +
+
+
+ ${config.configurationData.collectionItemName} + (inherited = ${config.configurationData.inherited}) +
+
+
+
+

Configuration location: + + ${config.configurationData.resourcePath} + +

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
PropertyLabelValue
${propInfo.name} + ${propInfo.propertyMetadata.label} + + + + + + + + + + + <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> +
+ <%-- +
${propInfo.propertyMetadata.label} = ${propInfo.value}
+
+
+
description
+
${propInfo.propertyMetadata.description}
+
props
+
${propInfo.propertyMetadata.properties}
+
default
+
${propInfo.propertyMetadata.defaultValue}
+
default2
+
${propInfo.default}
+
cfgsrc
+
${propInfo.configSourcePath}
+
effval
+
${propInfo.effectiveValue}
+
inh
+
${propInfo.inherited}
+
overr
+
${propInfo.overridden}
+
name
+
${propInfo.name}
+
+
+
--%> +
+
+
+
+
+
+ + +<% + } catch (Exception ex) { + log.error(ex.toString(), ex); + PrintWriter writer = response.getWriter(); + writer.println("
");
+        ex.printStackTrace(writer);
+        writer.println("
"); + } +%> diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp new file mode 100644 index 000000000..bb6b6384e --- /dev/null +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp @@ -0,0 +1,24 @@ +<%@ page import="java.io.PrintWriter" %> +<%@ page import="org.apache.sling.caconfig.management.ValueInfo" %> +<%@page session="false" pageEncoding="utf-8" %> +<%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> +<%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + +<% + try { +%> +

Configuration types list

+

(TBD: lists all configurations types incl. descriptions and collection / single; buttons to create configurations / configuration collections)

+ + <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> + +<% + } catch (Exception ex) { + log.error(ex.toString(), ex); + PrintWriter writer = response.getWriter(); + writer.println("
");
+        ex.printStackTrace(writer);
+        writer.println("
"); + } +%> From 548b2534c910d5513e432eeabc9ba2c07ad10440 Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Tue, 2 Jan 2024 12:59:43 +0100 Subject: [PATCH 13/71] raw list --- .../caconfig/listConfigurationsView.jsp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp index bb6b6384e..9c5282c5e 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp @@ -1,5 +1,4 @@ <%@ page import="java.io.PrintWriter" %> -<%@ page import="org.apache.sling.caconfig.management.ValueInfo" %> <%@page session="false" pageEncoding="utf-8" %> <%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> <%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> @@ -9,9 +8,22 @@ try { %>

Configuration types list

-

(TBD: lists all configurations types incl. descriptions and collection / single; buttons to create configurations / configuration collections)

+

(TBD: lists all configurations types incl. descriptions and collection / single; buttons to create configurations / + configuration collections)

<%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> + +
Singleton Configurations
+ + ${singletoncfg.metadata.name} : ${singletoncfg.metadata.description} + +
+ +
Collection Configurations
+ + ${collectioncfg.metadata.name} : ${collectioncfg.metadata.description} + +
<% } catch (Exception ex) { From c55c21a5c52b1ba3709c5b6d48c04ae6adcaafb6 Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Thu, 4 Jan 2024 10:14:34 +0100 Subject: [PATCH 14/71] dependency fixes --- console/pom.xml | 4 ++++ package/console/pom.xml | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/console/pom.xml b/console/pom.xml index fa725117a..8e918597f 100644 --- a/console/pom.xml +++ b/console/pom.xml @@ -226,6 +226,10 @@ org.apache.sling org.apache.sling.caconfig.api + + org.apache.sling + org.apache.sling.caconfig.spi + org.apache.sling org.apache.sling.caconfig.impl diff --git a/package/console/pom.xml b/package/console/pom.xml index ef12294e4..a0c3dba62 100644 --- a/package/console/pom.xml +++ b/package/console/pom.xml @@ -212,6 +212,18 @@ org.apache.sling org.apache.sling.discovery.api + + org.apache.sling + org.apache.sling.caconfig.api + + + org.apache.sling + org.apache.sling.caconfig.spi + + + org.apache.sling + org.apache.sling.caconfig.impl + From bdd622e56d6bc26c23a049edd63c83aa2497baf4 Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Thu, 4 Jan 2024 19:23:08 +0100 Subject: [PATCH 15/71] bugfix: resize editor properly in groovy execution pane --- .../root/libs/composum/nodes/commons/components/js/codeEditor.js | 1 + 1 file changed, 1 insertion(+) diff --git a/commons/src/main/resources/root/libs/composum/nodes/commons/components/js/codeEditor.js b/commons/src/main/resources/root/libs/composum/nodes/commons/components/js/codeEditor.js index 4ccba158a..c49a90702 100644 --- a/commons/src/main/resources/root/libs/composum/nodes/commons/components/js/codeEditor.js +++ b/commons/src/main/resources/root/libs/composum/nodes/commons/components/js/codeEditor.js @@ -33,6 +33,7 @@ this.ace.navigateFileStart(); }, this)); this.$el.resize(_.bind(this.resize, this)); + this.$el.on('splitpaneresize', _.bind(this.resize, this)); this.$('.editor-toolbar .start-editing').click(_.bind(this.openEditDialog, this)); From ad6de05a4fd8d8ac0493314b4b44bd11e9f1c8b1 Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Wed, 10 Jan 2024 15:17:06 +0100 Subject: [PATCH 16/71] browser: interpret properties that could be a path as path --- .../composum/sling/core/ResourceHandle.java | 16 +++++++++++++++ .../composum/sling/core/util/JsonUtil.java | 20 +++++++++++-------- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/commons/src/main/java/com/composum/sling/core/ResourceHandle.java b/commons/src/main/java/com/composum/sling/core/ResourceHandle.java index bd7750810..1bbd45484 100644 --- a/commons/src/main/java/com/composum/sling/core/ResourceHandle.java +++ b/commons/src/main/java/com/composum/sling/core/ResourceHandle.java @@ -22,12 +22,15 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + +import javax.annotation.Nonnull; import javax.jcr.Node; import javax.jcr.PropertyType; import javax.jcr.RepositoryException; import java.io.InputStream; import java.util.ArrayList; import java.util.Calendar; +import java.util.Collections; import java.util.EnumMap; import java.util.List; import java.util.Map; @@ -544,4 +547,17 @@ public Calendar getLastModified() { return lastModified; } + /** + * Returns the children as immutable list - sometimes better for iteration. + */ + @Nonnull + public List getChildrenList() { + List children = new ArrayList<>(); + Iterable rawChildren = super.getChildren(); + if (rawChildren != null) { + rawChildren.forEach(children::add); + } + return Collections.unmodifiableList(children); + } + } diff --git a/commons/src/main/java/com/composum/sling/core/util/JsonUtil.java b/commons/src/main/java/com/composum/sling/core/util/JsonUtil.java index 46ef7cfb8..8bfe0ced4 100644 --- a/commons/src/main/java/com/composum/sling/core/util/JsonUtil.java +++ b/commons/src/main/java/com/composum/sling/core/util/JsonUtil.java @@ -858,18 +858,12 @@ public static String getValueTarget(@Nullable final Resource resource, return target.getPath(); } } + boolean checkAsRelativePath = false; if (StringUtils.isNotBlank(name)) { switch (name) { case PROP_RESOURCE_TYPE: case PROP_RESOURCE_SUPER_TYPE: - if (!value.startsWith("/")) { - for (String root : resolver.getSearchPath()) { - target = resolver.getResource(root + value); - if (target != null) { - return target.getPath(); - } - } - } + checkAsRelativePath = true; break; case PROP_UUID: break; @@ -888,9 +882,19 @@ public static String getValueTarget(@Nullable final Resource resource, } catch (Exception ignore) { } } + // heuristics whether it could be a path: it should contain at least a slash but no whitespace + checkAsRelativePath = value.contains("/") && !value.matches(".*\\s+.*"); break; } } + if (checkAsRelativePath) { + for (String root : resolver.getSearchPath()) { + target = resolver.getResource(root + value); + if (target != null) { + return target.getPath(); + } + } + } } return null; } From fee824fe08f4049330529cbafcc72a48d948c9d4 Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Thu, 11 Jan 2024 13:42:23 +0100 Subject: [PATCH 17/71] continuing configuration views --- .../sling/nodes/components/CAConfigModel.java | 14 +++++ .../components/caconfig/collectionView.jsp | 12 +++- .../components/caconfig/configurationView.jsp | 60 +++++++++++++++++++ .../caconfig/effectiveConfigurationsView.jsp | 1 - .../caconfig/listConfigurationsView.jsp | 10 +++- 5 files changed, 93 insertions(+), 4 deletions(-) diff --git a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java index b7f1b6647..b27561309 100644 --- a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java +++ b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java @@ -107,6 +107,20 @@ public List getCollectionConfigurations() { .collect(Collectors.toList()); } + public CollectionConfigInfo getThisCollectionConfiguration() { + CollectionConfigInfo configInfo = getCollectionConfigurations().stream() + .filter(collectionConfigInfo -> collectionConfigInfo.getCollectionConfigData().getConfigName().equals(getName())) + .findFirst().orElse(null); + return configInfo; + } + + public SingletonConfigInfo getThisSingletonConfiguration() { + SingletonConfigInfo configInfo = getSingletonConfigurations().stream() + .filter(singletonConfigInfo -> singletonConfigInfo.getName().equals(getName())) + .findFirst().orElse(null); + return configInfo; + } + public class CollectionConfigInfo { protected final ConfigurationCollectionData collectionConfigData; diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp index 87d052715..390902f9b 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp @@ -1,5 +1,4 @@ <%@ page import="java.io.PrintWriter" %> -<%@ page import="org.apache.sling.caconfig.management.ValueInfo" %> <%@page session="false" pageEncoding="utf-8" %> <%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> <%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> @@ -12,6 +11,17 @@

(TBD: lists the values for the items in this collection + inheritance setting and links to parents)

<%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> + + ${model.thisCollectionConfiguration.metadata.name} : ${model.thisCollectionConfiguration.metadata.description} +
+ + ${item.name}
+
+ + ${item.name} + ${item.metadata.description} + +
<% } catch (Exception ex) { diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp index 2ad16cf38..63d5cd319 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp @@ -5,6 +5,23 @@ <%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%! + String renderAsStringOrArray(Object valueInfo) { + Object object = ((ValueInfo) valueInfo).getEffectiveValue(); + if (Object[].class.isAssignableFrom(object.getClass())) { + StringBuilder builder = new StringBuilder(); + for (Object item : (Object[]) object) { + if (builder.length() > 0) { + builder.append("
"); + } + builder.append(item); + } + return builder.toString(); + } else { + return object.toString(); + } + } +%> <% try { %> @@ -12,6 +29,49 @@

(TBD: lists the values this configuration + inheritance settings, possibly links to the parents, everything editable)

<%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> + +

${config.metadata.name}

+ ${config.metadata.description} +
+ + + + + + + + + + + + + + + + + + + + + +
PropertyLabelValue
${propInfo.name} + ${propInfo.propertyMetadata.label} + + + + + + + + + + + <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> +
<% } catch (Exception ex) { diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView.jsp index 1d6711293..e580055f1 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView.jsp @@ -74,7 +74,6 @@
- diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp index 9c5282c5e..7d414809e 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp @@ -15,13 +15,19 @@
Singleton Configurations
- ${singletoncfg.metadata.name} : ${singletoncfg.metadata.description} +

+ ${singletoncfg.metadata.name} + : ${singletoncfg.metadata.description} +

Collection Configurations
- ${collectioncfg.metadata.name} : ${collectioncfg.metadata.description} +

+ ${collectioncfg.metadata.name} + : ${collectioncfg.metadata.description} +

From 283bfb2e530cda175809ff8354f3bc5125bddd21 Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Thu, 11 Jan 2024 14:12:00 +0100 Subject: [PATCH 18/71] turn list configurations view into table --- .../caconfig/listConfigurationsView.jsp | 64 +++++++++++++------ 1 file changed, 44 insertions(+), 20 deletions(-) diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp index 7d414809e..8f376cb53 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp @@ -7,29 +7,53 @@ <% try { %> -

Configuration types list

-

(TBD: lists all configurations types incl. descriptions and collection / single; buttons to create configurations / - configuration collections)

- + <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> - -
Singleton Configurations
- -

- ${singletoncfg.metadata.name} - : ${singletoncfg.metadata.description} -

-
-
- -
Collection Configurations
- -

+

+ + + + + + + + + + + + + + + + + + + + + + + + + - + +
Singleton Configuration
+ + + ${singletoncfg.metadata.name} + + ${singletoncfg.metadata.description} +
Collection Configuration
+ + ${collectioncfg.metadata.name} - : ${collectioncfg.metadata.description} -

+
${collectioncfg.metadata.description}
<% } catch (Exception ex) { From 2550149310af901efaf9d3159ea05e14ed1217ac Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Thu, 11 Jan 2024 14:19:16 +0100 Subject: [PATCH 19/71] refactoring --- .../browser/components/caconfig/caconfig.jsp | 4 +- .../components/caconfig/collectionView.jsp | 58 +-- .../components/caconfig/configurationView.jsp | 115 ++--- .../caconfig/effectiveConfigurationsView.jsp | 473 +++++++++--------- .../caconfig/listConfigurationsView.jsp | 114 ++--- 5 files changed, 390 insertions(+), 374 deletions(-) diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/caconfig.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/caconfig.jsp index 47347a3ee..50c4c0222 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/caconfig.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/caconfig.jsp @@ -6,8 +6,6 @@
-
- -
+
diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp index 390902f9b..d7e7aa488 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp @@ -4,31 +4,33 @@ <%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<% - try { -%> -

Configuration Collection

-

(TBD: lists the values for the items in this collection + inheritance setting and links to parents)

- - <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> - - ${model.thisCollectionConfiguration.metadata.name} : ${model.thisCollectionConfiguration.metadata.description} -
- - ${item.name}
-
- - ${item.name} - ${item.metadata.description} - -
-
-<% - } catch (Exception ex) { - log.error(ex.toString(), ex); - PrintWriter writer = response.getWriter(); - writer.println("
");
-        ex.printStackTrace(writer);
-        writer.println("
"); - } -%> +
+ <% + try { + %> +

Configuration Collection

+

(TBD: lists the values for the items in this collection + inheritance setting and links to parents)

+ + <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> + + ${model.thisCollectionConfiguration.metadata.name} : ${model.thisCollectionConfiguration.metadata.description} +
+ + ${item.name}
+
+ + ${item.name} + ${item.metadata.description} + +
+
+ <% + } catch (Exception ex) { + log.error(ex.toString(), ex); + PrintWriter writer = response.getWriter(); + writer.println("
");
+            ex.printStackTrace(writer);
+            writer.println("
"); + } + %> +
diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp index 63d5cd319..78a363edf 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp @@ -22,63 +22,66 @@ } } %> -<% - try { -%> -

Configuration Edit

-

(TBD: lists the values this configuration + inheritance settings, possibly links to the parents, everything editable)

- - <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> - -

${config.metadata.name}

- ${config.metadata.description} -
- - - - - - - - - - - - +
+ <% + try { + %> +

Configuration Edit

+

(TBD: lists the values this configuration + inheritance settings, possibly links to the parents, everything + editable)

+ + <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> + +

${config.metadata.name}

+ ${config.metadata.description} +
+
PropertyLabelValue
+ - - - + + + + + + + + + + + + - - - - - -
${propInfo.name} - ${propInfo.propertyMetadata.label} - - + PropertyLabelValue
${propInfo.name} + ${propInfo.propertyMetadata.label} + + - - - - - - - <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> -
-
-<% - } catch (Exception ex) { - log.error(ex.toString(), ex); - PrintWriter writer = response.getWriter(); - writer.println("
");
-        ex.printStackTrace(writer);
-        writer.println("
"); - } -%> + + + + + + + + + <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> + + + + + + + <% + } catch (Exception ex) { + log.error(ex.toString(), ex); + PrintWriter writer = response.getWriter(); + writer.println("
");
+            ex.printStackTrace(writer);
+            writer.println("
"); + } + %> +
diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView.jsp index e580055f1..f912a3cc1 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView.jsp @@ -22,251 +22,262 @@ } } %> -<% - try { -%> -

Effective configuration values

-

To edit please go to the configuration locations.

- - <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> - <%-- -
    - -
  • - ${meta.label} : ${meta.description} -
      - -
    • - ${prop.key} : ${prop.value} -
    • -
      -
    -
      - -
    • - ${propMeta.key} : ${propMeta.value} -
    • -
      -
    -
  • -
    -
- --%> - - <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> -
-
-

${config.metadata.label} ( ${config.name} ) - <%-- --%> -

-
-
-
-
-

${config.metadata.description}

-

Configuration location: ${config.configurationData.resourcePath} -

-
+
+ <% + try { + %> +

Effective configuration values

+

To edit please go to the configuration locations.

+ + <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> + <%-- +
    + +
  • + ${meta.label} : ${meta.description} +
      + +
    • + ${prop.key} : ${prop.value} +
    • +
      +
    +
      + +
    • + ${propMeta.key} : ${propMeta.value} +
    • +
      +
    +
  • +
    +
+ --%> + + <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> +
+
+

${config.metadata.label} ( ${config.name} ) + <%-- --%> +

-
-
- - - - - - - - - - - - +
+
+
+

${config.metadata.description}

+

Configuration location: ${config.configurationData.resourcePath} +

+
+
+
+
+
PropertyLabelValue
+ - - - + + + + + + + + + + + + - - - - - -
${propInfo.name} - ${propInfo.propertyMetadata.label} - - + PropertyLabelValue
${propInfo.name} + ${propInfo.propertyMetadata.label} + + - - - - - - - <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> -
- <%--
- -
${propInfo.propertyMetadata.label} = ${propInfo.value}
-
-
-
description
-
${propInfo.propertyMetadata.description}
-
props
-
${propInfo.propertyMetadata.properties}
-
default
-
${propInfo.propertyMetadata.defaultValue}
-
default2
-
${propInfo.default}
-
cfgsrc
-
${propInfo.configSourcePath}
-
effval
-
${propInfo.effectiveValue}
-
inh
-
${propInfo.inherited}
-
overr
-
${propInfo.overridden}
-
name
-
${propInfo.name}
-
-
+ + + + + + + + + <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> + +
-
- --%> + + + <%--
+ +
${propInfo.propertyMetadata.label} = ${propInfo.value}
+
+
+
description
+
${propInfo.propertyMetadata.description}
+
props
+
${propInfo.propertyMetadata.properties}
+
default
+
${propInfo.propertyMetadata.defaultValue}
+
default2
+
${propInfo.default}
+
cfgsrc
+
${propInfo.configSourcePath}
+
effval
+
${propInfo.effectiveValue}
+
inh
+
${propInfo.inherited}
+
overr
+
${propInfo.overridden}
+
name
+
${propInfo.name}
+
+
+
+
+ --%> +
-
-
- +
+ - - <%--@elvariable id="collection" type="com.composum.sling.nodes.components.CAConfigModel.CollectionConfigInfo"--%> -
-
-

${collection.metadata.label} ( ${collection.collectionConfigData.configName} )

-
-
-
-
-

${collection.metadata.description}

-

Collection location: - ${collection.collectionConfigData.resourcePath} -

-
-
-
-
- - <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> -
-
-
- ${config.configurationData.collectionItemName} - (inherited = ${config.configurationData.inherited}) -
-
-
-
-

Configuration location: - - ${config.configurationData.resourcePath} - -

-
+ + <%--@elvariable id="collection" type="com.composum.sling.nodes.components.CAConfigModel.CollectionConfigInfo"--%> +
+
+

${collection.metadata.label} ( ${collection.collectionConfigData.configName} + )

+
+
+
+
+

${collection.metadata.description}

+

Collection location: + ${collection.collectionConfigData.resourcePath} +

-
-
- - - - - - - - - - - - - - - - - + + + + + +
PropertyLabelValue
${propInfo.name} - ${propInfo.propertyMetadata.label} - - + +
+
+ + <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> +
+
+
+ ${config.configurationData.collectionItemName} + (inherited = ${config.configurationData.inherited}) +
+
+
+
+

Configuration location: + + ${config.configurationData.resourcePath} + +

+
+
+
+
+ + + + + + + + + + + + + + + + + - - - - - -
PropertyLabelValue
${propInfo.name} + ${propInfo.propertyMetadata.label} + + - - - - - - - <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> -
- <%-- -
${propInfo.propertyMetadata.label} = ${propInfo.value}
-
-
-
description
-
${propInfo.propertyMetadata.description}
-
props
-
${propInfo.propertyMetadata.properties}
-
default
-
${propInfo.propertyMetadata.defaultValue}
-
default2
-
${propInfo.default}
-
cfgsrc
-
${propInfo.configSourcePath}
-
effval
-
${propInfo.effectiveValue}
-
inh
-
${propInfo.inherited}
-
overr
-
${propInfo.overridden}
-
name
-
${propInfo.name}
-
-
-
--%> -
+ +
+ + + + + <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> +
+ <%-- +
${propInfo.propertyMetadata.label} = ${propInfo.value}
+
+
+
description
+
${propInfo.propertyMetadata.description}
+
props
+
${propInfo.propertyMetadata.properties}
+
default
+
${propInfo.propertyMetadata.defaultValue}
+
default2
+
${propInfo.default}
+
cfgsrc
+
${propInfo.configSourcePath}
+
effval
+
${propInfo.effectiveValue}
+
inh
+
${propInfo.inherited}
+
overr
+
${propInfo.overridden}
+
name
+
${propInfo.name}
+
+
+
--%> +
+
+
+
-
+
+
- - -<% - } catch (Exception ex) { - log.error(ex.toString(), ex); - PrintWriter writer = response.getWriter(); - writer.println("
");
-        ex.printStackTrace(writer);
-        writer.println("
"); - } -%> + + <% + } catch (Exception ex) { + log.error(ex.toString(), ex); + PrintWriter writer = response.getWriter(); + writer.println("
");
+            ex.printStackTrace(writer);
+            writer.println("
"); + } + %> +
diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp index 8f376cb53..49f77940f 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp @@ -4,63 +4,65 @@ <%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<% - try { -%> - - <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> - - +
+ <% + try { + %> + + <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> +
+ + + + + + + + + + + + + + - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - -
Singleton Configuration
+ + + ${singletoncfg.metadata.name} + + ${singletoncfg.metadata.description} +
Singleton ConfigurationCollection Configuration
+ + + ${collectioncfg.metadata.name} + ${collectioncfg.metadata.description}
- - - ${singletoncfg.metadata.name} - - ${singletoncfg.metadata.description} -
Collection Configuration
- - - ${collectioncfg.metadata.name} - ${collectioncfg.metadata.description}
-
-<% - } catch (Exception ex) { - log.error(ex.toString(), ex); - PrintWriter writer = response.getWriter(); - writer.println("
");
-        ex.printStackTrace(writer);
-        writer.println("
"); - } -%> + + + + <% + } catch (Exception ex) { + log.error(ex.toString(), ex); + PrintWriter writer = response.getWriter(); + writer.println("
");
+            ex.printStackTrace(writer);
+            writer.println("
"); + } + %> +
From 0ba24e9cafe5462bcb3cba05314d1795ff549730 Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Thu, 11 Jan 2024 14:27:03 +0100 Subject: [PATCH 20/71] JSP refactoring 2 - move toolbar into the files and introduce detail-headline --- .../browser/components/caconfig/caconfig.jsp | 3 +- .../components/caconfig/collectionView.jsp | 49 +-- .../components/caconfig/configurationView.jsp | 37 +- .../browser/components/caconfig/content.jsp | 8 - .../caconfig/effectiveConfigurationsView.jsp | 319 +++++++++--------- .../caconfig/listConfigurationsView.jsp | 53 +-- .../browser/components/caconfig/toolbar.jsp | 12 - 7 files changed, 252 insertions(+), 229 deletions(-) delete mode 100644 console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp delete mode 100644 console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/toolbar.jsp diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/caconfig.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/caconfig.jsp index 50c4c0222..f08874f7f 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/caconfig.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/caconfig.jsp @@ -5,7 +5,6 @@
- - +
diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp index d7e7aa488..1c4023e8d 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp @@ -4,14 +4,24 @@ <%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -
- <% - try { - %> -

Configuration Collection

-

(TBD: lists the values for the items in this collection + inheritance setting and links to parents)

- - <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> + + <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> + +
+
Configuration Collection
+
+ +
+
+ +
+ <% + try { + %> +

(TBD: lists the values for the items in this collection + inheritance setting and links to parents)

${model.thisCollectionConfiguration.metadata.name} : ${model.thisCollectionConfiguration.metadata.description}
@@ -23,14 +33,15 @@ ${item.metadata.description}
- - <% - } catch (Exception ex) { - log.error(ex.toString(), ex); - PrintWriter writer = response.getWriter(); - writer.println("
");
-            ex.printStackTrace(writer);
-            writer.println("
"); - } - %> -
+ <% + } catch (Exception ex) { + log.error(ex.toString(), ex); + PrintWriter writer = response.getWriter(); + writer.println("
");
+                ex.printStackTrace(writer);
+                writer.println("
"); + } + %> +
+ + diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp index 78a363edf..8eaa965c8 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp @@ -22,18 +22,29 @@ } } %> -
- <% - try { - %> -

Configuration Edit

-

(TBD: lists the values this configuration + inheritance settings, possibly links to the parents, everything - editable)

- - <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> - + + + <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> + + +
+
Configuration Edit
+
+ +
+
+ +
+ <% + try { + %> +

(TBD: lists the values this configuration + inheritance settings, possibly links to the parents, everything + editable)

${config.metadata.name}

- ${config.metadata.description} + ${config.metadata.description}
@@ -74,7 +85,7 @@
- +
<% } catch (Exception ex) { log.error(ex.toString(), ex); @@ -84,4 +95,4 @@ writer.println(""); } %> -
+ diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp deleted file mode 100644 index b9cc7ce58..000000000 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp +++ /dev/null @@ -1,8 +0,0 @@ -<%@page session="false" pageEncoding="utf-8" %> -<%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> -<%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> - - - <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> - - diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView.jsp index f912a3cc1..7078183d8 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView.jsp @@ -22,43 +22,53 @@ } } %> -
- <% - try { - %> -

Effective configuration values

-

To edit please go to the configuration locations.

- - <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> - <%-- -
    - -
  • - ${meta.label} : ${meta.description} -
      - -
    • - ${prop.key} : ${prop.value} -
    • -
      -
    -
      - -
    • - ${propMeta.key} : ${propMeta.value} -
    • -
      -
    -
  • -
    -
- --%> + + <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> + +
+
Effective configuration values
+
+ +
+
+ +
+ <% + try { + %> +

To edit please go to the configuration locations.

+ <%-- +
    + +
  • + ${meta.label} : ${meta.description} +
      + +
    • + ${prop.key} : ${prop.value} +
    • +
      +
    +
      + +
    • + ${propMeta.key} : ${propMeta.value} +
    • +
      +
    +
  • +
    +
+ --%> + items="${model.singletonConfigurations}"> <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> -
+

${config.metadata.label} ( ${config.name} ) <%--


- + - - <%--@elvariable id="collection" type="com.composum.sling.nodes.components.CAConfigModel.CollectionConfigInfo"--%> -
-
-

${collection.metadata.label} ( ${collection.collectionConfigData.configName} - )

-
-
-
- + + <%--@elvariable id="collection" type="com.composum.sling.nodes.components.CAConfigModel.CollectionConfigInfo"--%> +
+
+

${collection.metadata.label} + ( ${collection.collectionConfigData.configName} + )

-
-
- - <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> -
-
-
- ${config.configurationData.collectionItemName} - (inherited = ${config.configurationData.inherited}) -
-
-
-
-

Configuration location: - - ${config.configurationData.resourcePath} - -

+
+
+
+

${collection.metadata.description}

+

Collection location: + ${collection.collectionConfigData.resourcePath} +

+
+
+
+
+ + <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> +
+
+
+ ${config.configurationData.collectionItemName} + (inherited = ${config.configurationData.inherited}) +
-
-
-
- - - - - - - - - - - - - +
+
+

Configuration location: + + ${config.configurationData.resourcePath} + +

+
+
+
+
+ +
PropertyLabelValue
+ - - - + + + + + + + + + + + + - - - - - -
${propInfo.name} - ${propInfo.propertyMetadata.label} - - + PropertyLabelValue
${propInfo.name} + ${propInfo.propertyMetadata.label} + + - - - - - - - <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> -
- <%-- -
${propInfo.propertyMetadata.label} = ${propInfo.value}
-
-
-
description
-
${propInfo.propertyMetadata.description}
-
props
-
${propInfo.propertyMetadata.properties}
-
default
-
${propInfo.propertyMetadata.defaultValue}
-
default2
-
${propInfo.default}
-
cfgsrc
-
${propInfo.configSourcePath}
-
effval
-
${propInfo.effectiveValue}
-
inh
-
${propInfo.inherited}
-
overr
-
${propInfo.overridden}
-
name
-
${propInfo.name}
-
-
-
--%> + + + + + + + + + <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> + + + + + + <%-- +
${propInfo.propertyMetadata.label} = ${propInfo.value}
+
+
+
description
+
${propInfo.propertyMetadata.description}
+
props
+
${propInfo.propertyMetadata.properties}
+
default
+
${propInfo.propertyMetadata.defaultValue}
+
default2
+
${propInfo.default}
+
cfgsrc
+
${propInfo.configSourcePath}
+
effval
+
${propInfo.effectiveValue}
+
inh
+
${propInfo.inherited}
+
overr
+
${propInfo.overridden}
+
name
+
${propInfo.name}
+
+
+
--%> +
-
- + +
-
- +
- - <% - } catch (Exception ex) { - log.error(ex.toString(), ex); - PrintWriter writer = response.getWriter(); - writer.println("
");
-            ex.printStackTrace(writer);
-            writer.println("
"); - } - %> -
+ <% + } catch (Exception ex) { + log.error(ex.toString(), ex); + PrintWriter writer = response.getWriter(); + writer.println("
");
+                ex.printStackTrace(writer);
+                writer.println("
"); + } + %> +
+ diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp index 49f77940f..7291441a0 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView.jsp @@ -4,19 +4,30 @@ <%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -
- <% - try { - %> - - <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> + + <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> + +
+
Configuration Types
+
+ +
+
+ +
+ <% + try { + %> - + @@ -37,7 +48,7 @@ - +
Singleton ConfigurationSingleton Configurations
Collection ConfigurationCollection Configurations
- - <% - } catch (Exception ex) { - log.error(ex.toString(), ex); - PrintWriter writer = response.getWriter(); - writer.println("
");
-            ex.printStackTrace(writer);
-            writer.println("
"); - } - %> -
+ <% + } catch (Exception ex) { + log.error(ex.toString(), ex); + PrintWriter writer = response.getWriter(); + writer.println("
");
+                ex.printStackTrace(writer);
+                writer.println("
"); + } + %> +
+ diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/toolbar.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/toolbar.jsp deleted file mode 100644 index 5c54d8e96..000000000 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/toolbar.jsp +++ /dev/null @@ -1,12 +0,0 @@ -<%@page session="false" pageEncoding="utf-8" %> -<%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> -<%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> - -
-
- -
-
From d7b79c4e59e143cd8d4ee5f85447f02e04c267e7 Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Thu, 11 Jan 2024 15:04:47 +0100 Subject: [PATCH 21/71] continue --- .../components/caconfig/collectionView.jsp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp index 1c4023e8d..77d9c53f0 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp @@ -21,17 +21,15 @@ <% try { %> -

(TBD: lists the values for the items in this collection + inheritance setting and links to parents)

- ${model.thisCollectionConfiguration.metadata.name} : ${model.thisCollectionConfiguration.metadata.description} -
- - ${item.name}
-
- - ${item.name} - ${item.metadata.description} - + + +

(TBD: lists the values for the items in this collection + inheritance setting and links to parents)

+
<% } catch (Exception ex) { From d47114d4c96225b06325b923e1d0421bdfe6dd73 Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Thu, 11 Jan 2024 18:05:28 +0100 Subject: [PATCH 22/71] fixes --- .../sling/nodes/components/CAConfigModel.java | 32 ++ .../components/caconfig/configurationView.jsp | 18 +- .../caconfig/effectiveConfigurationsView.jsp | 415 ++++++++---------- 3 files changed, 213 insertions(+), 252 deletions(-) diff --git a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java index b27561309..9573d4436 100644 --- a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java +++ b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java @@ -1,15 +1,19 @@ package com.composum.sling.nodes.components; +import static com.composum.sling.nodes.servlet.NodeServlet.Operation.map; import static java.util.Objects.requireNonNull; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.SortedSet; import java.util.stream.Collectors; import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ValueMap; import org.apache.sling.caconfig.management.ConfigurationCollectionData; import org.apache.sling.caconfig.management.ConfigurationData; import org.apache.sling.caconfig.management.ConfigurationManager; @@ -187,4 +191,32 @@ public List> getValueInfos() { } + public static String renderAsString(Object valueInfo) { + Object object = ((ValueInfo) valueInfo).getEffectiveValue(); + if (object == null) { + return ""; + } else if (object instanceof ConfigurationData) { + ConfigurationData nestedData = ((ConfigurationData) object); + Map stringMap = new HashMap<>(); + for (String key : nestedData.getPropertyNames()) { + ValueInfo nestedValueInfo = nestedData.getValueInfo(key); + String nestedValueAsString = renderAsString(nestedValueInfo); + stringMap.put(key, nestedValueAsString); + } + return stringMap.toString(); + } else if (Object[].class.isAssignableFrom(object.getClass())) { + StringBuilder builder = new StringBuilder(); + for (Object item : (Object[]) object) { + if (builder.length() > 0) { + builder.append("
"); + } + builder.append(item); + } + return builder.toString(); + } else { + return object.toString(); + } + } + + } diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp index 8eaa965c8..a0b51ecc5 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp @@ -1,5 +1,6 @@ <%@ page import="java.io.PrintWriter" %> <%@ page import="org.apache.sling.caconfig.management.ValueInfo" %> +<%@ page import="com.composum.sling.nodes.components.CAConfigModel" %> <%@page session="false" pageEncoding="utf-8" %> <%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> <%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> @@ -7,19 +8,7 @@ <%! String renderAsStringOrArray(Object valueInfo) { - Object object = ((ValueInfo) valueInfo).getEffectiveValue(); - if (Object[].class.isAssignableFrom(object.getClass())) { - StringBuilder builder = new StringBuilder(); - for (Object item : (Object[]) object) { - if (builder.length() > 0) { - builder.append("
"); - } - builder.append(item); - } - return builder.toString(); - } else { - return object.toString(); - } + return CAConfigModel.renderAsString(valueInfo); } %> @@ -52,7 +41,6 @@ Property Label - Value @@ -69,8 +57,6 @@ title="${propInfo.propertyMetadata.description}"> - - -<%@ page import="org.apache.sling.caconfig.management.ValueInfo" %> +<%@ page import="com.composum.sling.nodes.components.CAConfigModel" %> <%@page session="false" pageEncoding="utf-8" %> <%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> <%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> @@ -7,19 +7,7 @@ <%! String renderAsStringOrArray(Object valueInfo) { - Object object = ((ValueInfo) valueInfo).getEffectiveValue(); - if (Object[].class.isAssignableFrom(object.getClass())) { - StringBuilder builder = new StringBuilder(); - for (Object item : (Object[]) object) { - if (builder.length() > 0) { - builder.append("
"); - } - builder.append(item); - } - return builder.toString(); - } else { - return object.toString(); - } + return CAConfigModel.renderAsString(valueInfo); } %>
+

To edit please go to the configuration locations.

+ <% try { %> -

To edit please go to the configuration locations.

- <%-- -
    - -
  • - ${meta.label} : ${meta.description} -
      - -
    • - ${prop.key} : ${prop.value} -
    • -
      -
    -
      - -
    • - ${propMeta.key} : ${propMeta.value} -
    • -
      -
    -
  • -
    -
- --%> + items="${model.singletonConfigurations}"> <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> -
- -
-
-
-

${config.metadata.description}

-

Configuration location: ${config.configurationData.resourcePath} -

-
+
+
+

${config.metadata.label} ( ${config.name} ) + <%-- --%> +

-
-
- - +
+

${config.metadata.description}

+

Configuration location: ${config.configurationData.resourcePath} +

+
+ + + + + + + + + + + - - - - - - - - - - - - - + + - - - - - -
PropertyLabelValue
PropertyLabelValue
${propInfo.name} - ${propInfo.propertyMetadata.label} - - + ${propInfo.name} + ${propInfo.propertyMetadata.label} + + - - - - - - - <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> -
- <%--
- -
${propInfo.propertyMetadata.label} = ${propInfo.value}
-
-
-
description
-
${propInfo.propertyMetadata.description}
-
props
-
${propInfo.propertyMetadata.properties}
-
default
-
${propInfo.propertyMetadata.defaultValue}
-
default2
-
${propInfo.default}
-
cfgsrc
-
${propInfo.configSourcePath}
-
effval
-
${propInfo.effectiveValue}
-
inh
-
${propInfo.inherited}
-
overr
-
${propInfo.overridden}
-
name
-
${propInfo.name}
-
-
-
-
- --%> -
+ + + + + + + + + <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> + + + + +
-
- + - - <%--@elvariable id="collection" type="com.composum.sling.nodes.components.CAConfigModel.CollectionConfigInfo"--%> -
-
-

${collection.metadata.label} - ( ${collection.collectionConfigData.configName} - )

-
-
-
-
-

${collection.metadata.description}

-

Collection location: +


+ + + <%--@elvariable id="collection" type="com.composum.sling.nodes.components.CAConfigModel.CollectionConfigInfo"--%> +
+
+

${collection.metadata.label} + ( ${collection.collectionConfigData.configName} + )

+
+
+

${collection.metadata.description}

+

Collection location: + ${collection.collectionConfigData.resourcePath} +

+ + <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> +
+
+
+ ${config.configurationData.collectionItemName} + (inherited = ${config.configurationData.inherited}) +
+
+
+

Configuration location: ${collection.collectionConfigData.resourcePath} + data-path="${config.configurationData.resourcePath}" + href="/bin/browser.html${config.configurationData.resourcePath}"> + ${config.configurationData.resourcePath} +

-
-
-
-
- - <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> -
-
-
- ${config.configurationData.collectionItemName} - (inherited = ${config.configurationData.inherited}) -
-
-
-
-

Configuration location: - - ${config.configurationData.resourcePath} - -

-
-
-
-
- - - - - - - - - - - - - - - - - + + + + + +
PropertyLabelValue
${propInfo.name} - ${propInfo.propertyMetadata.label} - - + + + + + + + + + + + + + + + + + - - - - - -
PropertyLabelValue
${propInfo.name} + ${propInfo.propertyMetadata.label} + + - - - - - - - <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> -
- <%-- -
${propInfo.propertyMetadata.label} = ${propInfo.value}
-
-
-
description
-
${propInfo.propertyMetadata.description}
-
props
-
${propInfo.propertyMetadata.properties}
-
default
-
${propInfo.propertyMetadata.defaultValue}
-
default2
-
${propInfo.default}
-
cfgsrc
-
${propInfo.configSourcePath}
-
effval
-
${propInfo.effectiveValue}
-
inh
-
${propInfo.inherited}
-
overr
-
${propInfo.overridden}
-
name
-
${propInfo.name}
-
-
-
--%> - - - - +
+
+ + + + + <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> +
-
+
- -
+
+ <% } catch (Exception ex) { log.error(ex.toString(), ex); @@ -292,3 +184,54 @@ %>
+ + +<%-- +
    + +
  • + ${meta.label} : ${meta.description} +
      + +
    • + ${prop.key} : ${prop.value} +
    • +
      +
    +
      + +
    • + ${propMeta.key} : ${propMeta.value} +
    • +
      +
    +
  • +
    +
+--%> + +<%-- +
${propInfo.propertyMetadata.label} = ${propInfo.value}
+
+
+
description
+
${propInfo.propertyMetadata.description}
+
props
+
${propInfo.propertyMetadata.properties}
+
default
+
${propInfo.propertyMetadata.defaultValue}
+
default2
+
${propInfo.default}
+
cfgsrc
+
${propInfo.configSourcePath}
+
effval
+
${propInfo.effectiveValue}
+
inh
+
${propInfo.inherited}
+
overr
+
${propInfo.overridden}
+
name
+
${propInfo.name}
+
+
+
--%> From daf77f3d6b1d7f55f55248936f582e7b5592eb58 Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Thu, 11 Jan 2024 18:32:46 +0100 Subject: [PATCH 23/71] fix configuration view for single configurations --- .../sling/nodes/components/CAConfigModel.java | 23 +++++++++++++++---- .../components/caconfig/configurationView.jsp | 16 ++++++------- .../caconfig/effectiveConfigurationsView.jsp | 8 +++---- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java index 9573d4436..a9c0f217c 100644 --- a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java +++ b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java @@ -1,8 +1,10 @@ package com.composum.sling.nodes.components; -import static com.composum.sling.nodes.servlet.NodeServlet.Operation.map; import static java.util.Objects.requireNonNull; +import java.io.IOException; +import java.io.StringWriter; +import java.io.Writer; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -13,19 +15,21 @@ import java.util.stream.Collectors; import org.apache.sling.api.resource.Resource; -import org.apache.sling.api.resource.ValueMap; import org.apache.sling.caconfig.management.ConfigurationCollectionData; import org.apache.sling.caconfig.management.ConfigurationData; import org.apache.sling.caconfig.management.ConfigurationManager; import org.apache.sling.caconfig.management.ValueInfo; import org.apache.sling.caconfig.spi.metadata.ConfigurationMetadata; +import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.composum.sling.core.BeanContext; import com.composum.sling.core.Restricted; +import com.composum.sling.core.util.JsonUtil; import com.composum.sling.nodes.console.ConsoleServletBean; import com.composum.sling.nodes.servlet.NodeServlet; +import com.google.gson.stream.JsonWriter; @Restricted(key = NodeServlet.SERVICE_KEY) public class CAConfigModel extends ConsoleServletBean { @@ -191,7 +195,7 @@ public List> getValueInfos() { } - public static String renderAsString(Object valueInfo) { + public static String renderValueInfoAsString(Object valueInfo) { Object object = ((ValueInfo) valueInfo).getEffectiveValue(); if (object == null) { return ""; @@ -200,7 +204,7 @@ public static String renderAsString(Object valueInfo) { Map stringMap = new HashMap<>(); for (String key : nestedData.getPropertyNames()) { ValueInfo nestedValueInfo = nestedData.getValueInfo(key); - String nestedValueAsString = renderAsString(nestedValueInfo); + String nestedValueAsString = renderValueInfoAsString(nestedValueInfo); stringMap.put(key, nestedValueAsString); } return stringMap.toString(); @@ -218,5 +222,16 @@ public static String renderAsString(Object valueInfo) { } } + public static String renderValueAsString(Object value) { + Writer writer = new StringWriter(); + @NotNull JsonWriter jsonWriter = new JsonWriter(writer); + try { + JsonUtil.jsonValue(jsonWriter, value); + } catch (IOException e) { + LOG.error("Error in converting to String: {}", value, e); + return "(error)"; + } + return writer.toString(); + } } diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp index a0b51ecc5..5b04c879e 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp @@ -1,14 +1,18 @@ <%@ page import="java.io.PrintWriter" %> <%@ page import="org.apache.sling.caconfig.management.ValueInfo" %> <%@ page import="com.composum.sling.nodes.components.CAConfigModel" %> +<%@ page import="org.apache.sling.api.resource.Resource" %> <%@page session="false" pageEncoding="utf-8" %> <%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> <%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%! - String renderAsStringOrArray(Object valueInfo) { - return CAConfigModel.renderAsString(valueInfo); + String renderValue(Object rawModel, Object valueInfoObject) { + ValueInfo valueInfo = (ValueInfo) valueInfoObject; + CAConfigModel model = (CAConfigModel) rawModel; + Object value = model.getResource().getValueMap().get(valueInfo.getName()); + return CAConfigModel.renderValueAsString(value); } %> @@ -57,15 +61,9 @@ title="${propInfo.propertyMetadata.description}"> - - - - <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> + <%= renderValue(request.getAttribute("model"), pageContext.getAttribute("propInfo")) %>
diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView.jsp index 03b23d4a3..f1b3a82ff 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView.jsp @@ -6,8 +6,8 @@ <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%! - String renderAsStringOrArray(Object valueInfo) { - return CAConfigModel.renderAsString(valueInfo); + String renderAsString(Object valueInfo) { + return CAConfigModel.renderValueInfoAsString(valueInfo); } %> - <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> + <%= renderAsString(pageContext.getAttribute("propInfo")) %> @@ -161,7 +161,7 @@ - <%= renderAsStringOrArray(pageContext.getAttribute("propInfo")) %> + <%= renderAsString(pageContext.getAttribute("propInfo")) %> From ca376deea045f08123f6187f5660a3c0d9d30486 Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Thu, 11 Jan 2024 19:02:46 +0100 Subject: [PATCH 24/71] fix configuration view for collection configuration items --- .../sling/nodes/components/CAConfigModel.java | 22 +++++++++++++++---- .../components/caconfig/configurationView.jsp | 13 +++++------ 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java index a9c0f217c..841a60e8c 100644 --- a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java +++ b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java @@ -115,6 +115,9 @@ public List getCollectionConfigurations() { .collect(Collectors.toList()); } + /** + * The information about the configuration collection this resource represents. + */ public CollectionConfigInfo getThisCollectionConfiguration() { CollectionConfigInfo configInfo = getCollectionConfigurations().stream() .filter(collectionConfigInfo -> collectionConfigInfo.getCollectionConfigData().getConfigName().equals(getName())) @@ -122,11 +125,22 @@ public CollectionConfigInfo getThisCollectionConfiguration() { return configInfo; } + /** + * The information about the configuration this resource represents. It can either be a singleton configuration + * or an item in a collection. + */ public SingletonConfigInfo getThisSingletonConfiguration() { - SingletonConfigInfo configInfo = getSingletonConfigurations().stream() - .filter(singletonConfigInfo -> singletonConfigInfo.getName().equals(getName())) - .findFirst().orElse(null); - return configInfo; + Resource configResource = getResource(); + while (configResource != null && configResource.getParent() != null + && !configResource.getParent().getName().equals("sling:configs")) { + configResource = configResource.getParent(); + } + String configName = configResource != null ? configResource.getName() : null; + ConfigurationData configurationData = configName != null ? getConfigurationManager().getConfiguration(getResource(), configName) : null; + if (configurationData != null) { + return new SingletonConfigInfo(configName, configurationData); + } + return null; } public class CollectionConfigInfo { diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp index 5b04c879e..67753ba3a 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView.jsp @@ -34,11 +34,9 @@ <% try { %> -

(TBD: lists the values this configuration + inheritance settings, possibly links to the parents, everything - editable)

-

${config.metadata.name}

- ${config.metadata.description} -
+ + +

Please click on the line in the table to edit the value. The description of the item is shown on mouse hover.

@@ -50,12 +48,13 @@ - + - + + + + + +
${propInfo.name} + ${propInfo.propertyMetadata.label} + <%-- --%> From 6ce76bffb7abcde5cb0535113914d9e697dc983e Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Thu, 11 Jan 2024 19:18:59 +0100 Subject: [PATCH 25/71] add short form of data to collectionView.jsp --- .../sling/nodes/components/CAConfigModel.java | 11 +++++++++++ .../components/caconfig/collectionView.jsp | 17 +++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java index 841a60e8c..0a79c81c0 100644 --- a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java +++ b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java @@ -15,6 +15,7 @@ import java.util.stream.Collectors; import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ValueMap; import org.apache.sling.caconfig.management.ConfigurationCollectionData; import org.apache.sling.caconfig.management.ConfigurationData; import org.apache.sling.caconfig.management.ConfigurationManager; @@ -237,6 +238,16 @@ public static String renderValueInfoAsString(Object valueInfo) { } public static String renderValueAsString(Object value) { + if (value instanceof ValueMap) { + // we don't want to render system properties, just stuff that belongs to the configuration. + Map map = new HashMap<>(); + for (Map.Entry entry : ((ValueMap) value).entrySet()) { + if (!entry.getKey().startsWith("jcr:")) { + map.put(entry.getKey(), renderValueAsString(entry.getValue())); + } + } + return renderValueAsString(map); + } Writer writer = new StringWriter(); @NotNull JsonWriter jsonWriter = new JsonWriter(writer); try { diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp index 77d9c53f0..e3e46e767 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/collectionView.jsp @@ -1,9 +1,16 @@ <%@ page import="java.io.PrintWriter" %> +<%@ page import="com.composum.sling.nodes.components.CAConfigModel" %> +<%@ page import="org.apache.sling.api.resource.Resource" %> <%@page session="false" pageEncoding="utf-8" %> <%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> <%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%! + String renderAsString(Object object) { + return CAConfigModel.renderValueAsString(object); + } +%> <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> @@ -24,12 +31,14 @@ -

(TBD: lists the values for the items in this collection + inheritance setting and links to parents)

-
+ + + + + <%= renderAsString(pageContext.getAttribute("propInfo")) %> +
- -
-
- - <% - } catch (Exception ex) { - log.error(ex.toString(), ex); - PrintWriter writer = response.getWriter(); - writer.println("
");
-                ex.printStackTrace(writer);
-                writer.println("
"); - } - %> -
- - - -<%-- -
    - -
  • - ${meta.label} : ${meta.description} -
      - -
    • - ${prop.key} : ${prop.value} -
    • +
- -
    - -
  • - ${propMeta.key} : ${propMeta.value} -
  • -
    -
- +
+
- ---%> - -<%-- -
${propInfo.propertyMetadata.label} = ${propInfo.value}
-
-
-
description
-
${propInfo.propertyMetadata.description}
-
props
-
${propInfo.propertyMetadata.properties}
-
default
-
${propInfo.propertyMetadata.defaultValue}
-
default2
-
${propInfo.default}
-
cfgsrc
-
${propInfo.configSourcePath}
-
effval
-
${propInfo.effectiveValue}
-
inh
-
${propInfo.inherited}
-
overr
-
${propInfo.overridden}
-
name
-
${propInfo.name}
-
-
-
--%> + +<% + } catch (Exception ex) { + log.error(ex.toString(), ex); + PrintWriter writer = response.getWriter(); + writer.println("
");
+        ex.printStackTrace(writer);
+        writer.println("
"); + } +%> diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/toolbar.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/toolbar.jsp index 303aac6e2..a315aee55 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/toolbar.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/toolbar.jsp @@ -1,15 +1,8 @@ -<%@ page import="java.io.PrintWriter" %> -<%@ page import="com.composum.sling.nodes.components.CAConfigModel" %> <%@page session="false" pageEncoding="utf-8" %> <%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> <%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%! - String renderAsString(Object valueInfo) { - return CAConfigModel.renderValueInfoAsString(valueInfo); - } -%> @@ -25,238 +18,4 @@
-
-

To edit the configuration go to the mentioned configuration locations. - To create a new configuration you can go to the following nodes: -

- - <% - try { - %> - - <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> -
-
-

${config.metadata.label} ( ${config.name} ) - <%-- --%> -

-
-
-

${config.metadata.description}

-

Configuration location: - - - ${config.configurationData.resourcePath} - - - (defaults) - - - , ${config.inherits ? 'inherits configurations' : 'does not inherit configurations'} -

- - - - - - - - - - - - - - - - - - - - - -
PropertyLabelValue
${propInfo.name} - ${propInfo.propertyMetadata.label} - - - - - - - - - - - <%= renderAsString(pageContext.getAttribute("propInfo")) %> -
-
-
-
- -
- - - <%--@elvariable id="collection" type="com.composum.sling.nodes.components.CAConfigModel.CollectionConfigInfo"--%> -
-
-

${collection.metadata.label} - ( ${collection.collectionConfigData.configName} - )

-
-
-

${collection.metadata.description}

-

Collection location: - ${collection.collectionConfigData.resourcePath} - , ${collection.inherits ? 'inherits configurations' : 'does not inherit configurations'} -

- - <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> -
-
-
- ${config.configurationData.collectionItemName} - (inherited) -
-
-
-

Configuration location: - - - ${config.configurationData.resourcePath} - - - (defaults) - - -

- - - - - - - - - - - - - - - - - - - - - - -
PropertyLabelValue
${propInfo.name} - ${propInfo.propertyMetadata.label} - - - - - - - - - - - <%= renderAsString(pageContext.getAttribute("propInfo")) %> -
-
-
-
-
-
-
- <% - } catch (Exception ex) { - log.error(ex.toString(), ex); - PrintWriter writer = response.getWriter(); - writer.println("
");
-                ex.printStackTrace(writer);
-                writer.println("
"); - } - %> -
- - -<%-- -
    - -
  • - ${meta.label} : ${meta.description} -
      - -
    • - ${prop.key} : ${prop.value} -
    • -
      -
    -
      - -
    • - ${propMeta.key} : ${propMeta.value} -
    • -
      -
    -
  • -
    -
---%> - -<%-- -
${propInfo.propertyMetadata.label} = ${propInfo.value}
-
-
-
description
-
${propInfo.propertyMetadata.description}
-
props
-
${propInfo.propertyMetadata.properties}
-
default
-
${propInfo.propertyMetadata.defaultValue}
-
default2
-
${propInfo.default}
-
cfgsrc
-
${propInfo.configSourcePath}
-
effval
-
${propInfo.effectiveValue}
-
inh
-
${propInfo.inherited}
-
overr
-
${propInfo.overridden}
-
name
-
${propInfo.name}
-
-
-
--%> diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView/content.jsp index 9d85c6336..1deffd0ce 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView/content.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView/content.jsp @@ -4,6 +4,9 @@ <%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<% + try { +%> @@ -11,106 +14,93 @@ -
-
Configuration Types
-
- -
-
- -
- <% - try { - %> - - - - - - - - - - - - - - - - - - - - - - - +
Singleton Configurations
- <%-- --%> - - - ${singletoncfg.metadata.name} - - - - ${singletoncfg.metadata.name} - - ${singletoncfg.metadata.description} -
+ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - -
Collection Configurations
- - - ${collectioncfg.metadata.name} - - - - ${collectioncfg.metadata.name} - ${collectioncfg.metadata.description}Singleton Configurations
+ <%-- --%> + + + ${singletoncfg.metadata.name} + + + + ${singletoncfg.metadata.name} + + ${singletoncfg.metadata.description} +
- <% - } catch (Exception ex) { - log.error(ex.toString(), ex); - PrintWriter writer = response.getWriter(); - writer.println("
");
-                ex.printStackTrace(writer);
-                writer.println("
"); - } - %> -
+ + + + + Collection Configurations + + + + + + + + + + + ${collectioncfg.metadata.name} + + + + + + + + ${collectioncfg.metadata.name} + + + + ${collectioncfg.metadata.description} + + + +
+<% + } catch (Exception ex) { + log.error(ex.toString(), ex); + PrintWriter writer = response.getWriter(); + writer.println("
");
+        ex.printStackTrace(writer);
+        writer.println("
"); + } +%> diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView/toolbar.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView/toolbar.jsp index 9d85c6336..d3f21bc62 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView/toolbar.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/listConfigurationsView/toolbar.jsp @@ -1,4 +1,3 @@ -<%@ page import="java.io.PrintWriter" %> <%@page session="false" pageEncoding="utf-8" %> <%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> <%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> @@ -21,96 +20,6 @@
-
- <% - try { - %> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Singleton Configurations
- <%-- --%> - - - ${singletoncfg.metadata.name} - - - - ${singletoncfg.metadata.name} - - ${singletoncfg.metadata.description} -
Collection Configurations
- - - ${collectioncfg.metadata.name} - - - - ${collectioncfg.metadata.name} - ${collectioncfg.metadata.description}
- <% - } catch (Exception ex) { - log.error(ex.toString(), ex); - PrintWriter writer = response.getWriter(); - writer.println("
");
-                ex.printStackTrace(writer);
-                writer.println("
"); - } - %> -
- diff --git a/features/HowtoCreateBrowserView.md b/features/HowtoCreateBrowserView.md index 4e3093850..a70941090 100644 --- a/features/HowtoCreateBrowserView.md +++ b/features/HowtoCreateBrowserView.md @@ -1,10 +1,23 @@ # Tipps how to create a new browser view -- The corresponding components are here: console/src/main/resources/root/libs/composum/nodes/browser/components . references is the last component that is best used as a reference. +## Basic paths + +- The corresponding components are here: console/src/main/resources/root/libs/composum/nodes/browser/components . + references is the last component that is best used as a reference. - In console/src/main/resources/root/libs/composum/nodes/browser/views/std/tabs.jsp the new view is added to the tabs. -- console/src/main/resources/root/libs/composum/nodes/browser/tabs needs an entry for the new view, which just should include the component (compare references.jsp) +- console/src/main/resources/root/libs/composum/nodes/browser/tabs needs an entry for the new view, which just should + include the component (compare references.jsp) -## Dialog registration +## Tab registration Registration of the clientlib in console/src/main/resources/root/libs/composum/nodes/browser/clientlibs.json . Registration of JS entry point in nodeview.js browser.detailViewTabTypes . + +## General hints + +The toolbar is loaded initially (toolbar.jsp), the actual content content is loaded on showing the tab into a +div.detail-content to reduce the load. + +## Loaded dialogs + +Example: references.jsp openOptions From 2527a182b0bf8f23a116767b2fff1464025d6bb8 Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Tue, 23 Jan 2024 16:42:25 +0100 Subject: [PATCH 37/71] make an (yet empty) dialog appear for caconfig properties --- .../browser/components/caconfig/caconfig.jsp | 1 + .../caconfig/clientlib/css/caconfig.css | 30 +++++++++++++ .../caconfig/clientlib/js/caconfig.js | 27 ++++++++++-- .../caconfig/configurationView/content.jsp | 5 ++- .../browser/components/caconfig/content.jsp | 1 + .../browser/components/caconfig/property.json | 4 ++ .../components/caconfig/property/dialog.jsp | 32 ++++++++++++++ .../components/caconfig/property/property.jsp | 44 +++++++++++++++++++ 8 files changed, 139 insertions(+), 5 deletions(-) create mode 100644 console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/property.json create mode 100644 console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/property/dialog.jsp create mode 100644 console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/property/property.jsp diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/caconfig.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/caconfig.jsp index 9cd57ad04..9eae32d60 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/caconfig.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/caconfig.jsp @@ -4,6 +4,7 @@ <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%>
diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/css/caconfig.css b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/css/caconfig.css index 13c561862..3b648527e 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/css/caconfig.css +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/css/caconfig.css @@ -2,3 +2,33 @@ #browser-view .caconfig.detail-panel .wide-column { width: 100%; } + +.detail-view .caconfig .loading-curtain { + display: none; + position: absolute; + top: 0; + left: 0; + content: ''; +} + +.detail-view .caconfig .loading-curtain i { + display: none; +} + +.detail-view .caconfig.loading .loading-curtain { + pointer-events: all; + display: block; + right: 0; + bottom: 0; + content: ' '; + background: rgba(0, 0, 0, 0.4); + color: rgba(255, 255, 255, 0.5); + text-align: center; + z-index: 8; +} + +.detail-view .caconfig.loading .loading-curtain i { + display: inline-block; + margin: 30%; + font-size: 100px; +} diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/js/caconfig.js b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/js/caconfig.js index 150e45b15..b495922e4 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/js/caconfig.js +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/js/caconfig.js @@ -17,10 +17,11 @@ initialize: function (options) { this.$toolbar = this.$('.caconfig-toolbar'); this.$content = this.$('.detail-content'); - this.$content.on('click', '.create-configuration-resource', _.bind(this.createConfigurationResource, this)); - this.$content.on('click', '.create-configuration-collection-resource', _.bind(this.createConfigurationResource, this)); this.$toolbar.find('.add').click(_.bind(this.createConfigurationResource, this)); this.$toolbar.find('.remove').click(_.bind(this.deleteConfigurationResource, this)); + this.$content.on('click', '.create-configuration-resource', _.bind(this.createConfigurationResource, this)); + this.$content.on('click', '.create-configuration-collection-resource', _.bind(this.createConfigurationResource, this)); + this.$content.on('click', '.caconfig-property-editor', _.bind(this.openPropertyEditDialog, this)); }, createConfigurationResource: function (event) { @@ -67,8 +68,28 @@ }, this), undefined, _.bind(function () { this.$el.removeClass('loading'); }, this)); - } + }, + openPropertyEditDialog: function () { + console.log('openPropertyEditDialog', arguments); + core.openLoadedDialog(core.getComposumPath('composum/nodes/browser/components/caconfig/property.dialog.html'), + caconfig.PropertyEdit, undefined, _.bind(function (dialog) { + // init dialog + }, this), _.bind(function (dialog) { + // set values + }, this)); + }, + + }); + + caconfig.PropertyEdit = core.components.LoadedDialog.extend({ + + initialize: function (options) { + core.components.LoadedDialog.prototype.initialize.call(this, options); + this.$('button.apply').click(_.bind(function () { + this.hide(); + }, this)); + } }); })(CPM.nodes.browser.caconfig, CPM.nodes.browser, CPM.core); diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView/content.jsp index dbc70c35f..02c4cf44f 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView/content.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView/content.jsp @@ -24,7 +24,7 @@

Please click on the line in the table to edit the value. The description of the item is shown on mouse hover.

- +
@@ -35,7 +35,8 @@ - + + data-path="${model.path}" data-propertyName="${propInfo.name}"> - + - + - - + + - + diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp index 8440c3a8f..a4ebca580 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp @@ -49,12 +49,12 @@ ${config.configurationData.resourcePath} + , ${config.inherits ? 'inherits configurations' : 'does not inherit configurations'} (defaults) - , ${config.inherits ? 'inherits configurations' : 'does not inherit configurations'}

Property
${propInfo.name} ${propInfo.propertyMetadata.label} diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp index 4c60fce47..a54c2cb25 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/content.jsp @@ -4,6 +4,7 @@ <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/property.json b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/property.json new file mode 100644 index 000000000..812faade5 --- /dev/null +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/property.json @@ -0,0 +1,4 @@ +{ + "jcr:primaryType": "sling:Folder", + "sling:resourceType": "composum/nodes/browser/components/caconfig/property" +} diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/property/dialog.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/property/dialog.jsp new file mode 100644 index 000000000..0976eedc0 --- /dev/null +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/property/dialog.jsp @@ -0,0 +1,32 @@ +<%@page session="false" pageEncoding="UTF-8" %> +<%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> +<%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> + + diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/property/property.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/property/property.jsp new file mode 100644 index 000000000..b5a2d8d7e --- /dev/null +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/property/property.jsp @@ -0,0 +1,44 @@ +<%@page session="false" pageEncoding="utf-8" %> +<%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> +<%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> + + + +
+
+
+ + +
+
+ + +
+
+ +
+
+
+ +
+
+
+ + + +
From 5a7d260c80de2763d32821138493652a0e054cc8 Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Wed, 24 Jan 2024 19:41:58 +0100 Subject: [PATCH 38/71] intermediate state --- .../sling/nodes/components/CAConfigModel.java | 88 +++++++++++++++++ .../caconfig/clientlib/css/caconfig.css | 2 +- .../caconfig/clientlib/js/caconfig.js | 16 +++- .../caconfig/configurationView/content.jsp | 2 +- .../effectiveConfigurationsView/content.jsp | 8 +- .../components/caconfig/property/dialog.jsp | 94 ++++++++++++++----- .../composum/nodes/browser/js/nodeview.js | 2 +- features/HowtoCreateBrowserView.md | 6 +- features/SlingContextAwareConfiguration.md | 23 ++++- .../browser/clientlibs/browser/.content.xml | 4 +- .../browser/components/caconfig/.content.xml | 6 ++ .../caconfig/clientlib/.content.xml | 6 ++ .../caconfig/clientlib/css/.content.xml | 5 + .../caconfig/clientlib/js/.content.xml | 5 + 14 files changed, 227 insertions(+), 40 deletions(-) create mode 100644 package/sling/src/main/content/jcr_root/libs/composum/nodes.setup/browser/components/caconfig/.content.xml create mode 100644 package/sling/src/main/content/jcr_root/libs/composum/nodes.setup/browser/components/caconfig/clientlib/.content.xml create mode 100644 package/sling/src/main/content/jcr_root/libs/composum/nodes.setup/browser/components/caconfig/clientlib/css/.content.xml create mode 100644 package/sling/src/main/content/jcr_root/libs/composum/nodes.setup/browser/components/caconfig/clientlib/js/.content.xml diff --git a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java index 771b7eff7..c1aed8fac 100644 --- a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java +++ b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java @@ -6,6 +6,7 @@ import java.io.StringWriter; import java.io.Writer; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; @@ -163,6 +164,19 @@ public SingletonConfigInfo getThisSingletonConfiguration() { return null; } + public ValueInfo getThisProperty() { + String propertyName = getRequest().getParameter("propertyName"); + SingletonConfigInfo configInfo = getThisSingletonConfiguration(); + ValueInfo result = null; + if (configInfo != null && propertyName != null) { + result = configInfo.getValueInfos().stream() + .filter(valueInfo -> valueInfo.getPropertyMetadata() != null + && valueInfo.getPropertyMetadata().getName().equals(propertyName)) + .findFirst().orElse(null); + } + return result; + } + /** * List of all paths that are referenced from a sling:configRef of the resource or one of it's parents. */ @@ -278,6 +292,80 @@ public List> getValueInfos() { } + public class PropertyInfo { + + protected final ValueInfo valueInfo; + protected final String name; + protected final ConfigurationMetadata metadata; + private final Class type; + + public PropertyInfo(String name, ValueInfo valueInfo) { + this.name = name; + this.metadata = getConfigurationManager().getConfigurationMetadata(name); + this.valueInfo = valueInfo; + this.type = valueInfo != null ? valueInfo.getPropertyMetadata().getType() : null; + } + + public ValueInfo getValueInfo() { + return valueInfo; + } + + public String getName() { + return name; + } + + public ConfigurationMetadata getMetadata() { + return metadata; + } + + public boolean isResourceExists() { + return getResource().getChild(this.getName()) != null; + } + + public boolean isMultiValue() { + return type != null && ( + type.isArray() || Collection.class.isAssignableFrom(type) + ); + } + + public String getTypeName() { + if (type == null) { + return null; + } + return getBasicTypeName(type); + } + + protected String getBasicTypeName(Class clazz) { + if (clazz == null) { + return null; + } + if (Number.class.isAssignableFrom(clazz)) { + return "number"; + } else if (Boolean.class.isAssignableFrom(clazz)) { + return "boolean"; + } else if (String.class.isAssignableFrom(clazz)) { + return "string"; + } else if (boolean.class.isAssignableFrom(clazz)) { + return "boolean"; + } else if (int.class.isAssignableFrom(clazz) + || long.class.isAssignableFrom(clazz) + || double.class.isAssignableFrom(clazz) + || float.class.isAssignableFrom(clazz) + || short.class.isAssignableFrom(clazz) + || byte.class.isAssignableFrom(clazz)) { + return "number"; + } else if (clazz.isArray()) { + return getBasicTypeName(clazz.getComponentType()); + } else if (Collection.class.isAssignableFrom(clazz)) { + // cannot determine that. :-( String works probably. + return "string"; + } else { + return clazz.getName(); + } + } + + } + public static String renderValueInfoAsString(Object valueInfo) { Object object = ((ValueInfo) valueInfo).getEffectiveValue(); if (object == null) { diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/css/caconfig.css b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/css/caconfig.css index 3b648527e..bc0cff84f 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/css/caconfig.css +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/css/caconfig.css @@ -16,7 +16,7 @@ } .detail-view .caconfig.loading .loading-curtain { - pointer-events: all; + /* pointer-events: all; */ display: block; right: 0; bottom: 0; diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/js/caconfig.js b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/js/caconfig.js index b495922e4..4c6c685e0 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/js/caconfig.js +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/js/caconfig.js @@ -58,6 +58,10 @@ }, this)); }, + initContent: function () { + this.$content.find('[data-toggle="tooltip"]').tooltip(); + }, + reload: function () { this.$el.addClass('loading'); core.ajaxGet(core.getComposumPath('composum/nodes/browser/components/caconfig.content.html') + @@ -65,23 +69,31 @@ {}, _.bind(function (content) { this.$content.html(content); + this.initContent(); }, this), undefined, _.bind(function () { this.$el.removeClass('loading'); }, this)); }, - openPropertyEditDialog: function () { + openPropertyEditDialog: function (event) { console.log('openPropertyEditDialog', arguments); - core.openLoadedDialog(core.getComposumPath('composum/nodes/browser/components/caconfig/property.dialog.html'), + var $target = $(event.currentTarget); + var path = $target.data('path'); + var propertyName = $target.data('propertyName'); + core.openLoadedDialog(core.getComposumPath('composum/nodes/browser/components/caconfig/property.dialog.html') + + core.encodePath(path) + "?propertyName=" + propertyName, caconfig.PropertyEdit, undefined, _.bind(function (dialog) { + debugger; // init dialog }, this), _.bind(function (dialog) { + debugger; // set values }, this)); }, }); + // FIXME use browser.PropertyValueWidget caconfig.PropertyEdit = core.components.LoadedDialog.extend({ initialize: function (options) { diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView/content.jsp index 02c4cf44f..1b1ad2bea 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView/content.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView/content.jsp @@ -36,7 +36,7 @@
${propInfo.name} ${propInfo.propertyMetadata.label} diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp index e0d656772..8440c3a8f 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp @@ -69,13 +69,13 @@
${propInfo.name}${propInfo.name} (${propInfo.propertyMetadata.type.simpleName}) ${propInfo.propertyMetadata.label} - @@ -155,13 +155,13 @@
${propInfo.name}${propInfo.name} (${propInfo.propertyMetadata.type.simpleName}) ${propInfo.propertyMetadata.label} - diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/property/dialog.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/property/dialog.jsp index 0976eedc0..432d4450f 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/property/dialog.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/property/dialog.jsp @@ -1,32 +1,78 @@ <%@page session="false" pageEncoding="UTF-8" %> <%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2" %> <%@taglib prefix="cpn" uri="http://sling.composum.com/cpnl/1.0" %> - -
${propInfo.name} - ${propInfo.propertyMetadata.label} + ${propInfo.metadata.propertyMetadata.label} - <%-- --%> - + <%-- --%> + + title="${propInfo.metadata.propertyMetadata.description}"> - <%= renderValue(request.getAttribute("model"), pageContext.getAttribute("propInfo")) %> - ${propInfo.renderedValue}
@@ -113,10 +113,17 @@

${collection.metadata.description}

Collection location: - ${collection.collectionConfigData.resourcePath} - , ${collection.inherits ? 'inherits configurations' : 'does not inherit configurations'} + + + ${collection.collectionConfigData.resourcePath} + , ${collection.inherits ? 'inherits configurations' : 'does not inherit configurations'} + + + (defaults) + +

From 406f1b98f850434134449f8383ce69ca4b4bb02b Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Thu, 1 Feb 2024 15:41:35 +0100 Subject: [PATCH 42/71] recycle property dialog javascript - works a bit --- .../sling/nodes/components/CAConfigModel.java | 2 +- .../caconfig/clientlib/js/caconfig.js | 28 +++++++++++-------- .../caconfig/configurationView/content.jsp | 3 +- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java index 18a14f266..7ce7ffa29 100644 --- a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java +++ b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java @@ -309,7 +309,7 @@ public PropertyInfo(String name, ValueInfo valueInfo) { this.name = name; this.metadata = getConfigurationManager().getConfigurationMetadata(name); this.valueInfo = valueInfo; - this.type = valueInfo != null ? valueInfo.getPropertyMetadata().getType() : null; + this.type = valueInfo != null && valueInfo.getPropertyMetadata() != null ? valueInfo.getPropertyMetadata().getType() : null; } public ValueInfo getValueInfo() { diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/js/caconfig.js b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/js/caconfig.js index 70d405477..e5bac461f 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/js/caconfig.js +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/js/caconfig.js @@ -81,9 +81,11 @@ var path = $target.data('path'); var propertyName = $target.data('propertyname'); var config = { - propertyName: propertyName, - typeName: $target.data('typename'), - isMulti: $target.data('ismulti') + path: path, + name: propertyName, + type: $target.data('typename'), + value: $target.data('value'), + multi: $target.data('ismulti') == 'true' }; core.openLoadedDialog(core.getComposumPath('composum/nodes/browser/components/caconfig/property.dialog.html') + core.encodePath(path) + "?propertyName=" + propertyName, caconfig.PropertyEdit, config); @@ -92,16 +94,20 @@ }); // FIXME use browser.PropertyValueWidget - caconfig.PropertyEdit = core.components.LoadedDialog.extend({ + caconfig.PropertyEdit = browser.PropertyDialog.extend({ initialize: function (options) { - core.components.LoadedDialog.prototype.initialize.call(this, options); - this.$el.find('input[name="name"]').val(options.propertyName); - this.$el.find('input[name="type"]').val(options.typeName); - this.$el.find('input[name="multi"]').prop('checked', options.isMulti === 'true'); - this.$('button.apply').click(_.bind(function () { - this.hide(); - }, this)); + browser.PropertyDialog.prototype.initialize.call(this, options); + this.$type = this.$el.find('input[name="type"]'); + // this.$el.find('input[name="name"]').val(options.name); + // this.$el.find('input[name="type"]').val(options.type); + // this.$el.find('input[name="multi"]').prop('checked', options.multi); + // this.$('button.apply').click(_.bind(function () { + // this.hide(); + // }, this)); + var oldtitle = this.$title.html(); // would be overwritten + this.setProperty(new Map(Object.entries(options))); + this.$title.html(oldtitle); } }); diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView/content.jsp index cfe4f11e7..0c1e8d1bf 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView/content.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView/content.jsp @@ -29,7 +29,8 @@
+ data-path="${model.path}" data-propertyname="${propInfo.name}" + data-value="${propInfo.renderedValue}"> - + diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp index a4ebca580..12b8ceeae 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp @@ -63,7 +63,7 @@ - + @@ -156,7 +156,7 @@ - + From 6d2fd372320259e13cb459c7dc1de744c60858ff Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Thu, 1 Feb 2024 18:07:52 +0100 Subject: [PATCH 45/71] display description; layout fix --- .../caconfig/clientlib/css/caconfig.css | 4 ++++ .../caconfig/clientlib/js/caconfig.js | 5 ++++- .../caconfig/configurationView/content.jsp | 20 +++++++++++++------ .../effectiveConfigurationsView/content.jsp | 4 ++-- .../components/caconfig/property/dialog.jsp | 1 + 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/css/caconfig.css b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/css/caconfig.css index 9fba8a528..ce3764747 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/css/caconfig.css +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/css/caconfig.css @@ -44,3 +44,7 @@ .detail-view .caconfig .valuecolumn { width: 70%; } + +.detail-view .caconfig .infosymbol { + padding-top: 2px; +} diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/js/caconfig.js b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/js/caconfig.js index 22952f913..9c3ef8f5a 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/js/caconfig.js +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/js/caconfig.js @@ -85,7 +85,8 @@ name: propertyName, type: $target.data('typename'), value: $target.data('value'), - multi: $target.data('ismulti') == 'true' + multi: $target.data('ismulti') == 'true', + description: $target.data('description') }; core.openLoadedDialog(core.getComposumPath('composum/nodes/browser/components/caconfig/property.dialog.html') + core.encodePath(path) + "?propertyName=" + propertyName, @@ -109,6 +110,8 @@ var oldtitle = this.$title.html(); // will be overwritten this.setProperty(new Map(Object.entries(options))); this.$title.html(oldtitle); + this.$el.find('.description').text(options.description); + this.$content.find('[data-toggle="tooltip"]').tooltip(); } }); diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView/content.jsp index 20ccc79dd..cca342c22 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView/content.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView/content.jsp @@ -22,24 +22,32 @@ + - + data-value="${propInfo.renderedValue}" data-description="${propInfo.valueInfo.propertyMetadata.description}"> + diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp index 12b8ceeae..a5cc79f49 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp @@ -75,7 +75,7 @@ + + + + + +
${propInfo.name} ${propInfo.metadata.propertyMetadata.label} From c039ca234a8626e0163c77049c5027f64a5a0def Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Thu, 1 Feb 2024 15:54:35 +0100 Subject: [PATCH 43/71] add reloading and fix null display --- .../sling/nodes/components/CAConfigModel.java | 4 +++- .../caconfig/clientlib/js/caconfig.js | 17 +++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java index 7ce7ffa29..52a628875 100644 --- a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java +++ b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java @@ -407,7 +407,9 @@ public static String renderValueInfoAsString(Object valueInfo) { } public static String renderValueAsString(Object value) { - if (value instanceof ValueMap) { + if (value == null) { + return ""; + } else if (value instanceof ValueMap) { // we don't want to render system properties, just stuff that belongs to the configuration. Map map = new HashMap<>(); for (Map.Entry entry : ((ValueMap) value).entrySet()) { diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/js/caconfig.js b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/js/caconfig.js index e5bac461f..22952f913 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/js/caconfig.js +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/js/caconfig.js @@ -88,7 +88,14 @@ multi: $target.data('ismulti') == 'true' }; core.openLoadedDialog(core.getComposumPath('composum/nodes/browser/components/caconfig/property.dialog.html') + - core.encodePath(path) + "?propertyName=" + propertyName, caconfig.PropertyEdit, config); + core.encodePath(path) + "?propertyName=" + propertyName, + caconfig.PropertyEdit, config, function (dialog) { + // init dialog + }.bind(this), function (dialog) { + // value was changed + this.reload(); + }.bind(this) + ); }, }); @@ -99,13 +106,7 @@ initialize: function (options) { browser.PropertyDialog.prototype.initialize.call(this, options); this.$type = this.$el.find('input[name="type"]'); - // this.$el.find('input[name="name"]').val(options.name); - // this.$el.find('input[name="type"]').val(options.type); - // this.$el.find('input[name="multi"]').prop('checked', options.multi); - // this.$('button.apply').click(_.bind(function () { - // this.hide(); - // }, this)); - var oldtitle = this.$title.html(); // would be overwritten + var oldtitle = this.$title.html(); // will be overwritten this.setProperty(new Map(Object.entries(options))); this.$title.html(oldtitle); } From f4381139412af37f50a0f47b79a8695d33e14ad1 Mon Sep 17 00:00:00 2001 From: Hans-Peter Stoerr Date: Thu, 1 Feb 2024 17:40:21 +0100 Subject: [PATCH 44/71] fixes --- .../sling/nodes/components/CAConfigModel.java | 8 ++++++++ .../components/caconfig/clientlib/css/caconfig.css | 12 ++++++++++++ .../caconfig/configurationView/content.jsp | 2 +- .../caconfig/effectiveConfigurationsView/content.jsp | 4 ++-- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java index 52a628875..4a3cd2deb 100644 --- a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java +++ b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java @@ -344,6 +344,14 @@ public String getTypeName() { if (type == null) { return null; } + if (valueInfo != null && valueInfo.getPropertyMetadata() != null + && valueInfo.getPropertyMetadata().getProperties() != null) { + Map props = valueInfo.getPropertyMetadata().getProperties(); + String widgetType = props.get("widgetType"); + if ("pathbrowser".equals(widgetType)) { + return "Path"; + } + } return getBasicTypeName(type); } diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/css/caconfig.css b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/css/caconfig.css index bc0cff84f..9fba8a528 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/css/caconfig.css +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/clientlib/css/caconfig.css @@ -32,3 +32,15 @@ margin: 30%; font-size: 100px; } + +.detail-view .caconfig .loading-curtain { + display: none; + position: absolute; + top: 0; + left: 0; + content: ''; +} + +.detail-view .caconfig .valuecolumn { + width: 70%; +} diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView/content.jsp index 0c1e8d1bf..20ccc79dd 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView/content.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/configurationView/content.jsp @@ -22,7 +22,7 @@ Property Label ValueValue
Label ValueValue
Label ValueValue
Property Label Value
${propInfo.name} - ${propInfo.metadata.propertyMetadata.label} + ${propInfo.valueInfo.propertyMetadata.label} <%-- --%> - - + + + + + + + - @@ -168,7 +168,7 @@ - diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/property/dialog.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/property/dialog.jsp index 432d4450f..997feaa51 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/property/dialog.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/property/dialog.jsp @@ -22,6 +22,7 @@ - +
- <%--@elvariable id="collection" type="com.composum.sling.nodes.components.CAConfigModel.CollectionConfigInfo"--%> -
-
-

${collection.metadata.label} - ( ${collection.collectionConfigData.configName} - )

-
-
-

${collection.metadata.description}

-

Collection location: - - - ${collection.collectionConfigData.resourcePath} - , ${collection.inherits ? 'inherits configurations' : 'does not inherit configurations'} - - - (defaults) - - -

- - <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> -
-
-
- ${config.configurationData.collectionItemName} - (inherited) -
-
-
-

Configuration location: - - - ${config.configurationData.resourcePath} - - - (defaults) - - -

- - - - - - - - - - - - - + + <%--@elvariable id="collection" type="com.composum.sling.nodes.components.CAConfigModel.CollectionConfigInfo"--%> +
+
+

${collection.metadata.label} + ( ${collection.collectionConfigData.configName} + )

+
+
+

${collection.metadata.description}

+

Collection location: + + + ${collection.collectionConfigData.resourcePath} + , ${collection.inherits ? 'inherits configurations' : 'does not inherit configurations'} + + + (defaults) + + +

+ + <%--@elvariable id="config" type="com.composum.sling.nodes.components.CAConfigModel.SingletonConfigInfo"--%> +
+
+
+ ${config.configurationData.collectionItemName} + (inherited) +
+
+
+

Configuration location: + + + ${config.configurationData.resourcePath} + + + (defaults) + + +

+ +
PropertyLabelValue
+ - - - + + + + + + + + + + + + - - - - - -
${propInfo.name} (${propInfo.propertyMetadata.type.simpleName}) - ${propInfo.propertyMetadata.label} - - + PropertyLabelValue
${propInfo.name} + (${propInfo.propertyMetadata.type.simpleName}) + + ${propInfo.propertyMetadata.label} + + - - - - - - - <%= renderAsString(pageContext.getAttribute("propInfo")) %> -
+ +
+ + + + + <%= renderAsString(pageContext.getAttribute("propInfo")) %> +
+
-
- + +
-
+ <% From cf557e8d9a1b5d5a3d48b9ad2f011fdf525187f7 Mon Sep 17 00:00:00 2001 From: "Dr. Hans-Peter Stoerr" Date: Fri, 16 Feb 2024 18:36:33 +0100 Subject: [PATCH 67/71] fix configRef path lookup --- .../composum/sling/nodes/components/CAConfigModel.java | 8 +++++++- .../caconfig/effectiveConfigurationsView/content.jsp | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java index 37ae1053b..aa5bb35e7 100644 --- a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java +++ b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java @@ -83,7 +83,9 @@ public String getViewType() { } else if (getResource().getParent().getName().equals("sling:configs")) { String configName = getResource().getName(); ConfigurationMetadata metadata = getConfigurationManager().getConfigurationMetadata(configName); - if (metadata.isCollection()) { + if (metadata == null) { + return null; + } else if (metadata.isCollection()) { return "collectionView"; } else { return "configurationView"; @@ -193,6 +195,10 @@ public List getReferencedConfigPaths() { if (configRef != null) { paths.add(configRef + "/sling:configs"); } + configRef = properties.get("jcr:content/sling:configRef", String.class); + if (configRef != null) { + paths.add(configRef + "/sling:configs"); + } resource = resource.getParent(); } for (String possibleDefault : new String[]{"/conf/global/sling:configs", "/apps/conf/sling:configs", "/libs/conf/sling:configs"}) { diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp index e43a544c0..bf123ff95 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp @@ -18,8 +18,9 @@ scope="request"> <%--@elvariable id="model" type="com.composum.sling.nodes.components.CAConfigModel"--%> -

To edit the configuration go to the mentioned configuration locations. - To create a new configuration you can go to the following nodes: +

+ To edit the configuration go to the mentioned configuration locations. + For creating new configurations - the following nodes are currently connected via sling:configRef:

    From ace63642e9c7da632f72d858e430d9db076366dd Mon Sep 17 00:00:00 2001 From: "Dr. Hans-Peter Stoerr" Date: Wed, 28 Feb 2024 15:13:40 +0100 Subject: [PATCH 68/71] re #323 remove guava because that's not contained in Sling 12 anymore. --- console/pom.xml | 4 ---- .../sling/nodes/ai/impl/AIServiceImpl.java | 22 +++++++++++++------ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/console/pom.xml b/console/pom.xml index 26933f960..9936b8ea8 100644 --- a/console/pom.xml +++ b/console/pom.xml @@ -305,10 +305,6 @@ commons-codec commons-codec - - com.google.guava - guava - diff --git a/console/src/main/java/com/composum/sling/nodes/ai/impl/AIServiceImpl.java b/console/src/main/java/com/composum/sling/nodes/ai/impl/AIServiceImpl.java index eceeff1cb..9be3696c1 100644 --- a/console/src/main/java/com/composum/sling/nodes/ai/impl/AIServiceImpl.java +++ b/console/src/main/java/com/composum/sling/nodes/ai/impl/AIServiceImpl.java @@ -7,6 +7,7 @@ import java.io.File; import java.io.IOException; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -39,7 +40,6 @@ import org.slf4j.LoggerFactory; import com.composum.sling.nodes.ai.AIService; -import com.google.common.collect.ImmutableMap; import com.google.gson.Gson; @Component( @@ -76,17 +76,25 @@ public String prompt(@Nullable String systemmsg, @Nonnull String usermsg, @Nulla if (!isAvailable()) { throw new AIServiceNotAvailableException(); } - Map systemMessage = systemmsg != null ? - ImmutableMap.of("role", "system", "content", systemmsg) : null; - - Map userMessage = ImmutableMap.of("role", "user", "content", usermsg); + Map userMessage = new LinkedHashMap<>(); + userMessage.put("role", "user"); + userMessage.put("content", usermsg); Map request = new HashMap<>(); request.put("model", StringUtils.defaultString(config.defaultModel(), DEFAULT_MODEL)); - request.put("messages", systemMessage != null ? asList(systemMessage, userMessage) : asList(userMessage)); + if (systemmsg != null) { + Map systemMessage = new LinkedHashMap<>(); + systemMessage.put("role", "system"); + systemMessage.put("content", systemmsg); + request.put("messages", asList(systemMessage, userMessage)); + } else { + request.put("messages", asList(userMessage)); + } request.put("temperature", 0); if (responseFormat == ResponseFormat.JSON) { - request.put("response_format", ImmutableMap.of("type", "json_object")); + Map responseFormatMap = new LinkedHashMap<>(); + responseFormatMap.put("type", "json_object"); + request.put("response_format", responseFormatMap); } String requestJson = gson.toJson(request); From 8fc8477a44fc5f461fabe0b82887fec2d70374ff Mon Sep 17 00:00:00 2001 From: "Dr. Hans-Peter Stoerr" Date: Thu, 21 Mar 2024 14:05:13 +0100 Subject: [PATCH 69/71] fixing effective view in comparison to ConfigurationWebConsolePlugin, part 1 --- .../sling/nodes/components/CAConfigModel.java | 31 ++++++++----------- .../effectiveConfigurationsView/content.jsp | 11 +++++-- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java index aa5bb35e7..10ae33ba7 100644 --- a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java +++ b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java @@ -12,12 +12,14 @@ import java.util.Collections; import java.util.Comparator; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.SortedSet; import java.util.stream.Collectors; +import org.apache.commons.collections4.IteratorUtils; import org.apache.commons.lang3.StringUtils; import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.request.RequestPathInfo; @@ -27,6 +29,8 @@ import org.apache.sling.caconfig.management.ConfigurationData; import org.apache.sling.caconfig.management.ConfigurationManager; import org.apache.sling.caconfig.management.ValueInfo; +import org.apache.sling.caconfig.management.multiplexer.ContextPathStrategyMultiplexer; +import org.apache.sling.caconfig.resource.spi.ContextResource; import org.apache.sling.caconfig.spi.metadata.ConfigurationMetadata; import org.apache.sling.caconfig.spi.metadata.PropertyMetadata; import org.jetbrains.annotations.NotNull; @@ -183,24 +187,8 @@ public ValueInfo getThisProperty() { return result; } - /** - * List of all paths that are referenced from a sling:configRef of the resource or one of it's parents. - */ - public List getReferencedConfigPaths() { + public List getGlobalConfigPaths() { List paths = new ArrayList<>(); - Resource resource = getResource(); - while (resource != null) { - ValueMap properties = resource.getValueMap(); - String configRef = properties.get("sling:configRef", String.class); - if (configRef != null) { - paths.add(configRef + "/sling:configs"); - } - configRef = properties.get("jcr:content/sling:configRef", String.class); - if (configRef != null) { - paths.add(configRef + "/sling:configs"); - } - resource = resource.getParent(); - } for (String possibleDefault : new String[]{"/conf/global/sling:configs", "/apps/conf/sling:configs", "/libs/conf/sling:configs"}) { // add the resource to the list if it exists Resource defaultResource = getResolver().getResource(possibleDefault); @@ -211,6 +199,12 @@ public List getReferencedConfigPaths() { return paths; } + public List getContextPaths() { + ContextPathStrategyMultiplexer contextPathStrategyMultiplexer = context.getService(ContextPathStrategyMultiplexer.class); + List contextResources = IteratorUtils.toList(contextPathStrategyMultiplexer.findContextResources(getResource())); + return contextResources; + } + public class CollectionConfigInfo { protected final ConfigurationCollectionData collectionConfigData; @@ -254,7 +248,8 @@ public class SingletonConfigInfo { protected final String name; protected final ConfigurationMetadata metadata; - public SingletonConfigInfo(String name, ConfigurationData configurationData) { + public + SingletonConfigInfo(String name, ConfigurationData configurationData) { this.name = name; this.metadata = getConfigurationManager().getConfigurationMetadata(name); this.configurationData = configurationData; diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp index bf123ff95..a0aaf065f 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp @@ -23,12 +23,19 @@ For creating new configurations - the following nodes are currently connected via sling:configRef:

    From d7a43d1c0d54523dd57f0b3a9a96bec3d1a5722f Mon Sep 17 00:00:00 2001 From: "Dr. Hans-Peter Stoerr" Date: Thu, 21 Mar 2024 15:48:47 +0100 Subject: [PATCH 70/71] more fixes for configuration display --- .../sling/nodes/components/CAConfigModel.java | 94 +++++++++---------- .../effectiveConfigurationsView/content.jsp | 20 +++- 2 files changed, 65 insertions(+), 49 deletions(-) diff --git a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java index 10ae33ba7..b7eb9f6d0 100644 --- a/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java +++ b/console/src/main/java/com/composum/sling/nodes/components/CAConfigModel.java @@ -12,13 +12,14 @@ import java.util.Collections; import java.util.Comparator; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.SortedSet; import java.util.stream.Collectors; +import javax.inject.Inject; + import org.apache.commons.collections4.IteratorUtils; import org.apache.commons.lang3.StringUtils; import org.apache.sling.api.SlingHttpServletRequest; @@ -50,8 +51,12 @@ public class CAConfigModel extends ConsoleServletBean { private static final Logger LOG = LoggerFactory.getLogger(CAConfigModel.class); + @Inject protected ConfigurationManager configurationManager; + @Inject + protected ContextPathStrategyMultiplexer contextPathStrategyMultiplexer; + public CAConfigModel(BeanContext context, Resource resource) { super(context, resource); } @@ -64,17 +69,16 @@ public CAConfigModel() { super(); } - @Override - @NotNull - public ResourceHandle getResource() { - Resource resource = null; + + public void initialize(BeanContext context, Resource resource) { + Resource suffixResource = null; final SlingHttpServletRequest request = context.getRequest(); final RequestPathInfo pathInfo = request.getRequestPathInfo(); final String suffix = pathInfo.getSuffix(); if (StringUtils.isNotBlank(suffix)) { - resource = request.getResourceResolver().getResource(suffix); + suffixResource = request.getResourceResolver().getResource(suffix); } - return resource != null ? ResourceHandle.use(resource) : super.getResource(); + super.initialize(context, suffixResource != null ? suffixResource : resource); } public String getViewType() { @@ -86,7 +90,7 @@ public String getViewType() { return "listConfigurationsView"; } else if (getResource().getParent().getName().equals("sling:configs")) { String configName = getResource().getName(); - ConfigurationMetadata metadata = getConfigurationManager().getConfigurationMetadata(configName); + ConfigurationMetadata metadata = configurationManager.getConfigurationMetadata(configName); if (metadata == null) { return null; } else if (metadata.isCollection()) { @@ -96,7 +100,7 @@ public String getViewType() { } } else if (getResource().getParent().getParent().getName().equals("sling:configs")) { String configName = getResource().getParent().getName(); - ConfigurationMetadata metadata = getConfigurationManager().getConfigurationMetadata(configName); + ConfigurationMetadata metadata = configurationManager.getConfigurationMetadata(configName); if (metadata.isCollection()) { return "configurationView"; } @@ -108,40 +112,50 @@ public String getViewType() { return null; } - protected ConfigurationManager getConfigurationManager() { - if (configurationManager == null) { - configurationManager = context.getService(ConfigurationManager.class); + public List getGlobalConfigPaths() { + List paths = new ArrayList<>(); + for (String possibleDefault : new String[]{"/conf/global/sling:configs", "/apps/conf/sling:configs", "/libs/conf/sling:configs"}) { + // add the resource to the list if it exists + Resource defaultResource = getResolver().getResource(possibleDefault); + if (defaultResource != null) { + paths.add(possibleDefault); + } } - return configurationManager; + return paths; + } + + public List getContextPaths() { + List contextResources = IteratorUtils.toList(contextPathStrategyMultiplexer.findContextResources(getResource())); + return contextResources; } /** * Returns all configuration metadata. */ public List getAllMetaData() { - SortedSet names = getConfigurationManager().getConfigurationNames(); + SortedSet names = configurationManager.getConfigurationNames(); return names.stream() - .map(name -> getConfigurationManager().getConfigurationMetadata(name)) + .map(name -> configurationManager.getConfigurationMetadata(name)) .collect(Collectors.toList()); } public List getSingletonConfigurations() { - SortedSet names = getConfigurationManager().getConfigurationNames(); + SortedSet names = configurationManager.getConfigurationNames(); List result = names.stream() .filter(name -> - requireNonNull(getConfigurationManager().getConfigurationMetadata(name)).isSingleton()) + requireNonNull(configurationManager.getConfigurationMetadata(name)).isSingleton()) .map(name -> - new SingletonConfigInfo(name, getConfigurationManager().getConfiguration(resource, name))) + new SingletonConfigInfo(name, configurationManager.getConfiguration(resource, name))) .collect(Collectors.toList()); return result; } public List getCollectionConfigurations() { - SortedSet names = getConfigurationManager().getConfigurationNames(); + SortedSet names = configurationManager.getConfigurationNames(); List result = names.stream() .filter(name -> - requireNonNull(getConfigurationManager().getConfigurationMetadata(name)).isCollection()) - .map(name -> new CollectionConfigInfo(getConfigurationManager().getConfigurationCollection(resource, name))) + requireNonNull(configurationManager.getConfigurationMetadata(name)).isCollection()) + .map(name -> new CollectionConfigInfo(configurationManager.getConfigurationCollection(resource, name))) .collect(Collectors.toList()); return result; } @@ -167,7 +181,8 @@ public SingletonConfigInfo getThisSingletonConfiguration() { configResource = configResource.getParent(); } String configName = configResource != null ? configResource.getName() : null; - ConfigurationData configurationData = configName != null ? getConfigurationManager().getConfiguration(getResource(), configName) : null; + ConfigurationData configurationData; + configurationData = configName != null ? configurationManager.getConfiguration(getResource(), configName) : null; if (configurationData != null) { return new SingletonConfigInfo(configName, configurationData); } @@ -187,24 +202,6 @@ public ValueInfo getThisProperty() { return result; } - public List getGlobalConfigPaths() { - List paths = new ArrayList<>(); - for (String possibleDefault : new String[]{"/conf/global/sling:configs", "/apps/conf/sling:configs", "/libs/conf/sling:configs"}) { - // add the resource to the list if it exists - Resource defaultResource = getResolver().getResource(possibleDefault); - if (defaultResource != null) { - paths.add(possibleDefault); - } - } - return paths; - } - - public List getContextPaths() { - ContextPathStrategyMultiplexer contextPathStrategyMultiplexer = context.getService(ContextPathStrategyMultiplexer.class); - List contextResources = IteratorUtils.toList(contextPathStrategyMultiplexer.findContextResources(getResource())); - return contextResources; - } - public class CollectionConfigInfo { protected final ConfigurationCollectionData collectionConfigData; @@ -212,7 +209,7 @@ public class CollectionConfigInfo { public CollectionConfigInfo(ConfigurationCollectionData configurationCollection) { this.collectionConfigData = configurationCollection; - this.metadata = getConfigurationManager().getConfigurationMetadata(collectionConfigData.getConfigName()); + this.metadata = configurationManager.getConfigurationMetadata(collectionConfigData.getConfigName()); } /** @@ -248,10 +245,9 @@ public class SingletonConfigInfo { protected final String name; protected final ConfigurationMetadata metadata; - public - SingletonConfigInfo(String name, ConfigurationData configurationData) { + public SingletonConfigInfo(String name, ConfigurationData configurationData) { this.name = name; - this.metadata = getConfigurationManager().getConfigurationMetadata(name); + this.metadata = configurationManager.getConfigurationMetadata(name); this.configurationData = configurationData; } @@ -312,7 +308,7 @@ public class PropertyInfo { public PropertyInfo(String name, ValueInfo valueInfo) { this.name = name; - this.metadata = getConfigurationManager().getConfigurationMetadata(name); + this.metadata = configurationManager.getConfigurationMetadata(name); this.valueInfo = valueInfo; this.type = valueInfo != null && valueInfo.getPropertyMetadata() != null ? valueInfo.getPropertyMetadata().getType() : null; } @@ -357,7 +353,9 @@ public boolean isRequired() { && "true".equals(propMetadata.getProperties().get("required")); } - /** All properties except "required", which is handled in {@link #isRequired()}. */ + /** + * All properties except "required", which is handled in {@link #isRequired()}. + */ public Properties getProperties() { Properties props = new Properties(); if (valueInfo.getPropertyMetadata() != null && valueInfo.getPropertyMetadata().getProperties() != null) { @@ -367,7 +365,9 @@ public Properties getProperties() { return props; } - /** URL encoded value of {@link #getProperties()} to easier put that into an attribute. */ + /** + * URL encoded value of {@link #getProperties()} to easier put that into an attribute. + */ public String getPropertiesJsonEncoded() throws UnsupportedEncodingException { Properties props = getProperties(); String propertiesJson = props != null ? toJson(getProperties()) : null; diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp index a0aaf065f..7ffa6f856 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp +++ b/console/src/main/resources/root/libs/composum/nodes/browser/components/caconfig/effectiveConfigurationsView/content.jsp @@ -26,10 +26,10 @@
  • ${contextResource.configRef} + data-path="${contextResource.configRef}/sling:configs">${contextResource.configRef}/sling:configs referenced by ${contextResource.resource.path} + data-path="${contextResource.resource.path}/sling:configs">${contextResource.resource.path}/sling:configs (ranking ${contextResource.serviceRanking})
  • @@ -37,6 +37,8 @@
  • Global config: ${configPath}
+ + @@ -70,6 +72,7 @@ Label + Value @@ -87,6 +90,12 @@ + + + + + Label + Value @@ -181,6 +191,12 @@ + + + + + Date: Thu, 21 Mar 2024 15:42:28 +0000 Subject: [PATCH 71/71] [maven-release-plugin] prepare release composum-nodes-4.3.1 --- commons/pom.xml | 2 +- console/pom.xml | 2 +- corecfg/pom.xml | 2 +- jslibs/pom.xml | 2 +- osgi/pckginstall/pom.xml | 2 +- osgi/pom.xml | 2 +- package/aem/pom.xml | 2 +- package/cleanup/pom.xml | 2 +- package/commons/pom.xml | 2 +- package/console/pom.xml | 2 +- package/jslibs/pom.xml | 2 +- package/pckgmgr/pom.xml | 2 +- package/pom.xml | 2 +- package/setup/bundle/pom.xml | 2 +- package/setup/hook/pom.xml | 2 +- package/setup/pom.xml | 2 +- package/sling/pom.xml | 2 +- package/usermgr/pom.xml | 2 +- pckgmgr/pom.xml | 2 +- pom.xml | 4 ++-- setup/pom.xml | 2 +- setup/slingfeature/pom.xml | 2 +- setup/util/pom.xml | 2 +- test/pom.xml | 2 +- usermgr/pom.xml | 2 +- xtracts/debugutil/pom.xml | 2 +- xtracts/pom.xml | 2 +- xtracts/users-graph/bundle/pom.xml | 2 +- xtracts/users-graph/package/pom.xml | 2 +- xtracts/users-graph/pom.xml | 2 +- 30 files changed, 31 insertions(+), 31 deletions(-) diff --git a/commons/pom.xml b/commons/pom.xml index 477d6fe2a..2d8756370 100644 --- a/commons/pom.xml +++ b/commons/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-commons diff --git a/console/pom.xml b/console/pom.xml index 9936b8ea8..153399cf0 100644 --- a/console/pom.xml +++ b/console/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-console diff --git a/corecfg/pom.xml b/corecfg/pom.xml index 0ce8f5cf7..0e718c4af 100644 --- a/corecfg/pom.xml +++ b/corecfg/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-config diff --git a/jslibs/pom.xml b/jslibs/pom.xml index 9b8d92791..656e71563 100644 --- a/jslibs/pom.xml +++ b/jslibs/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-jslibs diff --git a/osgi/pckginstall/pom.xml b/osgi/pckginstall/pom.xml index a3e21378a..41041cffa 100644 --- a/osgi/pckginstall/pom.xml +++ b/osgi/pckginstall/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes.osgi composum-nodes-osgi - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-osgi-package-installer diff --git a/osgi/pom.xml b/osgi/pom.xml index b50f298fa..0eff5bd7f 100644 --- a/osgi/pom.xml +++ b/osgi/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.3.1-SNAPSHOT + 4.3.1 com.composum.nodes.osgi diff --git a/package/aem/pom.xml b/package/aem/pom.xml index 0f24f289f..46242f909 100644 --- a/package/aem/pom.xml +++ b/package/aem/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-package - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-aem-package diff --git a/package/cleanup/pom.xml b/package/cleanup/pom.xml index 33685aa46..9146a046c 100644 --- a/package/cleanup/pom.xml +++ b/package/cleanup/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-package - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-cleanup-package diff --git a/package/commons/pom.xml b/package/commons/pom.xml index 086287199..f89a7c2c8 100644 --- a/package/commons/pom.xml +++ b/package/commons/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-package - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-commons-bundle diff --git a/package/console/pom.xml b/package/console/pom.xml index d96f539c5..e3e2cda56 100644 --- a/package/console/pom.xml +++ b/package/console/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-package - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-console-bundle diff --git a/package/jslibs/pom.xml b/package/jslibs/pom.xml index 4c60b36e7..d49f919ef 100644 --- a/package/jslibs/pom.xml +++ b/package/jslibs/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-package - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-jslibs-package diff --git a/package/pckgmgr/pom.xml b/package/pckgmgr/pom.xml index c4ecd62e9..495d0e6e6 100644 --- a/package/pckgmgr/pom.xml +++ b/package/pckgmgr/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-package - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-pckgmgr-bundle diff --git a/package/pom.xml b/package/pom.xml index 78750bc9c..48cce5afb 100644 --- a/package/pom.xml +++ b/package/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-package diff --git a/package/setup/bundle/pom.xml b/package/setup/bundle/pom.xml index 2da8b5512..c90250527 100644 --- a/package/setup/bundle/pom.xml +++ b/package/setup/bundle/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes.setup composum-nodes-package-setup - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-package-setup-bundle diff --git a/package/setup/hook/pom.xml b/package/setup/hook/pom.xml index 2c00846aa..79cc5daa0 100644 --- a/package/setup/hook/pom.xml +++ b/package/setup/hook/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes.setup composum-nodes-package-setup - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-package-setup-hook diff --git a/package/setup/pom.xml b/package/setup/pom.xml index 8c3e0e329..b7fa19041 100644 --- a/package/setup/pom.xml +++ b/package/setup/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-package - 4.3.1-SNAPSHOT + 4.3.1 com.composum.nodes.setup diff --git a/package/sling/pom.xml b/package/sling/pom.xml index 4c1f371b2..31ed4292c 100644 --- a/package/sling/pom.xml +++ b/package/sling/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-package - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-sling-package diff --git a/package/usermgr/pom.xml b/package/usermgr/pom.xml index a28358d72..1953504a6 100644 --- a/package/usermgr/pom.xml +++ b/package/usermgr/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-package - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-usermgr-bundle diff --git a/pckgmgr/pom.xml b/pckgmgr/pom.xml index 4fcb48e5c..c549732d3 100644 --- a/pckgmgr/pom.xml +++ b/pckgmgr/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-pckgmgr diff --git a/pom.xml b/pom.xml index c85e46321..5b0a0d0b7 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ com.composum.nodes composum-nodes - 4.3.1-SNAPSHOT + 4.3.1 pom Composum Nodes @@ -31,7 +31,7 @@ scm:git:https://github.com/ist-dresden/composum.git scm:git:https://github.com/ist-dresden/composum.git https://github.com/ist-dresden/composum.git - composum-nodes-3.4.3 + composum-nodes-4.3.1 diff --git a/setup/pom.xml b/setup/pom.xml index deb08773d..1632f9006 100644 --- a/setup/pom.xml +++ b/setup/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.3.1-SNAPSHOT + 4.3.1 com.composum.nodes.setup diff --git a/setup/slingfeature/pom.xml b/setup/slingfeature/pom.xml index 43284fbd6..6b4b4d895 100644 --- a/setup/slingfeature/pom.xml +++ b/setup/slingfeature/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes.setup composum-nodes-setup - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-slingfeature diff --git a/setup/util/pom.xml b/setup/util/pom.xml index 2ae59f6a3..e44443519 100644 --- a/setup/util/pom.xml +++ b/setup/util/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes.setup composum-nodes-setup - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-setup-util diff --git a/test/pom.xml b/test/pom.xml index 8ce179dfe..eeff4eef6 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.3.1-SNAPSHOT + 4.3.1 com.composum.nodes.test diff --git a/usermgr/pom.xml b/usermgr/pom.xml index 6972318ce..6e8586615 100644 --- a/usermgr/pom.xml +++ b/usermgr/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-usermgr diff --git a/xtracts/debugutil/pom.xml b/xtracts/debugutil/pom.xml index ffb95b6ec..1e4b8bb2b 100644 --- a/xtracts/debugutil/pom.xml +++ b/xtracts/debugutil/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.3.1-SNAPSHOT + 4.3.1 ../../pom.xml diff --git a/xtracts/pom.xml b/xtracts/pom.xml index 9edd7a386..9c81985c3 100644 --- a/xtracts/pom.xml +++ b/xtracts/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-xtracts diff --git a/xtracts/users-graph/bundle/pom.xml b/xtracts/users-graph/bundle/pom.xml index 4f20ca81d..d07c25886 100644 --- a/xtracts/users-graph/bundle/pom.xml +++ b/xtracts/users-graph/bundle/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-users-graph - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-users-graph-bundle diff --git a/xtracts/users-graph/package/pom.xml b/xtracts/users-graph/package/pom.xml index 736ce8a9e..fa5ac520c 100644 --- a/xtracts/users-graph/package/pom.xml +++ b/xtracts/users-graph/package/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-users-graph - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-users-graph-package diff --git a/xtracts/users-graph/pom.xml b/xtracts/users-graph/pom.xml index 9ad03b133..f8e35b130 100644 --- a/xtracts/users-graph/pom.xml +++ b/xtracts/users-graph/pom.xml @@ -5,7 +5,7 @@ com.composum.nodes composum-nodes-xtracts - 4.3.1-SNAPSHOT + 4.3.1 composum-nodes-users-graph