You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2022/08/22 20:37:19 UTC

[brooklyn-ui] 05/05: filter out null (unset) config when building yaml

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 467978ed9a69f665216124868551bf112b392550
Author: Alex Heneveld <al...@cloudsoft.io>
AuthorDate: Mon Aug 22 21:34:33 2022 +0100

    filter out null (unset) config when building yaml
---
 ui-modules/utils/quick-launch/quick-launch.js | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/ui-modules/utils/quick-launch/quick-launch.js b/ui-modules/utils/quick-launch/quick-launch.js
index 224c28e7..0d0ea086 100644
--- a/ui-modules/utils/quick-launch/quick-launch.js
+++ b/ui-modules/utils/quick-launch/quick-launch.js
@@ -51,11 +51,22 @@ export function quickLaunchDirective() {
 
         let quickLaunch = this;
 
+        function removeNullConfig(obj) {
+            if (obj && obj[BROOKLYN_CONFIG]) {
+                for (const key in obj[BROOKLYN_CONFIG]) {
+                    const val = obj[BROOKLYN_CONFIG][key];
+                    if (val==null || typeof val === 'undefined') {
+                        delete obj[BROOKLYN_CONFIG][key];
+                    }
+                }
+            }
+            return obj;
+        }
         quickLaunch.buildNewApp = () => ({
             name: $scope.model.name || $scope.app.displayName,
             location: $scope.model.location || '<REPLACE>',
             services: [
-                angular.copy($scope.entityToDeploy)
+                removeNullConfig(angular.copy($scope.entityToDeploy))
             ],
         });
         quickLaunch.getOriginalPlanFormat = getOriginalPlanFormat;