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 2021/11/16 15:20:10 UTC
[brooklyn-ui] 01/03: Proper state change for all delete cases
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 78434ceb0a0f5bf4565daa328acb35be98ec7c73
Author: John Athanasiou <ja...@users.noreply.github.com>
AuthorDate: Wed Oct 27 18:23:44 2021 +0100
Proper state change for all delete cases
moved logic to deletion event consumer
removed conflicting state change from the spec editor's 'Delete' button press function
---
.../app/components/designer/designer.directive.js | 12 ++++--------
.../app/components/spec-editor/spec-editor.directive.js | 1 -
2 files changed, 4 insertions(+), 9 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 15593b3..f5c1c17 100644
--- a/ui-modules/blueprint-composer/app/components/designer/designer.directive.js
+++ b/ui-modules/blueprint-composer/app/components/designer/designer.directive.js
@@ -90,6 +90,9 @@ export function designerDirective($log, $state, $q, $rootScope, iconGenerator, c
switch (entity.family) {
case EntityFamily.ENTITY:
+ if (entity.hasParent()) {
+ $state.go(graphicalEditEntityState, { entityId: entity.parent._id })
+ }
entity.delete();
break;
case EntityFamily.POLICY:
@@ -164,7 +167,6 @@ export function designerDirective($log, $state, $q, $rootScope, iconGenerator, c
blueprintGraph.hideShadow();
blueprintGraph.dropShadow(clickedEntity._id);
} else {
- console.log('Entity parent', clickedEntity.hasParent(), clickedEntity.parent);
$state.go(graphicalEditEntityState, {entityId: clickedEntity._id});
}
break;
@@ -217,13 +219,7 @@ export function designerDirective($log, $state, $q, $rootScope, iconGenerator, c
$element.bind('delete-entity', function (event) {
$log.debug('delete-entity');
- const entityToDelete = event.detail.entity;
-
- if (entityToDelete.hasParent()) {
- $state.go(graphicalEditEntityState, { entityId: entityToDelete.parent._id });
- }
-
- $scope.$broadcast('d3.remove', entityToDelete);
+ $scope.$broadcast('d3.remove', event.detail.entity);
});
$element.bind('graph-redrawn', () => $scope.$root.$broadcast('layers.filter'));
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 23a59f2..fd8029f 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
@@ -494,7 +494,6 @@ export function specEditorDirective($rootScope, $templateCache, $injector, $sani
$rootScope.$broadcast('d3.remove', scope.model);
break;
}
- $state.go(graphicalState.name);
};
/**