ahgittin commented on a change in pull request #125: Fix errors around 
locations in composer
URL: https://github.com/apache/brooklyn-ui/pull/125#discussion_r264207707
 
 

 ##########
 File path: 
ui-modules/blueprint-composer/app/components/providers/blueprint-service.provider.js
 ##########
 @@ -603,16 +616,24 @@ function BlueprintService($log, $q, $sce, paletteApi, 
iconGenerator, dslService)
 
     function populateLocationFromApiSuccess(entity, data) {
         entity.clearIssues({group: 'location'});
-        entity.location = data.symbolicName;
-        entity.miscData.set('locationName', data.name);
-        entity.miscData.set('locationIcon', data.iconUrl || 
iconGenerator(data.symbolicName));
+        entity.location = data.yamlHere || data.symbolicName;
+        
+        let name = data.name || data.displayName;
+        if (!name && data.yamlHere) {
+            name = typeof data.yamlHere === 'object' ? 
Object.keys(data.yamlHere)[0] : data.yamlHere;
+        }
+        if (!name) name =  data.symbolicName;
+        entity.miscData.set('locationName', name);
+        
+        // use icon on item, but if none then generate using *yaml* to 
distinguish when someone has changed it
+        // (especially for things like jclouds:aws-ec2 -- the config is more 
interesting than the type name)
+        entity.miscData.set('locationIcon', data==null ? null : data.iconUrl 
|| iconGenerator(data.yamlHere ? JSON.stringify(data.yamlHere) : 
data.symbolicName));
         return entity;
     }
 
     function populateLocationFromApiError(entity) {
-        entity.clearIssues({group: 'location'});
+        populateLocationFromApiSuccess(entity, { yamlHere: entity.location });
 
 Review comment:
   :) yes, i concur!

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


With regards,
Apache Git Services

Reply via email to