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 e7a4fdf Improve performance of the blueprint processing on first
load; introduce d3.metadata-refreshed event
new 681614b Merge pull request #238 from
algairim/designer-events-refactoring
e7a4fdf is described below
commit e7a4fdf99eb7e3686d6896aeedd2e540b837618d
Author: Mykola Mandra <[email protected]>
AuthorDate: Thu Jul 1 19:21:09 2021 +0100
Improve performance of the blueprint processing on first load; introduce
d3.metadata-refreshed event
Signed-off-by: Mykola Mandra <[email protected]>
---
.../app/components/designer/designer.directive.js | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
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 c2843a9..b773d08 100644
---
a/ui-modules/blueprint-composer/app/components/designer/designer.directive.js
+++
b/ui-modules/blueprint-composer/app/components/designer/designer.directive.js
@@ -56,12 +56,18 @@ export function designerDirective($log, $state, $q,
iconGenerator, catalogApi, b
(composerOverrides.configureDesignerDirective || function ()
{})($scope, $element, blueprintGraph);
$scope.blueprint = blueprintService.get();
- $scope.$watch('blueprint', () => {
- redrawGraph();
- }, true);
blueprintService.refreshBlueprintMetadata().then(() => {
redrawGraph();
+
+ // Start watching blueprint changes after metadata is refreshed.
Metadata is changed many times while being
+ // refreshed, no need to re-draw on every change.
+ $scope.$watch('blueprint', () => {
+ redrawGraph();
+ }, true);
+
+ // Broadcast 'metadata-refreshed' event (downstream might listen
to this event).
+ $scope.$broadcast('d3.metadata-refreshed');
});
$scope.selectedEntity = null;