You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@syncope.apache.org by GitBox <gi...@apache.org> on 2022/02/01 10:41:02 UTC

[GitHub] [syncope] ilgrosso commented on a change in pull request #306: [SYNCOPE-1657] Unable to define a new name for a cloned resource

ilgrosso commented on a change in pull request #306:
URL: https://github.com/apache/syncope/pull/306#discussion_r796463627



##########
File path: client/idm/console/src/main/java/org/apache/syncope/client/console/topology/TopologyTogglePanel.java
##########
@@ -627,44 +626,41 @@ public String getAjaxIndicatorMarkupId() {
         fragment.add(history);
 
         // [SYNCOPE-1161] - Option to clone a resource
-        AjaxLink<String> clone = new IndicatingOnConfirmAjaxLink<>("clone", "confirmClone", true) {
+        // [SYNCOPE-1657] - Unable to define a new name for a cloned resource
+        AjaxLink<String> clone = new IndicatingAjaxLink<>("clone") {
 
             private static final long serialVersionUID = -7978723352517770644L;
 
             @Override
             public void onClick(final AjaxRequestTarget target) {
                 try {
-                    ResourceTO resource = ResourceRestClient.read(node.getKey());
-                    resource.setKey("Copy of " + resource.getKey());
+                    ResourceTO modelObject = ResourceRestClient.read(node.getKey());
+                    modelObject.setKey("Copy of " + node.getKey());
+
                     // reset some resource objects keys
-                    if (resource.getOrgUnit() != null) {
-                        resource.getOrgUnit().setKey(null);
-                        for (ItemTO item : resource.getOrgUnit().getItems()) {
+                    if (modelObject.getOrgUnit() != null) {
+                        modelObject.getOrgUnit().setKey(null);
+                        for (ItemTO item : modelObject.getOrgUnit().getItems()) {
                             item.setKey(null);
                         }
                     }
-                    for (ProvisionTO provision : resource.getProvisions()) {
+                    for (ProvisionTO provision : modelObject.getProvisions()) {
                         provision.setKey(null);
                         if (provision.getMapping() != null) {
+

Review comment:
       Please remove this formatting-only change

##########
File path: client/idm/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyTogglePanel.properties
##########
@@ -23,6 +23,7 @@ connector.menu.history=Configuration history
 
 resource.new=New resource
 resource.edit=Edit resource {0}
+resource.clone=Clone resource {0}

Review comment:
       This must be added to all languages, e.g. `TopologyTogglePanel_*.properties`

##########
File path: client/idm/console/src/main/java/org/apache/syncope/client/console/topology/TopologyTogglePanel.java
##########
@@ -627,44 +626,41 @@ public String getAjaxIndicatorMarkupId() {
         fragment.add(history);
 
         // [SYNCOPE-1161] - Option to clone a resource
-        AjaxLink<String> clone = new IndicatingOnConfirmAjaxLink<>("clone", "confirmClone", true) {
+        // [SYNCOPE-1657] - Unable to define a new name for a cloned resource

Review comment:
       No need to place a reference to SYNCOPE-1657, please remove this line

##########
File path: client/idm/console/src/main/java/org/apache/syncope/client/console/topology/TopologyTogglePanel.java
##########
@@ -627,44 +626,41 @@ public String getAjaxIndicatorMarkupId() {
         fragment.add(history);
 
         // [SYNCOPE-1161] - Option to clone a resource
-        AjaxLink<String> clone = new IndicatingOnConfirmAjaxLink<>("clone", "confirmClone", true) {
+        // [SYNCOPE-1657] - Unable to define a new name for a cloned resource
+        AjaxLink<String> clone = new IndicatingAjaxLink<>("clone") {
 
             private static final long serialVersionUID = -7978723352517770644L;
 
             @Override
             public void onClick(final AjaxRequestTarget target) {
                 try {
-                    ResourceTO resource = ResourceRestClient.read(node.getKey());
-                    resource.setKey("Copy of " + resource.getKey());
+                    ResourceTO modelObject = ResourceRestClient.read(node.getKey());

Review comment:
       Please name this object back to `resource`, which improves readability




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@syncope.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org