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 2024/03/21 16:42:26 UTC

(brooklyn-ui) 01/02: better rendering of switch statements

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 d6a83a2584e5416a71baac4714f73338e6671569
Author: Alex Heneveld <al...@cloudsoft.io>
AuthorDate: Wed Mar 20 16:22:54 2024 +0000

    better rendering of switch statements
---
 .../app/components/workflow/workflow-step.directive.js    | 15 +++++++++++++++
 .../app/components/workflow/workflow-step.template.html   | 15 ++++++++++++---
 2 files changed, 27 insertions(+), 3 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 a7898a6d..7a618c80 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
@@ -190,6 +190,21 @@ export function workflowStepDirective() {
                 $scope.isFocusTask = false;
                 $scope.isErrorHandler = $scope.workflow.tag && ($scope.workflow.tag.errorHandlerForTask);
 
+                // for switch, possibly others -- the step task wraps a chosen step task;
+                // show details for the wrapped chosen task, without showing weird messages
+                $scope.otherMetadata = Object.assign({}, $scope.stepContext.otherMetadata || {});
+                if ($scope.stepContext.stepState && $scope.stepContext.stepState.selectedStepContext) {
+                    $scope.innerStepContext = $scope.stepContext.stepState.selectedStepContext;
+                    $scope.outerStepContext = $scope.stepContext;
+                    $scope.isWrappingStepTaskOuter = $scope.task && $scope.stepContext.taskId == $scope.task.id;
+                    $scope.stepContext = $scope.stepContext.stepState.selectedStepContext;
+                    $scope.otherMetadata = Object.assign($scope.otherMetadata, $scope.stepContext.otherMetadata || {});
+                    $scope.isWrappingStepTaskInner = $scope.task && $scope.stepContext.taskId == $scope.task.id;
+                    if ($scope.isWrappingStepTaskOuter || $scope.isWrappingStepTaskInner) {
+                        $scope.isFocusTask = true;
+                    }
+                }
+
                 if ($scope.task) {
                     if (!vm.isNullish($scope.stepContext.taskId) && $scope.stepContext.taskId === $scope.task.id) {
                         $scope.isFocusTask = true;
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 c8d226fc..6c8c9568 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
@@ -117,7 +117,16 @@
                         </span>
 
                         <span ng-if="isFocusTask">
-                            in task <span class="monospace">{{ stepContext.taskId }}</span> which is the one currently loaded on this page.
+                            <span ng-if="isWrappingStepTaskOuter || isWrappingStepTaskInner">
+                                in task <span class="monospace">{{ outerStepContext.taskId }}</span>
+                                selecting <span
+                                    ng-if="otherMetadata['Switch match']"><b> {{ otherMetadata['Switch match'] }}</b> in </span>
+                                task <span class="monospace">{{ innerStepContext.taskId }}</span>,
+                                currently loaded on this page.
+                            </span>
+                            <span ng-if="!(isWrappingStepTaskOuter || isWrappingStepTaskInner)">
+                                in task <span class="monospace">{{ stepContext.taskId }}</span> which is the one currently loaded on this page.
+                            </span>
                             The other sections on this page pertain specifically to this step.
                         </span>
                         <span ng-if="!isFocusTask">
@@ -144,7 +153,7 @@
                     >.
                 </div>
 
-                <div ng-if="isFocusStep && !isFocusTask && !isErrorHandler" class="space-above">
+                <div ng-if="!isWrappingStepTaskOuter && !isWrappingStepTaskInner && isFocusStep && !isFocusTask && !isErrorHandler" class="space-above">
                     <b>The task currently loaded on this page (<span class="monospace">{{ task.id }}</span>) is for a previous run of this step.</b>
                 </div>
 
@@ -195,7 +204,7 @@
                     <div class="data-row" ng-if="showStepDefinitionInBody"><div class="A">Step Definition</div> <div class="B {{ vm.classForCodeMaybeMultiline(step) }}">{{ vm.yamlOrPrimitive(step) }}</div></div>
 
                     <div ng-if="!isFocusStep || isFocusTask">
-                        <div class="data-row" ng-if="stepContext.otherMetadata" ng-repeat="(key,value) in stepContext.otherMetadata" id="$key">
+                        <div class="data-row" ng-if="otherMetadata" ng-repeat="(key,value) in otherMetadata" id="$key">
                             <div class="A">{{ key }}</div> <div class="B {{ vm.classForCodeMaybeMultiline(value) }}">{{ vm.yamlOrPrimitive(value) }}</div>
                         </div>