diff --git a/awx/ui/static/js/controllers/Inventories.js b/awx/ui/static/js/controllers/Inventories.js index 894d71209f..c8f5170d14 100644 --- a/awx/ui/static/js/controllers/Inventories.js +++ b/awx/ui/static/js/controllers/Inventories.js @@ -22,6 +22,35 @@ function InventoriesList($scope, $rootScope, $location, $log, $routeParams, $com paths = $location.path().replace(/^\//, '').split('/'), mode = (paths[0] === 'inventories') ? 'edit' : 'select'; + function ellipsis(a) { + if (a.length > 20) { + return a.substr(0,20) + '...'; + } + return a; + } + + function attachElem(event, html, title) { + var elem = $(event.target).parent(); + try { + elem.tooltip('hide'); + elem.popover('destroy'); + } + catch(err) { + //ignore + } + elem.attr({ "aw-pop-over": html, "data-title": title, "data-placement": "right" }); + $compile(elem)($scope); + elem.on('shown.bs.popover', function() { + $('.popover').each(function() { + $compile($(this))($scope); //make nested directives work! + }); + $('.popover-content, .popover-title').click(function() { + elem.popover('hide'); + }); + }); + elem.popover('show'); + } + view.inject(InventoryList, { mode: mode, scope: $scope }); $rootScope.flashMessage = null; @@ -31,6 +60,7 @@ function InventoriesList($scope, $rootScope, $location, $log, $routeParams, $com list: list, url: defaultUrl }); + PaginateInit({ scope: $scope, list: list, @@ -128,63 +158,77 @@ function InventoriesList($scope, $rootScope, $location, $log, $routeParams, $com $scope.search(list.iterator); }); + if ($scope.removeHostSummaryReady) { + $scope.removeHostSummaryReady(); + } + $scope.removeHostSummaryReady = $scope.$on('HostSummaryReady', function(e, event, data) { + + var html, title = "Recent Jobs"; + Wait('stop'); + if (data.count > 0) { + html = "
| Status | "; + html += "Finished | "; + html += "View | "; + html += "Name | "; + html += "
|---|---|---|---|
| \n"; + html += " | " + ($filter('date')(row.finished,'MM/dd HH:mm:ss')).replace(/ /,' ') + " | ";
+ html += "Events " + + "Hosts | ";
+ html += "" + ellipsis(row.name) + " | "; + html += "
No recent job data available for this inventory.
\n" + + "\n"; + } + attachElem(event, html, title); + }); if ($scope.removeGroupSummaryReady) { $scope.removeGroupSummaryReady(); } $scope.removeGroupSummaryReady = $scope.$on('GroupSummaryReady', function(e, event, inventory, data) { - var j, elem, html, title, row; + var html, title; - function ellipsis(a) { - if (a.length > 20) { - return a.substr(0,20) + '...'; - } - return a; - } + Wait('stop'); - if (data.count) { - html = "| Status | \n"; - html += "Group | \n"; - html += "Last Sync | \n"; + // Build the html for our popover + html = "
|---|
| Status | "; + html += "Last Sync | "; + html += "Group | "; + html += "
|---|---|---|
| "; + html += " | " + ($filter('date')(row.last_updated,'MM/dd HH:mm:ss')).replace(/ /,' ') + " | ";
+ html += "" + ellipsis(row.summary_fields.group.name) + " | "; html += "
| "; - html += " | " + ellipsis(row.summary_fields.group.name) + " | "; - html += "" + $filter('date')(row.last_updated,'MM/dd HH:mm:ss') + " | "; - html += "