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 2021/04/27 15:12:56 UTC

[brooklyn-ui] 14/15: also check supertypes for inclusion

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 a8fc797a96374d8e4d95fae7581e0c431099c8cb
Author: Alex Heneveld <al...@cloudsoftcorp.com>
AuthorDate: Tue Apr 27 13:47:16 2021 +0100

    also check supertypes for inclusion
---
 .../blueprint-composer/app/components/quick-fix/quick-fix.js   | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/ui-modules/blueprint-composer/app/components/quick-fix/quick-fix.js b/ui-modules/blueprint-composer/app/components/quick-fix/quick-fix.js
index 5204052..16cbac1 100644
--- a/ui-modules/blueprint-composer/app/components/quick-fix/quick-fix.js
+++ b/ui-modules/blueprint-composer/app/components/quick-fix/quick-fix.js
@@ -132,10 +132,14 @@ function proposeSetFrom() {
 
         let considerNode = (sourceNode) => {
             if (qfdef['source-types']) {
-                // TODO would be nice to store super-types of entity in miscData and filter based on those
                 if (!qfdef['source-types'].includes(sourceNode.entity.type)) {
-                    // wrong type
-                    return;
+                    // wrong type; check traits (supertypes)
+                    if ((sourceNode.entity.miscData.get("traits") || []).find(t => qfdef['source-types'].includes(t))) {
+                        // there was a super-type which matched; we're okay
+                    } else {
+                        // also no supertype matches the specified source-types, so don't make a proposal for this node
+                        return;
+                    }
                 }
             }