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 9f4d2dc6bfbd316b42f077754d35f58b4e1e9bba
Author: Alex Heneveld <[email protected]>
AuthorDate: Sat Jun 17 12:47:11 2023 +0100

    shorten name of classes shown by policies
---
 .../app/components/adjuncts-list/adjuncts-list.js         | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git 
a/ui-modules/app-inspector/app/components/adjuncts-list/adjuncts-list.js 
b/ui-modules/app-inspector/app/components/adjuncts-list/adjuncts-list.js
index 9f6646ec..5191a15d 100644
--- a/ui-modules/app-inspector/app/components/adjuncts-list/adjuncts-list.js
+++ b/ui-modules/app-inspector/app/components/adjuncts-list/adjuncts-list.js
@@ -51,13 +51,16 @@ function usefulName(name) {
     // TODO replace this with intermediate ellipsis?
     // cf https://codepen.io/markchitty/pen/RNZbRE
     // (also make sure things have nice names!)
-    
-    if (name.length>50 && name.length - name.lastIndexOf('.') > 10) {
-        name = name.substring(name.lastIndexOf('.')+1);
+  
+    // where names are java classes remove leading packages 
+    if (name.length>50) {
+      name = replaceStart(name, "org.apache.brooklyn.", "o.a.b.");
+      name = replaceStart(name, "o.a.b.enricher.stock.", "o.a.b.e.s.");
+      name = replaceStart(name, "o.a.b.entity.software.base.", "o.a.b.e.s.b.");
+      while (name.length>50 && !name.includes(' ') && name.includes('.') && 
name.length - name.indexOf('.') > 10) {
+        name = name.substring(name.indexOf('.')+1);
+      }
     }
-    name = replaceStart(name, "org.apache.brooklyn.", "o.a.b.");
-    name = replaceStart(name, "o.a.b.enricher.stock.", "o.a.b.e.s.");
-    name = replaceStart(name, "o.a.b.entity.software.base.", "o.a.b.e.s.b.");
     return name;
 }
 

Reply via email to