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


The following commit(s) were added to refs/heads/master by this push:
     new 6a453be  Reference scopeRoot in DSL instead of component by ID if 
referenced node is a root
     new fcfbab3  This closes #264
6a453be is described below

commit 6a453be4b3543c95acea350519921fe0cfbdbcc8
Author: Mykola Mandra <[email protected]>
AuthorDate: Fri Aug 6 12:36:26 2021 +0100

    Reference scopeRoot in DSL instead of component by ID if referenced node is 
a root
    
    Signed-off-by: Mykola Mandra <[email protected]>
---
 .../blueprint-composer/app/components/dsl-editor/dsl-editor.js       | 4 ++++
 ui-modules/blueprint-composer/app/components/quick-fix/quick-fix.js  | 5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git 
a/ui-modules/blueprint-composer/app/components/dsl-editor/dsl-editor.js 
b/ui-modules/blueprint-composer/app/components/dsl-editor/dsl-editor.js
index ce5c430..a1cbebf 100644
--- a/ui-modules/blueprint-composer/app/components/dsl-editor/dsl-editor.js
+++ b/ui-modules/blueprint-composer/app/components/dsl-editor/dsl-editor.js
@@ -366,6 +366,10 @@ export function dslEditorDirective($rootScope, $filter, 
$log, brUtilsGeneral, bl
             return new Dsl(KIND.TARGET, TARGET.SELF);
         }
 
+        if (blueprintService.get() === targetEntity) {
+            return new Dsl(KIND.TARGET, TARGET.SCOPEROOT);
+        }
+
         if (!targetEntity.hasId()) {
             if (brUtilsGeneral.isNonEmpty(state.entityId)) {
                 targetEntity.id = state.entityId;
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 9e1f30b..cce3e19 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
@@ -125,10 +125,13 @@ const QUICK_FIX_PROPOSERS = {
             }
 
             if (!proposals.explicit_config) {
+                let entityToReference = (entity || issue.entity).parent;
+                let scopeRootOrComponent =  blueprintService.get() === 
entityToReference ? 'scopeRoot()' : `component("${entityToReference.id}")`;
+                console.log('scopeRootOrComponent', scopeRootOrComponent)
                 proposals.explicit_config = {
                     text: 'Set explicit config from parent',
                     tooltip: `This will set the config "${issue.ref}" to its 
parent value, explicitly`,
-                    apply: (issue, entity) => (entity || 
issue.entity).addConfig(issue.ref, `$brooklyn:component("${(entity || 
issue.entity).id}").config("${issue.ref}")`),
+                    apply: (issue, entity) => (entity || 
issue.entity).addConfig(issue.ref, 
`$brooklyn:${scopeRootOrComponent}.config("${issue.ref}")`),
                     issues: []
                 };
             }

Reply via email to