diff --git a/awx/ui/client/src/portal-mode/portal-jobs.list.js b/awx/ui/client/src/portal-mode/portal-jobs.list.js index e2d74c6c21..874b614952 100644 --- a/awx/ui/client/src/portal-mode/portal-jobs.list.js +++ b/awx/ui/client/src/portal-mode/portal-jobs.list.js @@ -24,7 +24,10 @@ export default ['i18n', function(i18n) { dataTitle: "{{ job.status_popover_title }}", icon: 'icon-job-{{ job.status }}', iconOnly: true, - nosort: true + nosort: true, + awTipPlacement: "top", + awToolTip: "{{ job.status_tip }}", + dataTipWatch: 'job.status_tip', }, name: { label: i18n._('Name'), diff --git a/awx/ui/client/src/portal-mode/portal-mode-jobs.controller.js b/awx/ui/client/src/portal-mode/portal-mode-jobs.controller.js index 8f747f34ca..f23a1fe55d 100644 --- a/awx/ui/client/src/portal-mode/portal-mode-jobs.controller.js +++ b/awx/ui/client/src/portal-mode/portal-mode-jobs.controller.js @@ -36,6 +36,46 @@ export function PortalModeJobsController($scope, $state, qs, GetBasePath, Portal $scope.refresh = function() { $state.go('.', null, {reload: true}); }; + + $scope.$on(`${list.iterator}_options`, function(event, data){ + $scope.options = data.data.actions.GET; + optionsRequestDataProcessing(); + }); + + $scope.$watchCollection(`${$scope.list.name}`, function() { + optionsRequestDataProcessing(); + } + ); + + // iterate over the list and add fields like type label, after the + // OPTIONS request returns, or the list is sorted/paginated/searched + function optionsRequestDataProcessing(){ + + if($scope[list.name] && $scope[list.name].length > 0) { + $scope[list.name].forEach(function(item, item_idx) { + var itm = $scope[list.name][item_idx]; + + if(item.summary_fields && item.summary_fields.source_workflow_job && + item.summary_fields.source_workflow_job.id){ + item.workflow_result_link = `/#/workflows/${item.summary_fields.source_workflow_job.id}`; + } + + // Set the item type label + if (list.fields.type && $scope.options && + $scope.options.hasOwnProperty('type')) { + $scope.options.type.choices.forEach(function(choice) { + if (choice[0] === item.type) { + itm.type_label = choice[1]; + } + }); + } + buildTooltips(itm); + }); + } + } + function buildTooltips(job) { + job.status_tip = `Job ${job.status}. Click for details.`; + } } PortalModeJobsController.$inject = ['$scope', '$state', 'QuerySet', 'GetBasePath', 'PortalJobsList', 'jobsDataset'];