algairim commented on a change in pull request #227:
URL: https://github.com/apache/brooklyn-ui/pull/227#discussion_r654557655



##########
File path: 
ui-modules/blueprint-composer/app/components/designer/designer.directive.js
##########
@@ -203,38 +204,46 @@ export function designerDirective($log, $state, $q, 
iconGenerator, catalogApi, b
 
         $element.bind('drop-external-node', event => {
             let draggedItem = paletteDragAndDropService.draggedItem();
-            let target = blueprintService.find(event.detail.parentId);
+            let targetEntity = blueprintService.find(event.detail.parentId);
 
             if 
(draggedItem.supertypes.includes(EntityFamily.ENTITY.superType)) {
                 let targetIndex = event.detail.targetIndex;
                 let newEntity = blueprintService.populateEntityFromApi(new 
Entity(), draggedItem);
                 if (targetIndex >= 0) {
-                    target.insertChild(newEntity, targetIndex);
+                    targetEntity.insertChild(newEntity, targetIndex);
                 } else {
-                    target.addChild(newEntity);
+                    targetEntity.addChild(newEntity);
                 }
                 blueprintService.refreshEntityMetadata(newEntity, 
EntityFamily.ENTITY).then(() => {
+                    container.dispatchEvent(new 
CustomEvent('new-entity-created', {
+                        detail: {
+                            nodeId: newEntity._id,
+                            parentId: targetEntity._id
+                        }
+                    }));

Review comment:
       Consistent with 'move-entity' event.

##########
File path: 
ui-modules/blueprint-composer/app/components/designer/designer.directive.js
##########
@@ -203,38 +204,46 @@ export function designerDirective($log, $state, $q, 
iconGenerator, catalogApi, b
 
         $element.bind('drop-external-node', event => {
             let draggedItem = paletteDragAndDropService.draggedItem();
-            let target = blueprintService.find(event.detail.parentId);
+            let targetEntity = blueprintService.find(event.detail.parentId);
 
             if 
(draggedItem.supertypes.includes(EntityFamily.ENTITY.superType)) {
                 let targetIndex = event.detail.targetIndex;
                 let newEntity = blueprintService.populateEntityFromApi(new 
Entity(), draggedItem);
                 if (targetIndex >= 0) {
-                    target.insertChild(newEntity, targetIndex);
+                    targetEntity.insertChild(newEntity, targetIndex);
                 } else {
-                    target.addChild(newEntity);
+                    targetEntity.addChild(newEntity);
                 }
                 blueprintService.refreshEntityMetadata(newEntity, 
EntityFamily.ENTITY).then(() => {
+                    container.dispatchEvent(new 
CustomEvent('new-entity-created', {
+                        detail: {
+                            nodeId: newEntity._id,
+                            parentId: targetEntity._id
+                        }
+                    }));

Review comment:
       `detail` is consistent with 'move-entity' event.




-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to