This is an automated email from the ASF dual-hosted git repository.
iuliana 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 f346ddb Introduce d3.renamed and d3.removed events for the downstream
to react on entity changes
new 6a56f16 Merge pull request #239 from
algairim/designer-events-refactoring
f346ddb is described below
commit f346ddba863958ed061389b1a7adb01a9f04fc65
Author: Mykola Mandra <[email protected]>
AuthorDate: Mon Jul 5 09:42:11 2021 +0100
Introduce d3.renamed and d3.removed events for the downstream to react on
entity changes
Signed-off-by: Mykola Mandra <[email protected]>
---
.../blueprint-composer/app/components/designer/designer.directive.js | 5 ++++-
.../app/components/spec-editor/spec-editor.directive.js | 3 +++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git
a/ui-modules/blueprint-composer/app/components/designer/designer.directive.js
b/ui-modules/blueprint-composer/app/components/designer/designer.directive.js
index b773d08..cd1a447 100644
---
a/ui-modules/blueprint-composer/app/components/designer/designer.directive.js
+++
b/ui-modules/blueprint-composer/app/components/designer/designer.directive.js
@@ -66,7 +66,7 @@ export function designerDirective($log, $state, $q,
iconGenerator, catalogApi, b
redrawGraph();
}, true);
- // Broadcast 'metadata-refreshed' event (downstream might listen
to this event).
+ // Broadcast 'd3.metadata-refreshed' event, allow downstream to
react on this event.
$scope.$broadcast('d3.metadata-refreshed');
});
@@ -114,6 +114,9 @@ export function designerDirective($log, $state, $q,
iconGenerator, catalogApi, b
$state.go('main.graphical');
});
});
+
+ // Broadcast 'd3.removed' event, allow downstream to react on this
event.
+ $scope.$broadcast('d3.removed');
});
$scope.$on('$stateChangeSuccess', (event, toState, toParams,
fromState, fromParams, options) => {
diff --git
a/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.directive.js
b/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.directive.js
index d0fa93f..80c3083 100644
---
a/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.directive.js
+++
b/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.directive.js
@@ -249,6 +249,9 @@ export function specEditorDirective($rootScope,
$templateCache, $injector, $sani
}, true);
scope.$watch('model.id', () => {
blueprintService.refreshAllRelationships();
+
+ // Broadcast 'd3.renamed' event, allow downstream to react on this
event.
+ $rootScope.$broadcast('d3.renamed', scope.model);
});
scope.$watch('state.parameters', (newVal, oldVal) => {