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

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


The following commit(s) were added to refs/heads/master by this push:
     new 49a209e  improved syntax of the updateBundleConfig method and also 
fixed it in the process
     new 1f69963  Merge pull request #236 from iuliana/fix/config-update
49a209e is described below

commit 49a209ed8c7432bde977652070239b3070dfcdef
Author: iuliana <[email protected]>
AuthorDate: Wed Jun 30 15:44:17 2021 +0100

    improved syntax of the updateBundleConfig method and also fixed it in the 
process
---
 .../catalog-saver/catalog-saver.directive.js         | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git 
a/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
 
b/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
index 00f1c20..acfcfbd 100644
--- 
a/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
+++ 
b/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
@@ -63,23 +63,21 @@ export function saveToCatalogModalDirective($rootScope, 
$uibModal, $injector, $f
     };
 
     // TODO We might need to refactor the controller and directive around this 
to structure it better
-    function updateBundleConfig(entity, metadata, scope) {
+    function updateBundleConfig(entity, metadata, config) {
         // the name or can be inherited if root node is a known application 
type we are editing
         // (normally in those cases $scope.config will already be set by 
caller, but maybe not always)
-        if (!scope.config.name && entity.hasName()) {
-            scope.config.name = entity.name;
+        if (!config.name && entity.hasName()) {
+            config.name = entity.name;
         }
         // the ID can be set in the UI or can be inherited if root node is a 
known application type we are editing
         // (normally in those cases $scope.config will already be set by 
caller, but maybe not always)
-        if (!$scope.config.symbolicName && (entity.hasId() || 
metadata.has('id'))) {
-            $scope.config.symbolicName = entity.id || metadata.get('id');
+        if (!config.symbolicName && (entity.hasId() || metadata.has('id'))) {
+            config.symbolicName = entity.id || metadata.get('id');
         }
-        if (!scope.config.version && (entity.hasVersion() || 
metadata.has('version'))) {
-            scope.config.version = entity.version || metadata.get('version');
-        }
-        if (!scope.config.bundle && scope.config.symbolicName) {
-            scope.config.bundle = $scope.config.symbolicName;
+        if (!config.version && (entity.hasVersion() || 
metadata.has('version'))) {
+            config.version = entity.version || metadata.get('version');
         }
+        config.bundle =  config.bundle || config.symbolicName;
     }
 
     function link($scope, $element) {
@@ -107,7 +105,7 @@ export function saveToCatalogModalDirective($rootScope, 
$uibModal, $injector, $f
             }
             if (!$scope.isNewFromTemplate()) {
                 // (these should only be set if not making something new from 
a template, as the entity items will refer to the template)
-                (composerOverrides.updateBundleConfig || 
updateBundleConfig)(entity,metadata, $scope);
+                (composerOverrides.updateBundleConfig || 
updateBundleConfig)(entity,metadata, $scope.config);
             }
 
             // Override this callback to update configuration data elsewhere

Reply via email to