You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by GitBox <gi...@apache.org> on 2021/06/14 10:18:59 UTC

[GitHub] [brooklyn-ui] algairim commented on a change in pull request #222: entity lookup in brooklyn service provider with reference ID

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



##########
File path: ui-modules/blueprint-composer/app/components/providers/blueprint-service.provider.js
##########
@@ -230,7 +230,7 @@ function BlueprintService($log, $q, $sce, paletteApi, iconGenerator, dslService,
     }
 
     function lookup(entity, id, any = false) {
-        if (entity._id === id) {
+        if ((entity._id === id) || (entity.id === id)) {

Review comment:
       Looks like this lookup is designed for internal `entity._id` only. internal ID is always randomly generated at instantiation of the entity object when `entity.id` is a public value, it is optional and usually is null until assigned. Check if `entity.id` is not `null` first - `... || (entity.id && entity.id === id)`, and then compare with the supplied parameter. I wondering if @ahgittin remembers the history and purpose if this `lookup`. Would be great to add some JSdoc to clarify.




-- 
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:
users@infra.apache.org