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 17fbc5e6937ab834b7a267cff259da91b0e66847 Author: Alex Heneveld <[email protected]> AuthorDate: Sun Jun 18 03:22:47 2023 +0100 options for showing/hiding scheduled tasks --- .../components/task-list/task-list.directive.js | 65 ++++++++++++++++------ .../components/task-list/task-list.template.html | 4 +- ui-modules/utils/status/status.js | 2 + ui-modules/utils/status/status.less | 5 ++ ui-modules/utils/status/status.template.html | 10 ++++ 5 files changed, 66 insertions(+), 20 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 a76c11f4..f595e5b8 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 @@ -93,8 +93,16 @@ export function taskListDirective() { }; $scope.recomputeTasks = () => { $scope.tasksFilteredByTag = $scope.findTasksExcludingCategory( - tasksAfterGlobalFilters($scope.tasks, $scope.globalFilters), - $scope.filters.selectedFilters, ''); + tasksAfterGlobalFilters($scope.tasks, $scope.globalFilters), + $scope.filters.selectedFilters, '') + .sort((t1,t2) => { + if (!t1.endTimeUtc || !t2.endTimeUtc) { + if (!t1.endTimeUtc && !t2.endTimeUtc) return t2.startTimeUtc - t1.startTimeUtc; + if (t1.endTimeUtc) return 1; + return -1; + } + return t2.endTimeUtc - t1.endTimeUtc; + }); // do this to update the counts setFiltersForTasks($scope, isActivityChildren); @@ -172,6 +180,7 @@ export function taskListDirective() { selectFilter('_all_effectors'); selectFilter('EFFECTOR'); selectFilter('WORKFLOW'); + selectFilter('_scheduled'); } else { selectFilter('SUB-TASK'); } @@ -359,18 +368,18 @@ export function taskListDirective() { onEnabledPre: clearOther('_top'), onDisabledPost: enableFilterIfCategoryEmpty('_top'), } - filtersFullList['_recursive'] = { - display: 'Include sub-tasks on this entity', - displaySummary: 'sub-tasks', - filter: filterNestedSameEntityTasks, + filtersFullList['_all_effectors'] = { + display: 'Include effector sub-tasks', + displaySummary: 'effectors', + filter: filterForTasksWithTag('EFFECTOR'), category: 'nested', onEnabledPre: clearOther('_top'), onDisabledPost: enableFilterIfCategoryEmpty('_top'), } - filtersFullList['_all_effectors'] = { - display: 'Include non-top-level effectors', - displaySummary: 'effectors', - filter: filterForTasksWithTag('EFFECTOR'), + filtersFullList['_recursive'] = { + display: 'Include all sub-tasks', + displaySummary: 'sub-tasks', + filter: filterNestedSameEntityTasks, category: 'nested', onEnabledPre: clearOther('_top'), onDisabledPost: enableFilterIfCategoryEmpty('_top'), @@ -395,6 +404,15 @@ export function taskListDirective() { onDisabledPost: enableOthersIfCategoryEmpty('_anyTypeTag'), } + filtersFullList['_scheduled'] = { + display: 'Scheduled', + displaySummary: 'scheduled', + filter: tasks => tasks.filter(t => isScheduled(t)), + category: 'type-tag', + onEnabledPre: clearOther('_anyTypeTag'), + onDisabledPost: enableFilterIfCategoryEmpty('_anyTypeTag'), + } + function addTagFilter(tag, target, display, extra) { if (!target[tag]) target[tag] = { display: display, @@ -439,19 +457,27 @@ export function taskListDirective() { categoryForEvaluation: 'status-active', } filtersFullList['_scheduled_sub'] = { - display: 'Only show scheduled tasks', + display: 'Only show scheduled/repeating 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); + // if (!t || !t.submittedByTask) return false; // omit the parent + if (isScheduled(t, taskId => tasksById[taskId])) return true; }), category: 'status', categoryForEvaluation: 'status-scheduled', + onEnabledPre: clearOther('_non_scheduled_sub'), + } + filtersFullList['_non_scheduled_sub'] = { + display: 'Exclude scheduled/repeating tasks', + displaySummary: 'non-repeating', + filter: tasks => tasks.filter(t => { + return !isScheduled(t, taskId => tasksById[taskId]); + }), + category: 'status', + categoryForEvaluation: 'status-scheduled', + onEnabledPre: clearOther('_scheduled_sub'), } - const filterWorkflowsReplayedTopLevel = t => !t.isWorkflowFirstRun && t.isWorkflowLastRun && t.isWorkflowTopLevel; const countWorkflowsReplayedTopLevel = tasksAll.filter(filterWorkflowsReplayedTopLevel).length; @@ -606,8 +632,11 @@ export function taskListDirective() { const filterWorkflowsReplayedNested = t => !t.isWorkflowFirstRun && t.isWorkflowLastRun && !t.isWorkflowTopLevel; -function isScheduled(task) { - return task && task.currentStatus && task.currentStatus.startsWith("Schedule"); +function isScheduled(task, optionalSubmitterFnIfSubmittersWanted) { + if (task && task.currentStatus && task.currentStatus.startsWith("Schedule")) return true; + if (!task || !task.submittedByTask || !optionalSubmitterFnIfSubmittersWanted) return false; + let submitter = optionalSubmitterFnIfSubmittersWanted(task.submittedByTask.metadata.id); + return isScheduled(submitter, optionalSubmitterFnIfSubmittersWanted); } function isTopLevelTask(t, tasksById) { 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 76cd8c5f..e32d048f 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 @@ -95,8 +95,8 @@ <tr ng-repeat="task in tasksFilteredByTag | activityFilter:filterValue as filterResult track by task.id"> <td class="status"> <a ui-sref="main.inspect.activities.detail({entityId: task.entityId, activityId: task.id, workflowId: getTaskWorkflowId(task)})"> - <brooklyn-status-icon value="{{task.currentStatus}}" ng-if="!isScheduled(task)"></brooklyn-status-icon> - <span ng-if="isScheduled(task)" class="custom-status-task-icon"><i class="fa fa-clock-o" style="font-size: 250%;"></i></span> + <brooklyn-status-icon value="{{isScheduled(task) ? 'Scheduled' : task.currentStatus}}" + class="scheduled-icon-as-success"></brooklyn-status-icon> </a> </td> <td class="name"> diff --git a/ui-modules/utils/status/status.js b/ui-modules/utils/status/status.js index cf26b45a..79621e8b 100644 --- a/ui-modules/utils/status/status.js +++ b/ui-modules/utils/status/status.js @@ -30,6 +30,7 @@ const ICONS = { NO_STATE: 'NO_STATE', COMPLETED: 'COMPLETED', FAILED: 'FAILED', + SCHEDULED: 'SCHEDULED', }; const STATUS = { @@ -49,6 +50,7 @@ const STATUS = { 'Failed': {name: 'Failed', icon: ICONS.FAILED}, 'Unavailable': {name: 'Incomplete', icon: ICONS.FAILED}, 'Cancelled': {name: 'Cancelled', icon: ICONS.FAILED}, + 'Scheduled': {name: 'Scheduled', icon: ICONS.SCHEDULED}, }; const MODULE_NAME = 'brooklyn.components.status'; diff --git a/ui-modules/utils/status/status.less b/ui-modules/utils/status/status.less index 7d1531b6..d2bd13f1 100644 --- a/ui-modules/utils/status/status.less +++ b/ui-modules/utils/status/status.less @@ -52,6 +52,11 @@ brooklyn-status-icon { } } +.scheduled-icon-as-success { + .status-scheduled { + color: @brand-success; + } +} brooklyn-status { display: flex; diff --git a/ui-modules/utils/status/status.template.html b/ui-modules/utils/status/status.template.html index 0b43b21b..020cef91 100644 --- a/ui-modules/utils/status/status.template.html +++ b/ui-modules/utils/status/status.template.html @@ -81,6 +81,16 @@ </svg> </div> + <div ng-switch-when="SCHEDULED"> + <svg viewBox="20 20 60 60"> + <foreignObject x="20" y="20" width="100" height="100"> + <body> + <i class="fa fa-clock-o"></i> + </body> + </foreignObject> + </svg> + </div> + <div ng-switch-when="UNKNOWN"> <svg id="168033fd-2902-4e00-8797-d9d22be6bcd3" data-name="icon-unknown" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
