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 70a0b9fda95aedbf819d32301c4182cd297b7180
Author: Alex Heneveld <a...@cloudsoft.io>
AuthorDate: Mon Mar 18 08:48:47 2024 +0000

    show better nested workflow names
---
 .../app/components/workflow/workflow-step.directive.js  | 17 +++++++++--------
 .../app/components/workflow/workflow-step.template.html | 17 ++++++++++-------
 2 files changed, 19 insertions(+), 15 deletions(-)

diff --git 
a/ui-modules/app-inspector/app/components/workflow/workflow-step.directive.js 
b/ui-modules/app-inspector/app/components/workflow/workflow-step.directive.js
index 87c200fe..a7898a6d 100644
--- 
a/ui-modules/app-inspector/app/components/workflow/workflow-step.directive.js
+++ 
b/ui-modules/app-inspector/app/components/workflow/workflow-step.directive.js
@@ -71,19 +71,20 @@ export function workflowStepDirective() {
             vm.isNullish = _.isNil;
 
             vm.getWorkflowNameFromReference = (ref, suffixIfFound) => {
-                // would be nice to get a name, but all we have is appId, 
entityId, workflowId; and no lookup table;
-                // could look it up or store at server, but seems like overkill
-                if (ref && $scope.task && $scope.task.children) {
-                  var matchingChild = $scope.task.children.find(c => 
c.metadata && c.metadata.id === ref.workflowId);
-                  if (matchingChild && matchingChild.metadata.taskName) {
-                    return matchingChild.metadata.taskName + (suffixIfFound ? 
" "+suffixIfFound+" " : "");
-                  }
+                if (ref) {
+                    if (ref.workflowName) return ref.workflowName;
+                    if ($scope.task && $scope.task.children) {
+                        var matchingChild = $scope.task.children.find(c => 
c.metadata && c.metadata.id === ref.workflowId);
+                        if (matchingChild && matchingChild.metadata.taskName) {
+                            return matchingChild.metadata.taskName + 
(suffixIfFound ? " " + suffixIfFound + " " : "");
+                        }
+                    }
                 }
                 return null;
             };
             vm.hasInterestingWorkflowNameFromReference = (ref, suffixIfFound) 
=> {
                 const wn = vm.getWorkflowNameFromReference(ref, suffixIfFound);
-                return wn && wn.toLowerCase()!='sub-workflow';
+                return wn && wn.toLowerCase()!='sub-workflow' && 
!wn.endsWith(' (sub-workflow)');
             };
             vm.classForCodeMaybeMultiline = (obj) => {
                 let os = vm.yamlOrPrimitive(obj);
diff --git 
a/ui-modules/app-inspector/app/components/workflow/workflow-step.template.html 
b/ui-modules/app-inspector/app/components/workflow/workflow-step.template.html
index b504f46d..c8d226fc 100644
--- 
a/ui-modules/app-inspector/app/components/workflow/workflow-step.template.html
+++ 
b/ui-modules/app-inspector/app/components/workflow/workflow-step.template.html
@@ -155,11 +155,12 @@
 
                             <button type="button" class="btn 
inline-button-small"
                                     
ui-sref="main.inspect.activities.detail({applicationId: 
stepContext.subWorkflows[0].applicationId, entityId: 
stepContext.subWorkflows[0].entityId, activityId: 
stepContext.subWorkflows[0].workflowId, workflowLatestRun: true})">
-                                {{ 
vm.hasInterestingWorkflowNameFromReference(stepContext.subWorkflows[0]) ?
-                                    '1 nested workflow: '+
-                                    
vm.getWorkflowNameFromReference(stepContext.subWorkflows[0])
-                                    : '1 nested workflow ' }}
-                                (<span class="monospace">{{ 
stepContext.subWorkflows[0].workflowId }}</span>)
+                                <span 
ng-if="vm.hasInterestingWorkflowNameFromReference(stepContext.subWorkflows[0])">
+                                    1 nested workflow: {{ 
vm.getWorkflowNameFromReference(stepContext.subWorkflows[0]) }}
+                                </span>
+                                <span 
ng-if="!vm.hasInterestingWorkflowNameFromReference(stepContext.subWorkflows[0])">
+                                    1 nested workflow <span 
class="monospace">{{ stepContext.subWorkflows[0].workflowId }}</span>
+                                </span>
                             </button>.
                         </span>
                         <span ng-if="stepContext.subWorkflows.length>1" 
class="space-above">
@@ -172,8 +173,10 @@
                                 <ul class="dropdown-menu" uib-dropdown-menu 
role="menu" aria-labelledby="nested-workflow-dropdown-button" style="width: 
auto; max-width: 40em;">
                                     <li role="menuitem" ng-repeat="sub in 
stepContext.subWorkflows" id="sub-workflow-{{ sub.workflowId }}">
                                         <a href="" 
ui-sref="main.inspect.activities.detail({applicationId: sub.applicationId, 
entityId: sub.entityId, activityId: sub.workflowId, workflowLatestRun: true})" 
style="padding-left: 9px; padding-right: 9px;">
-                                            <span>{{ 
vm.getWorkflowNameFromReference(sub, "-") }}</span>
-                                            <span class="monospace">{{ 
sub.workflowId }}</span>
+                                            <span 
ng-if="vm.hasInterestingWorkflowNameFromReference(stepContext.subWorkflows[0])">{{
+                                                
vm.getWorkflowNameFromReference(sub, "") }}</span>
+                                            <span 
ng-if="!vm.hasInterestingWorkflowNameFromReference(stepContext.subWorkflows[0])"
 class="monospace">{{
+                                                sub.workflowId }}</span>
                                     </a></li>
                                 </ul>
                             </div>.

Reply via email to