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 2018/08/20 15:55:12 UTC

[1/2] brooklyn-ui git commit: Fix bug with the DSL editor/viewer

Repository: brooklyn-ui
Updated Branches:
  refs/heads/master 87dfc6b6c -> cab93e25a


Fix bug with the DSL editor/viewer


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

Branch: refs/heads/master
Commit: 217bbce18c33f08f857e6af7134557d52f4da2fe
Parents: 57e9726
Author: Thomas Bouron <th...@cloudsoftcorp.com>
Authored: Mon Aug 20 16:10:15 2018 +0100
Committer: Thomas Bouron <th...@cloudsoftcorp.com>
Committed: Mon Aug 20 16:50:07 2018 +0100

----------------------------------------------------------------------
 .../app/components/dsl-viewer/dsl-viewer.js              | 11 ++++++++++-
 .../views/main/graphical/edit/dsl/edit.dsl.controller.js |  2 +-
 2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/217bbce1/ui-modules/blueprint-composer/app/components/dsl-viewer/dsl-viewer.js
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/dsl-viewer/dsl-viewer.js b/ui-modules/blueprint-composer/app/components/dsl-viewer/dsl-viewer.js
index bb776fc..abdd233 100644
--- a/ui-modules/blueprint-composer/app/components/dsl-viewer/dsl-viewer.js
+++ b/ui-modules/blueprint-composer/app/components/dsl-viewer/dsl-viewer.js
@@ -51,7 +51,16 @@ export function dslViewerDirective() {
             return [KIND.STRING, KIND.NUMBER].includes(dsl.kind);
         };
         scope.getRelatedEntity = () => {
-            return scope.dsl.getRoot().relationships.find(entity => entity.id === scope.dsl.params[0].name);
+            if (scope.dsl.params.length > 0) {
+                // If the DSL is looking at an entity ID
+                return scope.dsl.getRoot().relationships.find(entity => entity.id === scope.dsl.params[0].name)
+            } else if (scope.dsl.getRoot().relationships.length > 0) {
+                // If the DSL is of the form $brooklyn:self() or $brooklyn:parent()
+                return scope.dsl.getRoot().relationships[0];
+            } else {
+                // Otherwise, there is no related entity
+                return null;
+            }
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/217bbce1/ui-modules/blueprint-composer/app/views/main/graphical/edit/dsl/edit.dsl.controller.js
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/views/main/graphical/edit/dsl/edit.dsl.controller.js b/ui-modules/blueprint-composer/app/views/main/graphical/edit/dsl/edit.dsl.controller.js
index 97188ce..fe94cd7 100644
--- a/ui-modules/blueprint-composer/app/views/main/graphical/edit/dsl/edit.dsl.controller.js
+++ b/ui-modules/blueprint-composer/app/views/main/graphical/edit/dsl/edit.dsl.controller.js
@@ -159,7 +159,7 @@ export const graphicalEditDslState = {
             if (!view) {
                 view = {
                     name: $state.current.name,
-                    params: $state.params
+                    params: angular.copy($state.params)
                 };
                 objectCache.put(`${definition.name}.view`, view);
             }


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

Posted by he...@apache.org.
This closes #63


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

Branch: refs/heads/master
Commit: cab93e25a48bc8ac3b7cb9488a7603479a7839eb
Parents: 87dfc6b 217bbce
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Aug 20 16:54:38 2018 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Mon Aug 20 16:54:38 2018 +0100

----------------------------------------------------------------------
 .../app/components/dsl-viewer/dsl-viewer.js              | 11 ++++++++++-
 .../views/main/graphical/edit/dsl/edit.dsl.controller.js |  2 +-
 2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------