From a2e36c68b3a27bcccd9874481ff218bd493f1ffc Mon Sep 17 00:00:00 2001 From: marcofra Date: Thu, 9 Jan 2025 17:50:20 +0100 Subject: [PATCH] feat(editor): replace variables with parameters --- .../model/samples/rename-property.json | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/main/frontend/model/samples/rename-property.json b/src/main/frontend/model/samples/rename-property.json index 7666b55..68e10af 100644 --- a/src/main/frontend/model/samples/rename-property.json +++ b/src/main/frontend/model/samples/rename-property.json @@ -1,17 +1,9 @@ { "logLevel": "info", "hops": [ - { - "type": "declare", - "declarations": { - "path": "\"/content/swisscom/de\"", - "sourcePropertyName": "\"navTitle\"", - "destinationPropertyName": "\"navTitle-new\"" - } - }, { "type": "runScript", - "code": "xPathQuery = str:join([\"/jcr:root\", path, \"//*[@\", sourcePropertyName, \"]\"]);", + "code": "xPathQuery = str:join([\"/jcr:root\", args.path, \"//*[@\", args.sourcePropertyName, \"]\"]);", "extension": "jexl", "putLocalsBackIntoScope": true }, @@ -22,11 +14,30 @@ "hops": [ { "type": "renameProperty", - "newName": "${destinationPropertyName}", - "propertyName": "${sourcePropertyName}" + "newName": "${args.destinationPropertyName}", + "propertyName": "${args.sourcePropertyName}" } ] } ], - "parameters": [] + "parameters": [ + { + "name": "sourcePropertyName", + "defaultValue": "navTitle", + "type": "text", + "evaluation": "STRING" + }, + { + "name": "destinationPropertyName", + "defaultValue": "navTitle-new", + "type": "text", + "evaluation": "STRING" + }, + { + "name": "path", + "defaultValue": "/content/project/de", + "type": "text", + "evaluation": "STRING" + } + ] }