diff --git a/awx/ui/client/src/inventories-hosts/inventories/list/host-summary-popover/host-summary-popover.controller.js b/awx/ui/client/src/inventories-hosts/inventories/list/host-summary-popover/host-summary-popover.controller.js index 3db9145d61..9072497580 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/list/host-summary-popover/host-summary-popover.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/list/host-summary-popover/host-summary-popover.controller.js @@ -25,16 +25,5 @@ export default [ '$scope', 'Empty', 'Wait', 'GetBasePath', 'Rest', 'ProcessError } } }; - - $scope.viewJob = function(jobId, type) { - let outputType = 'playbook'; - - if (type === 'workflow_job') { - $state.go('workflowResults', { id: jobId}, { reload: true }); - } else { - $state.go('output', { id: jobId, type: outputType }); - } - }; - } ]; diff --git a/awx/ui/client/src/inventories-hosts/inventories/list/host-summary-popover/host-summary-popover.directive.js b/awx/ui/client/src/inventories-hosts/inventories/list/host-summary-popover/host-summary-popover.directive.js index 82d598bfa6..0bfaaefddb 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/list/host-summary-popover/host-summary-popover.directive.js +++ b/awx/ui/client/src/inventories-hosts/inventories/list/host-summary-popover/host-summary-popover.directive.js @@ -1,5 +1,5 @@ -export default ['templateUrl', 'Wait', '$filter', '$compile', 'i18n', - function(templateUrl, Wait, $filter, $compile, i18n) { +export default ['templateUrl', 'Wait', '$filter', '$compile', 'i18n', '$log', + function(templateUrl, Wait, $filter, $compile, i18n, $log) { return { restrict: 'E', replace: false, @@ -19,19 +19,20 @@ export default ['templateUrl', 'Wait', '$filter', '$compile', 'i18n', function attachElem(event, html, title) { var elem = $(event.target).parent(); + try { elem.tooltip('hide'); - elem.popover('destroy'); + elem.popover('dispose'); } catch(err) { - //ignore + $log.debug(error); } $('.popover').each(function() { // remove lingering popover
. Seems to be a bug in TB3 RC1 $(this).remove(); }); $('.tooltip').each( function() { - // close any lingering tool tipss + // close any lingering tooltips $(this).hide(); }); elem.attr({ @@ -44,36 +45,59 @@ export default ['templateUrl', 'Wait', '$filter', '$compile', 'i18n', } scope.generateTable = function(data, event){ - var html, title = (scope.inventory.has_active_failures) ? "Recent Failed Jobs" : "Recent Successful Jobs"; + var html, title = (scope.inventory.has_active_failures) ? i18n._("Recent Failed Jobs") : i18n._("Recent Successful Jobs"); Wait('stop'); if (data.count > 0) { - html = "\n"; - html += "\n"; - html += ""; - html += ""; - html += ""; - html += ""; - html += "\n"; - html += "\n"; - html += "\n"; + html = ` +
" + i18n._("Status") + "" + i18n._("Finished") + "" + i18n._("Name") + "
+ + + + + + + + + `; data.results.forEach(function(row) { + let href = ''; + switch (row.type) { + case 'job': + case 'ad_hoc_command': + case 'system_job': + case 'project_update': + case 'inventory_update': + href = `#/jobs/${row.id}`; + break; + case 'workflow_job': + href = `#/workflows/${row.id}`; + break; + default: + break; + } if ((scope.inventory.has_active_failures && row.status === 'failed') || (!scope.inventory.has_active_failures && row.status === 'successful')) { - html += "\n"; - html += "\n"; - html += ""; - html += ""; - html += "\n"; + html += ` + + + + + + `; } }); - html += "\n"; - html += "
${i18n._("Status")}${i18n._("Finished")}${i18n._("Name")}
" + ($filter('longDate')(row.finished)) + "" + $filter('sanitize')(ellipsis(row.name)) + "
+ + + + ${($filter('longDate')(row.finished))} + ${$filter('sanitize')(ellipsis(row.name))} +
\n"; + html += ``; } else { - html = "

" + i18n._("No recent job data available for this inventory.") + "

\n"; + html = `

${i18n._("No recent job data available for this inventory.")}

`; } + attachElem(event, html, title); }; diff --git a/awx/ui/client/src/inventories-hosts/inventories/list/source-summary-popover/source-summary-popover.directive.js b/awx/ui/client/src/inventories-hosts/inventories/list/source-summary-popover/source-summary-popover.directive.js index ad91778a2d..0310e41146 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/list/source-summary-popover/source-summary-popover.directive.js +++ b/awx/ui/client/src/inventories-hosts/inventories/list/source-summary-popover/source-summary-popover.directive.js @@ -21,7 +21,7 @@ export default ['templateUrl', '$compile', 'Wait', '$filter', 'i18n', var elem = $(event.target).parent(); try { elem.tooltip('hide'); - elem.popover('destroy'); + elem.popover('dispose'); } catch(err) { //ignore diff --git a/awx/ui/client/src/organizations/linkout/controllers/organizations-inventories.controller.js b/awx/ui/client/src/organizations/linkout/controllers/organizations-inventories.controller.js index cf19755e77..236e2b0146 100644 --- a/awx/ui/client/src/organizations/linkout/controllers/organizations-inventories.controller.js +++ b/awx/ui/client/src/organizations/linkout/controllers/organizations-inventories.controller.js @@ -84,7 +84,7 @@ export default ['$scope', '$rootScope', '$location', var elem = $(event.target).parent(); try { elem.tooltip('hide'); - elem.popover('destroy'); + elem.popover('dispose'); } catch (err) { //ignore } diff --git a/awx/ui/client/src/vendor.js b/awx/ui/client/src/vendor.js index febd93d6e7..ca174440b5 100644 --- a/awx/ui/client/src/vendor.js +++ b/awx/ui/client/src/vendor.js @@ -33,6 +33,7 @@ $.fn.btn = btn; // Whitelist table elements so they can be used in popovers $.fn.popover.Constructor.Default.whiteList.table = []; +$.fn.popover.Constructor.Default.whiteList.th = []; $.fn.popover.Constructor.Default.whiteList.tr = []; $.fn.popover.Constructor.Default.whiteList.td = []; $.fn.popover.Constructor.Default.whiteList.tbody = [];