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/03 10:37:47 UTC

[brooklyn-ui] 03/04: Display ID for all items in DSL editor search result

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 a6899562a7a127dac99f64040f90f8441bc7d305
Author: Mykola Mandra <my...@cloudsoft.io>
AuthorDate: Tue Aug 3 11:29:44 2021 +0100

    Display ID for all items in DSL editor search result
    
    Signed-off-by: Mykola Mandra <my...@cloudsoft.io>
---
 .../blueprint-composer/app/components/dsl-editor/dsl-editor.js | 10 +++-------
 .../app/components/dsl-editor/dsl-editor.template.html         |  2 +-
 2 files changed, 4 insertions(+), 8 deletions(-)

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 1cbcbb6..cf4b7b1 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
@@ -89,15 +89,11 @@ export function dslEditorDirective($rootScope, $filter, $log, brUtilsGeneral, bl
                 attrs.push('parent');
             }
 
-            let name = item.name;
-            if (attrs.length > 0) {
-                name += ` (${attrs.join(', ')})`;
-            } else {
-                name += ` (${item.entity.id || item.id})`;
-            }
+            let { name, entity, id } = item;
+            name += attrs.length > 0 ? ` (${attrs.join(', ')})` : ` (${entity.id || id})`;
 
             return {
-                id: item.id,
+                id,
                 label: name,
                 scope: 'On specific entity'
             };
diff --git a/ui-modules/blueprint-composer/app/components/dsl-editor/dsl-editor.template.html b/ui-modules/blueprint-composer/app/components/dsl-editor/dsl-editor.template.html
index 1291ca3..e8a54a3 100644
--- a/ui-modules/blueprint-composer/app/components/dsl-editor/dsl-editor.template.html
+++ b/ui-modules/blueprint-composer/app/components/dsl-editor/dsl-editor.template.html
@@ -60,11 +60,11 @@
                 <h4 class="list-group-item-heading">
                     <i class="fa" ng-class="{'fa-cog': item.type === DSL_KINDS.CONFIG, 'fa-rss': item.type === DSL_KINDS.SENSOR, 'fa-crosshairs': item.type === DSL_KINDS.ENTITY}"></i>
                     {{item.name}}
-                    <span ng-if="item.type === DSL_KINDS.ENTITY && item.entity.id">(ID: {{item.entity.id}})</span>
                 </h4>
                 <p class="list-group-item-entity text-right text-muted">
                     <img ng-src="{{item.entity.icon}}" alt="{{item.entity.miscData.get('typeName') || (item.entity | entityName) || 'New application'}} logo" class="list-group-item-entity-icon" />
                     {{item.entity.miscData.get('typeName') || (item.entity | entityName) || 'New application'}}
+                    <span ng-if="item.entity.id || item.entity._id">({{item.entity.id || item.entity._id}})</span>
                 </p>
             </a>