You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by tb...@apache.org on 2018/11/20 09:48:20 UTC

[1/2] brooklyn-ui git commit: add UI support for {required, forbidden}UnlessAnyOf, and simplify constraint messages

Repository: brooklyn-ui
Updated Branches:
  refs/heads/master 4093d1fd0 -> 60ddc6213


add UI support for {required,forbidden}UnlessAnyOf, and simplify constraint messages


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/12871384
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/12871384
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/12871384

Branch: refs/heads/master
Commit: 12871384bd5b8d72e8467609abbf2d408a8dc225
Parents: 4093d1f
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Tue Nov 20 02:16:28 2018 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Tue Nov 20 02:16:28 2018 +0000

----------------------------------------------------------------------
 .../providers/blueprint-service.provider.js     | 22 ++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/12871384/ui-modules/blueprint-composer/app/components/providers/blueprint-service.provider.js
----------------------------------------------------------------------
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 0140faf..a896aac 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
@@ -299,6 +299,10 @@ function BlueprintService($log, $q, $sce, paletteApi, iconGenerator, dslService)
                             }
                             let val = (k) => entity.config.get(k || config.name);
                             let isSet = (k) => entity.config.has(k || config.name) && angular.isDefined(val(k));
+                            let isAnySet = (k) => {
+                                if (!k || !Array.isArray(k)) return false;
+                                return k.some(isSet);
+                            }
                             let hasDefault = () => angular.isDefined(config.defaultValue);
                             switch (key) {
                                 case 'Predicates.notNull()':
@@ -319,22 +323,32 @@ function BlueprintService($log, $q, $sce, paletteApi, iconGenerator, dslService)
                                     break;
                                 case 'forbiddenIf':
                                     if (isSet() && isSet(args)) {
-                                        message = `<samp>${config.name}</samp> cannot be set when <samp>${args}</samp> is set`;
+                                        message = `<samp>${config.name}</samp> and <samp>${args}</samp> cannot both be set`;
                                     }
                                     break;
                                 case 'forbiddenUnless':
                                     if (isSet() && !isSet(args)) {
-                                        message = `<samp>${config.name}</samp> cannot be set unless <samp>${args}</samp> is set`;
+                                        message = `<samp>${config.name}</samp> can only be set when <samp>${args}</samp> is set`;
                                     }
                                     break;
                                 case 'requiredIf':
                                     if (!isSet() && isSet(args)) {
-                                        message = `<samp>${config.name}</samp> is required when <samp>${args}</samp> is set`;
+                                        message = `<samp>${config.name}</samp> must be set if <samp>${args}</samp> is set`;
                                     }
                                     break;
                                 case 'requiredUnless':
                                     if (!isSet() && !isSet(args)) {
-                                        message = `<samp>${config.name}</samp> is required when <samp>${args}</samp> is not set`;
+                                        message = `<samp>${config.name}</samp> or <samp>${args}</samp> is required`;
+                                    }
+                                    break;
+                                case 'requiredUnlessAnyOf':
+                                    if (!isSet() && !isAnySet(args)) {
+                                        message = `<samp>${config.name}</samp> or one of <samp>${args}</samp> is required`;
+                                    }
+                                    break;
+                                case 'forbiddenUnlessAnyOf':
+                                    if (isSet() && !isAnySet(args)) {
+                                        message = `<samp>${config.name}</samp> cannot be set if any of <samp>${args}</samp> are set`;
                                     }
                                     break;
                                 default:


[2/2] brooklyn-ui git commit: This closes #110

Posted by tb...@apache.org.
This closes #110


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/60ddc621
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/60ddc621
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/60ddc621

Branch: refs/heads/master
Commit: 60ddc6213b045dac79ee148efc9c070b27d0a636
Parents: 4093d1f 1287138
Author: Thomas Bouron <th...@cloudsoftcorp.com>
Authored: Tue Nov 20 09:48:12 2018 +0000
Committer: Thomas Bouron <th...@cloudsoftcorp.com>
Committed: Tue Nov 20 09:48:12 2018 +0000

----------------------------------------------------------------------
 .../providers/blueprint-service.provider.js     | 22 ++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------