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 3c2649e46bca57d4dc8536c5787c5699fedfbeb8 Author: Alex Heneveld <[email protected]> AuthorDate: Thu Oct 20 13:33:21 2022 +0100 improve task filters - subtasks, scheduled, initialization --- .../components/task-list/task-list.directive.js | 70 +++++++++++++++++++--- .../app/components/task-list/task-list.less | 35 ++++++++--- .../components/task-list/task-list.template.html | 8 +-- .../components/workflow/workflow-step.directive.js | 4 ++ .../workflow/workflow-step.template.html | 5 +- .../app/components/workflow/workflow-steps.less | 5 ++ .../inspect/activities/activities.controller.js | 8 +++ .../app/views/main/inspect/inspect.controller.js | 2 +- 8 files changed, 113 insertions(+), 24 deletions(-) diff --git a/ui-modules/app-inspector/app/components/task-list/task-list.directive.js b/ui-modules/app-inspector/app/components/task-list/task-list.directive.js index 5f12c8a4..4e0d754e 100644 --- a/ui-modules/app-inspector/app/components/task-list/task-list.directive.js +++ b/ui-modules/app-inspector/app/components/task-list/task-list.directive.js @@ -157,15 +157,25 @@ export function taskListDirective() { if ($scope.taskType) { selectFilter($scope.taskType); } else { - // defaults - selectFilter('EFFECTOR'); - selectFilter('WORKFLOW'); + if (!isActivityChildren) { + // defaults (when not in subtask view; in subtask view it is as above) + selectFilter('EFFECTOR'); + selectFilter('WORKFLOW'); + } else { + selectFilter('SUB-TASK'); + } } selectFilter("_workflowReplayedTopLevel"); selectFilter("_workflowNonLastReplayHidden"); + // pick other filter combos until we get some conetnt + if ($scope.tasksFilteredByTag.length==0) { + selectFilter('INITIALIZATION'); + } + if ($scope.tasksFilteredByTag.length==0) { + selectFilter("_anyTypeTag", true); + } if ($scope.tasksFilteredByTag.length==0) { - // if nothing found at top level then broaden selectFilter("_top", false); } @@ -215,6 +225,8 @@ export function taskListDirective() { globalFilters.transient.checked = !globalFilters.transient.include; setFiltersForTasks(scope, isActivityChildren); }, + category: 'status', + categoryForEvaluation: 'status-transient', }; globalFilters.transient.action(); } @@ -369,9 +381,18 @@ export function taskListDirective() { ...(extra || {}), } } - // put these first - addTagFilter('EFFECTOR', filtersFullList, 'Effectors', { displaySummary: 'effector', includeIfZero: true }); - addTagFilter('WORKFLOW', filtersFullList, 'Workflow', { includeIfZero: true }); + + // put these first if present, to get this order, then remove if false + if (!isActivityChildren) { + addTagFilter('EFFECTOR', filtersFullList, 'Effectors', {displaySummary: 'effector', includeIfZero: true}); + addTagFilter('WORKFLOW', filtersFullList, 'Workflow', { includeIfZero: true }); + } else { + filtersFullList['EFFECTOR'] = false; + filtersFullList['WORKFLOW'] = false; + } + filtersFullList['SENSOR'] = false; + filtersFullList['INITIALIZATION'] = false; + filtersFullList['SUB-TASK'] = false; // add filters for other tags tasks.forEach(t => @@ -379,6 +400,31 @@ export function taskListDirective() { addTagFilter(tag, filtersFullList, 'Tag: ' + tag.toLowerCase()) )); + ['EFFECTOR', 'WORKFLOW', 'SUB-TASK', 'SENSORS', 'INITIALIZATION'].forEach(t => { if (!filtersFullList[t]) delete filtersFullList[t]; }); + (filtersFullList['SUB-TASK'] || {}).display = 'Sub-tasks'; + (filtersFullList['SENSOR'] || {}).display = 'Sensors'; + (filtersFullList['INITIALIZATION'] || {}).display = 'Initialization'; + + filtersFullList['_active'] = { + display: 'Only show active tasks', + displaySummary: 'active', + filter: tasks => tasks.filter(t => !t.endTimeUtc || t.endTimeUtc<0), + category: 'status', + categoryForEvaluation: 'status-active', + } + filtersFullList['_scheduled_sub'] = { + display: 'Only show scheduled tasks', + displaySummary: 'scheduled', + filter: tasks => tasks.filter(t => { + // show scheduled tasks (the parent) and each scheduled run, if sub-tasks are selected + if (!t || !t.submittedByTask) return false; + if (isScheduled(t)) return true; + let submitter = tasksById[t.submittedByTask.metadata.id]; + return isScheduled(submitter); + }), + category: 'status', + categoryForEvaluation: 'status-scheduled', + } const filterWorkflowsReplayedTopLevel = t => !t.isWorkflowFirstRun && t.isWorkflowLastRun && t.isWorkflowTopLevel; const countWorkflowsReplayedTopLevel = tasksAll.filter(filterWorkflowsReplayedTopLevel).length; @@ -525,8 +571,14 @@ function isTopLevelTask(t, tasksById) { if (t.forceTopLevel) return true; if (t.tags && t.tags.includes("TOP-LEVEL")) return true; let submitter = tasksById[t.submittedByTask.metadata.id]; - if (!submitter) return true; - if (isScheduled(submitter) && (!t.endTimeUtc || t.endTimeUtc<=0)) return true; + + // we could include those which are submitted but the submitter is forgotten + // (but they are accesible as CrossEntity or NestedSameEntity so don't include for now) + //if (!submitted) return true; + + // active scheduled tasks + //if (isScheduled(submitter) && (!t.endTimeUtc || t.endTimeUtc<=0)) return true; + return false; } function isNonTopLevelTask(t, tasksById) { diff --git a/ui-modules/app-inspector/app/components/task-list/task-list.less b/ui-modules/app-inspector/app/components/task-list/task-list.less index a111b031..19a3db97 100644 --- a/ui-modules/app-inspector/app/components/task-list/task-list.less +++ b/ui-modules/app-inspector/app/components/task-list/task-list.less @@ -20,17 +20,18 @@ task-list { display: block; position: relative; - i.sub-task-link { - font-size: 40px; - color: @brand-primary; - } - brooklyn-status-icon { margin-right: 15px; width: 30px; height: 30px; display: block; } + + i.sub-task-link { + font-size: 40px; + color: @brand-primary; + } + .custom-status-task-icon { color: @brand-success; } @@ -213,15 +214,33 @@ task-list { } - &.status a { - padding-top: 0; - padding-bottom: 0; + &.status { + a { + padding-top: 0; + padding-bottom: 0; + + display: flex; + justify-content: center; + + brooklyn-status-icon { + margin: 0; + width: 24px; + height: 24px; + } + } } + + &.no-tasks-found { + padding: 24px; + font-size: 125%; + } + } tr > td > a:hover { text-decoration: none; } + } .no-activities { diff --git a/ui-modules/app-inspector/app/components/task-list/task-list.template.html b/ui-modules/app-inspector/app/components/task-list/task-list.template.html index 02679002..76cd8c5f 100644 --- a/ui-modules/app-inspector/app/components/task-list/task-list.template.html +++ b/ui-modules/app-inspector/app/components/task-list/task-list.template.html @@ -77,7 +77,7 @@ <table class="table table-bordered"> <thead> <tr> - <th> + <th style="text-align: center;"> Status </th> <th> @@ -125,11 +125,11 @@ </tr> {{ model.filterResult = filterResult; "comment: update those interested in the result of the filter"; "" }} <tr ng-if="filterResult.length == 0 "> - <td colspan="4" class="text-center"><h4> + <td colspan="4" class="text-center no-tasks-found"> No tasks found matching <span ng-if="filterValue">current search <code>{{filterValue}}</code> and</span> - filter <code>{{filters.selectedDisplayName}}</code> - </h4></td> + filter options + </td> </tr> </tbody> </table> 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 1171d247..39bd3a64 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 @@ -90,6 +90,10 @@ export function workflowStepDirective() { $scope.stepTitle.code = step.shorthandTypeName || step.type || ''; if (step.input) $scope.stepTitle.code += ' ...'; } + if ("workflow" === $scope.stepTitle.code) { + $scope.stepTitle.code = null; + $scope.stepTitle.leftExtra = "nested workflow"; + } if (step.name) { $scope.stepTitle.name = step.name; 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 97a51d61..4480b0c7 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 @@ -52,7 +52,8 @@ <div class="step-block-title"> <span class="step-index">{{ stepTitle.index }}</span> - <span class="step-title-code">{{ stepTitle.code }}</span> + <span ng-if="stepTitle.code" class="step-title-code">{{ stepTitle.code }}</span> + <span ng-if="stepTitle.leftExtra" class="step-left-extra">{{ stepTitle.leftExtra}}</span> </div> <div ng-if="expanded" class="step-details"> @@ -128,7 +129,7 @@ <div class="more-space-above" ng-if="stepContext.taskId"> <div class="data-row"> - <div class="A"><span ng-if="isCurrentAndActive">CURRENT</span><span ng-if="!isCurrent">LAST</span> EXECUTION</div> + <div class="A"><span ng-if="isCurrentAndActive">CURRENT</span><span ng-if="!isCurrentAndActive">LAST</span> EXECUTION</div> <div class="B"> <span ng-if="isFocusTask"> task <span class="monospace">{{ stepContext.taskId }}</span> diff --git a/ui-modules/app-inspector/app/components/workflow/workflow-steps.less b/ui-modules/app-inspector/app/components/workflow/workflow-steps.less index 9948ee90..e1fda49f 100644 --- a/ui-modules/app-inspector/app/components/workflow/workflow-steps.less +++ b/ui-modules/app-inspector/app/components/workflow/workflow-steps.less @@ -90,6 +90,11 @@ font-weight: 300; color: @gray-light; } + .step-left-extra { + font-size: 90%; + //font-weight: 300; + color: @gray-light; + } } .step-details { diff --git a/ui-modules/app-inspector/app/views/main/inspect/activities/activities.controller.js b/ui-modules/app-inspector/app/views/main/inspect/activities/activities.controller.js index b005142f..2ec31d57 100644 --- a/ui-modules/app-inspector/app/views/main/inspect/activities/activities.controller.js +++ b/ui-modules/app-inspector/app/views/main/inspect/activities/activities.controller.js @@ -195,5 +195,13 @@ export function makeTaskStubFromWorkflowRecord(wf, wft) { }, ], }; + if (wft.submittedByTaskId) { + result.submittedByTask = { + metadata: { + id: wft.submittedByTaskId, + entityId: result.entityId, + } + }; + } return result; }; diff --git a/ui-modules/app-inspector/app/views/main/inspect/inspect.controller.js b/ui-modules/app-inspector/app/views/main/inspect/inspect.controller.js index 04808be3..636825e9 100644 --- a/ui-modules/app-inspector/app/views/main/inspect/inspect.controller.js +++ b/ui-modules/app-inspector/app/views/main/inspect/inspect.controller.js @@ -153,7 +153,7 @@ export function runWorkflowController($scope, $http, $uibModalInstance, applicat function runWorkflow() { $scope.running = true; $scope.errorMessage = null; - $http.post('/v1/applications/' + applicationId + '/entities/' + entityId + '/workflow?start=true&timeout=20ms', $scope.workflowYaml) + $http.post('/v1/applications/' + applicationId + '/entities/' + entityId + '/workflows?start=true&timeout=20ms', $scope.workflowYaml) .then((response)=> { $scope.running = false; $uibModalInstance.close(response.data);
