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 9a5f84e  Fixed Composer required label check
     new 3d8f841  Merge pull request #261 from 
jathanasiou/fix/required-label-check
9a5f84e is described below

commit 9a5f84e255910ec5584d983887679b0395026a01
Author: John Athanasiou <[email protected]>
AuthorDate: Wed Aug 4 17:09:12 2021 +0100

    Fixed Composer required label check
    
    Default values were not being checked properly from Parameters and 
Configuration fields erroneously had *required* label
---
 .../app/components/providers/blueprint-service.provider.js        | 8 ++++----
 1 file changed, 4 insertions(+), 4 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 b814d25..86547cf 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
@@ -69,7 +69,6 @@ function BlueprintService($log, $q, $sce, paletteApi, 
iconGenerator, dslService,
                         });
                     }
                     if (config instanceof Array) {
-                        console.log('Array',config)
                         config
                             .filter(item => item instanceof Dsl)
                             .reduce((set, config) => {
@@ -446,16 +445,17 @@ function BlueprintService($log, $q, $sce, paletteApi, 
iconGenerator, dslService,
                     if (!k || !Array.isArray(k)) return false;
                     return k.some(isSet);
                 }
-                let hasDefault = () => angular.isDefined(config.defaultValue);
+                const hasDefault = (typeof config.default) !== 'undefined';
+
                 switch (key) {
                     case 'Predicates.notNull()':
                     case 'Predicates.notNull':
-                        if (!isSet() && !hasDefault()) {
+                        if (!isSet() && !hasDefault) {
                             message = `<samp>${config.name}</samp> is 
required`;
                         }
                         break;
                     case 'required':
-                        if (!isSet() && !hasDefault() && val()!='') {
+                        if (!isSet() && !hasDefault && val()!='') {
                             message = `<samp>${config.name}</samp> is 
required`;
                         }
                         break;

Reply via email to