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/08/09 10:52:35 UTC
[brooklyn-ui] 01/04: Filter Scope in DSL editor by clicking on the
node on the canvas
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 e31eac8770c52d862d12af3aa514fb5c19ea331c
Author: Mykola Mandra <my...@cloudsoft.io>
AuthorDate: Fri Aug 6 17:37:33 2021 +0100
Filter Scope in DSL editor by clicking on the node on the canvas
Signed-off-by: Mykola Mandra <my...@cloudsoft.io>
---
.../app/components/designer/designer.directive.js | 11 ++++++++---
.../app/components/dsl-editor/dsl-editor.js | 12 ++++++++++++
2 files changed, 20 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 6c37d3f..0ca6061 100644
--- a/ui-modules/blueprint-composer/app/components/designer/designer.directive.js
+++ b/ui-modules/blueprint-composer/app/components/designer/designer.directive.js
@@ -31,12 +31,12 @@ const ANY_MEMBERSPEC_REGEX = /(^.*[m,M]ember[s,S]pec$)/;
const TAG = 'DIRECTIVE :: DESIGNER :: ';
angular.module(MODULE_NAME, [])
- .directive('designer', ['$log', '$state', '$q', 'iconGenerator', 'catalogApi', 'blueprintService', 'brSnackbar', 'paletteDragAndDropService', 'composerOverrides', designerDirective])
+ .directive('designer', ['$log', '$state', '$q', '$rootScope', 'iconGenerator', 'catalogApi', 'blueprintService', 'brSnackbar', 'paletteDragAndDropService', 'composerOverrides', designerDirective])
.run(['$templateCache', templateCache]);
export default MODULE_NAME;
-export function designerDirective($log, $state, $q, iconGenerator, catalogApi, blueprintService, brSnackbar, paletteDragAndDropService, composerOverrides) {
+export function designerDirective($log, $state, $q, $rootScope, iconGenerator, catalogApi, blueprintService, brSnackbar, paletteDragAndDropService, composerOverrides) {
return {
restrict: 'E',
templateUrl: function (tElement, tAttrs) {
@@ -157,7 +157,12 @@ export function designerDirective($log, $state, $q, iconGenerator, catalogApi, b
$log.debug(TAG + 'edit node ' + event.detail.entity._id, event.detail.entity);
switch (event.detail.entity.family) {
case EntityFamily.ENTITY:
- $state.go(graphicalEditEntityState, {entityId: event.detail.entity._id});
+ const blueprint = blueprintService.get();
+ if (blueprint.isInDslEdit) {
+ $rootScope.$broadcast('d3.entity-selected', event.detail.entity);
+ } else {
+ $state.go(graphicalEditEntityState, {entityId: event.detail.entity._id});
+ }
break;
case EntityFamily.SPEC:
$state.go(graphicalEditSpecState, {entityId: event.detail.entity.parent._id, specId: event.detail.entity._id});
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 a1cbebf..4022f2b 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
@@ -69,6 +69,18 @@ export function dslEditorDirective($rootScope, $filter, $log, brUtilsGeneral, bl
};
function link(scope) {
+
+ const blueprint = blueprintService.get();
+ blueprint.isInDslEdit = true;
+
+ scope.$on('$destroy', () => {
+ blueprint.isInDslEdit = false;
+ });
+
+ scope.$on('d3.entity-selected', (event, entity) => {
+ scope.state.filter = scope.filters.find(filter => filter.id === entity._id);
+ });
+
scope.DSL_KINDS = DSL_KINDS;
scope.kinds = Object.values(DSL_KINDS);