Fixing recent jobs & recent syncs tooltip for inventories

This commit is contained in:
Jared Tabor
2016-08-02 17:45:02 -07:00
parent 3f69be1a86
commit d848fcfc4f
2 changed files with 55 additions and 40 deletions

View File

@@ -50,16 +50,9 @@ function InventoriesList($scope, $rootScope, $location, $log,
"aw-pop-over": html, "aw-pop-over": html,
"data-popover-title": title, "data-popover-title": title,
"data-placement": "right" }); "data-placement": "right" });
elem.removeAttr('ng-click');
$compile(elem)($scope); $compile(elem)($scope);
elem.on('shown.bs.popover', function() { $scope.triggerPopover(event);
$('.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 }); view.inject(InventoryList, { mode: mode, scope: $scope });
@@ -250,6 +243,14 @@ function InventoriesList($scope, $rootScope, $location, $log,
}); });
$scope.showGroupSummary = function(event, id) { $scope.showGroupSummary = function(event, id) {
try{
var elem = $(event.target).parent();
// if the popover is visible already, then exit the function here
if(elem.data()['bs.popover'].tip().hasClass('in')){
return;
}
}
catch(err){
var inventory; var inventory;
if (!Empty(id)) { if (!Empty(id)) {
inventory = Find({ list: $scope.inventories, key: 'id', val: id }); inventory = Find({ list: $scope.inventories, key: 'id', val: id });
@@ -267,9 +268,18 @@ function InventoriesList($scope, $rootScope, $location, $log,
}); });
} }
} }
}
}; };
$scope.showHostSummary = function(event, id) { $scope.showHostSummary = function(event, id) {
try{
var elem = $(event.target).parent();
// if the popover is visible already, then exit the function here
if(elem.data()['bs.popover'].tip().hasClass('in')){
return;
}
}
catch(err){
var url, inventory; var url, inventory;
if (!Empty(id)) { if (!Empty(id)) {
inventory = Find({ list: $scope.inventories, key: 'id', val: id }); inventory = Find({ list: $scope.inventories, key: 'id', val: id });
@@ -290,6 +300,7 @@ function InventoriesList($scope, $rootScope, $location, $log,
}); });
} }
} }
}
}; };
$scope.viewJob = function(url) { $scope.viewJob = function(url) {

View File

@@ -576,6 +576,10 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'JobsHelper'])
template = '<div id="' + element[0].id + '_popover_container" class="popover" role="tooltip"><div class="arrow"></div><h3 id="' + element[0].id + '_popover_title" class="popover-title"></h3><div id="' + element[0].id + '_popover_content" class="popover-content"></div></div>'; template = '<div id="' + element[0].id + '_popover_container" class="popover" role="tooltip"><div class="arrow"></div><h3 id="' + element[0].id + '_popover_title" class="popover-title"></h3><div id="' + element[0].id + '_popover_content" class="popover-content"></div></div>';
} }
scope.triggerPopover = function(e){
showPopover(e);
};
if (attrs.awPopOverWatch) { if (attrs.awPopOverWatch) {
$(element).popover({ $(element).popover({
placement: placement, placement: placement,