This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git

commit cc5a908d835bf711ff5352fbaaeb7150f8e497d0
Author: Mykola Mandra <[email protected]>
AuthorDate: Wed Jun 23 13:39:56 2021 +0100

    Add relationship labels for all config keys
    
    Signed-off-by: Mykola Mandra <[email protected]>
---
 .../providers/blueprint-service.provider.js        | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git 
a/ui-modules/blueprint-composer/app/components/providers/blueprint-service.provider.js
 
b/ui-modules/blueprint-composer/app/components/providers/blueprint-service.provider.js
index 20aa730..c134092 100644
--- 
a/ui-modules/blueprint-composer/app/components/providers/blueprint-service.provider.js
+++ 
b/ui-modules/blueprint-composer/app/components/providers/blueprint-service.provider.js
@@ -50,24 +50,24 @@ function BlueprintService($log, $q, $sce, paletteApi, 
iconGenerator, dslService,
     // Add relationships provider based on Entity.config
     addEntityRelationshipsProvider( 'config',{
         apply: (entity) => {
-            let set = Array.from(entity.config.values())
-                .reduce((set, config)=> {
+            let set = Array.from(entity.config.keys())
+                .reduce((set, key)=> {
+                    let config = entity.config.get(key);
                     if (config instanceof Dsl) {
                         config.relationships.forEach((entity) => {
                             if (entity !== null) {
-                                // TODO: set the right name of the relationship
-                                set.add({entity: entity, name: null});
+                                set.add({entity: entity, name: key});
                             }
                         });
                     }
                     if (config instanceof Array) {
+                        console.log('Array',config)
                         config
-                            .filter(conf => conf instanceof Dsl)
-                            .reduce((set, config)=> {
+                            .filter(item => item instanceof Dsl)
+                            .reduce((set, config) => {
                                 config.relationships.forEach((entity) => {
                                     if (entity !== null) {
-                                        // TODO: set the right name of the 
relationship
-                                        set.add({entity: entity, name: null});
+                                        set.add({entity: entity, name: key});
                                     }
                                 });
                                 return set;
@@ -75,11 +75,11 @@ function BlueprintService($log, $q, $sce, paletteApi, 
iconGenerator, dslService,
                     }
                     if (config instanceof Object) {
                         Object.keys(config)
-                            .filter(key => config[key] instanceof Dsl)
-                            .reduce((set, key) => {
+                            .filter(objectKey => config[objectKey] instanceof 
Dsl)
+                            .reduce((set, objectKey) => {
                                 config[key].relationships.forEach((entity)=> {
                                     if (entity !== null) {
-                                        set.add({entity: entity, name: key});
+                                        set.add({entity: entity, name: 
objectKey});
                                     }
                                 });
                                 return set;

Reply via email to