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 2022/12/07 20:07:51 UTC

[brooklyn-ui] branch master updated (b26fc41c -> 8e70341e)

This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git


    from b26fc41c guard against unnecessary watchers and null dsl refs after GC
     new eaed3aab ensure locations are cleared when model reset, and tidy code
     new 4d9008d9 fix for using the entity id properly to include all entities properties (previously wrongly removed as non-unique)
     new 8e70341e Merge remote-tracking branch 'zan-mateusz/fix/entity-if-for-dsl-props-uniqueness'

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../app/components/dsl-editor/dsl-editor.js        |  2 +-
 .../app/components/util/model/entity.model.js      | 66 ++++++++++------------
 2 files changed, 31 insertions(+), 37 deletions(-)


[brooklyn-ui] 01/03: ensure locations are cleared when model reset, and tidy code

Posted by he...@apache.org.
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 eaed3aab8a46742a951031cce8eb92f92512943c
Author: Alex Heneveld <al...@cloudsoft.io>
AuthorDate: Wed Dec 7 11:47:27 2022 +0000

    ensure locations are cleared when model reset, and tidy code
---
 .../app/components/util/model/entity.model.js      | 66 ++++++++++------------
 1 file changed, 30 insertions(+), 36 deletions(-)

diff --git a/ui-modules/blueprint-composer/app/components/util/model/entity.model.js b/ui-modules/blueprint-composer/app/components/util/model/entity.model.js
index ba2dbc86..4b1c9669 100644
--- a/ui-modules/blueprint-composer/app/components/util/model/entity.model.js
+++ b/ui-modules/blueprint-composer/app/components/util/model/entity.model.js
@@ -50,11 +50,11 @@ const METADATA = new WeakMap();
 const CONFIG = new WeakMap();
 const PARAMETERS = new WeakMap();
 const INITIALIZERS = new WeakMap();
-const CHILDREN = new WeakMap();
-const LOCATION = new WeakMap();
 const LOCATIONS = new WeakMap();
-const POLICIES = new WeakMap();
+const LOCATION = new WeakMap();
 const ENRICHERS = new WeakMap();
+const POLICIES = new WeakMap();
+const CHILDREN = new WeakMap();
 const MISC_DATA = new WeakMap();
 
 /**
@@ -68,19 +68,7 @@ const NOT_EMPTY = function (value) {
 
 export class Entity {
     constructor() {
-        ID.set(this, Math.random().toString(36).slice(2));
-        CONFIG.set(this, new Map());
-        PARAMETERS.set(this, []);
-        INITIALIZERS.set(this, []);
-        LOCATIONS.set(this, []);
-        METADATA.set(this, new Map());
-        ENRICHERS.set(this, new Map());
-        POLICIES.set(this, new Map());
-        CHILDREN.set(this, []);
-        MISC_DATA.set(this, new Map());
-        MISC_DATA.get(this).set('issues', []);
-        this.family = EntityFamily.ENTITY.id;
-        this.touch();
+        resetEntity(this);
     }
 
     /**
@@ -284,14 +272,18 @@ export class Entity {
      */
     removeLocation() {
         LOCATION.delete(this);
-        this.miscData.delete('locationName');
-        this.miscData.delete('locationIcon');
+        if (this.miscData) {
+            // if not yet initialized, don't bother
 
-        // this field provides a way for consumers to detect if the location was explicitly removed;
-        // this can be useful to prevent default locations from being applied
-        this.miscData.set('locationRemoved', true);
+            this.miscData.delete('locationName');
+            this.miscData.delete('locationIcon');
 
-        this.touch();
+            // this field provides a way for consumers to detect if the location was explicitly removed;
+            // this can be useful to prevent default locations from being applied
+            this.miscData.set('locationRemoved', true);
+
+            this.touch();
+        }
     }
 
     /**
@@ -1126,20 +1118,22 @@ function deleteEntity() {
 /**
  * Reset this entity
  */
-function resetEntity() {
-    ID.set(this, Math.random().toString(36).slice(2));
-    this.removeLocation();
-    CONFIG.set(this, new Map());
-    PARAMETERS.set(this, []);
-    METADATA.set(this, new Map());
-    INITIALIZERS.set(this, new Map());
-    ENRICHERS.set(this, new Map());
-    POLICIES.set(this, new Map());
-    CHILDREN.set(this, []);
-    MISC_DATA.set(this, new Map());
-    MISC_DATA.get(this).set('issues', []);
-    this.family = EntityFamily.ENTITY.id;
-    this.touch();
+function resetEntity(entity) {
+    entity = entity || this;
+    ID.set(entity, Math.random().toString(36).slice(2));
+    METADATA.set(entity, new Map());
+    CONFIG.set(entity, new Map());
+    PARAMETERS.set(entity, []);
+    INITIALIZERS.set(entity, []);
+    LOCATIONS.set(entity, []);
+    entity.removeLocation();
+    ENRICHERS.set(entity, new Map());
+    POLICIES.set(entity, new Map());
+    CHILDREN.set(entity, []);
+    MISC_DATA.set(entity, new Map());
+    MISC_DATA.get(entity).set('issues', []);
+    entity.family = EntityFamily.ENTITY.id;
+    entity.touch();
 }
 
 function isDslish(x) {


[brooklyn-ui] 02/03: fix for using the entity id properly to include all entities properties (previously wrongly removed as non-unique)

Posted by he...@apache.org.
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 4d9008d9de89c84a24ebd89fdacaa630accb2997
Author: zan-mateusz <ma...@cloudsoftcorp.com>
AuthorDate: Wed Dec 7 16:39:57 2022 +0000

    fix for using the entity id properly to include all entities properties (previously wrongly removed as non-unique)
---
 ui-modules/blueprint-composer/app/components/dsl-editor/dsl-editor.js | 2 +-
 1 file changed, 1 insertion(+), 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 4609cf8c..2a507819 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
@@ -307,7 +307,7 @@ export function dslEditorDirective($rootScope, $filter, $log, brUtilsGeneral, bl
 
         // filtering with both own and parent's ID in case we have same-type child nodes
         return items.filter(({ id, entity }) => {
-            const marker = id + ':' + (entity.id || '-');
+            const marker = id + ':' + (entity.id || entity._id || '-');
             if (IDs.has(marker)) return false;
             IDs.add(marker);
             return true;


[brooklyn-ui] 03/03: Merge remote-tracking branch 'zan-mateusz/fix/entity-if-for-dsl-props-uniqueness'

Posted by he...@apache.org.
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 8e70341e2bb320040732905374940525db268eb8
Merge: eaed3aab 4d9008d9
Author: Alex Heneveld <al...@cloudsoft.io>
AuthorDate: Wed Dec 7 20:07:28 2022 +0000

    Merge remote-tracking branch 'zan-mateusz/fix/entity-if-for-dsl-props-uniqueness'

 ui-modules/blueprint-composer/app/components/dsl-editor/dsl-editor.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)