ahgittin commented on code in PR #335:
URL: https://github.com/apache/brooklyn-ui/pull/335#discussion_r897064238


##########
ui-modules/utils/quick-launch/quick-launch.js:
##########
@@ -122,7 +122,7 @@ export function quickLaunchDirective() {
             if ($scope.app.config) {
                 $scope.configMap = $scope.app.config.reduce((result, config) 
=> {
                     result[config.name] = config;
-                    const configValue = parseConfigValue(get(parsedPlan, 
`services[0][${BROOKLYN_CONFIG}][${config.name}]`));
+                    const configValue = parsedPlan[BROOKLYN_CONFIG] && 
parseConfigValue(parsedPlan[BROOKLYN_CONFIG][config.name]);

Review Comment:
   i'm guessing this snippet is used by quick launch _and_ catalog type view 
edit _and_ catalog type view deploy -- so this fix will catch the various 
places we've seen where config values aren't being picked up?
   
   also, if deploying a catalog item of type entity, i think it might be 
wrapped as
   
   ```
   services:
   - type: TYPE
     brooklyn.config:
       CONFIG: VALUE
   ```
   
   whereas if it's an application or template it might be
   
   ```
   brooklyn.config:
     CONFIG: VALUE
   services:
   - type: TYPE
   ```
   
   so the right fix i think is to check both, something like:
   
   ```
   const configValue = parseConfigValue( (services && services[0] && 
services[0][BROOKLYN_CONFIG] || {})[config.name] ) ||
     parseConfigValue( (parsedPlan[BROOKLYN_CONFIG] || {})[config.name] )
   ```
   



-- 
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: [email protected]

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

Reply via email to