mirror of
https://github.com/ansible/awx.git
synced 2026-05-11 19:37:38 -02:30
Fixing recent jobs & recent syncs tooltip for inventories
This commit is contained in:
@@ -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,44 +243,62 @@ function InventoriesList($scope, $rootScope, $location, $log,
|
|||||||
});
|
});
|
||||||
|
|
||||||
$scope.showGroupSummary = function(event, id) {
|
$scope.showGroupSummary = function(event, id) {
|
||||||
var inventory;
|
try{
|
||||||
if (!Empty(id)) {
|
var elem = $(event.target).parent();
|
||||||
inventory = Find({ list: $scope.inventories, key: 'id', val: id });
|
// if the popover is visible already, then exit the function here
|
||||||
if (inventory.syncStatus !== 'na') {
|
if(elem.data()['bs.popover'].tip().hasClass('in')){
|
||||||
Wait('start');
|
return;
|
||||||
Rest.setUrl(inventory.related.inventory_sources + '?or__source=ec2&or__source=rax&order_by=-last_job_run&page_size=5');
|
}
|
||||||
Rest.get()
|
}
|
||||||
.success(function(data) {
|
catch(err){
|
||||||
$scope.$emit('GroupSummaryReady', event, inventory, data);
|
var inventory;
|
||||||
})
|
if (!Empty(id)) {
|
||||||
.error(function(data, status) {
|
inventory = Find({ list: $scope.inventories, key: 'id', val: id });
|
||||||
ProcessErrors( $scope, data, status, null, { hdr: 'Error!',
|
if (inventory.syncStatus !== 'na') {
|
||||||
msg: 'Call to ' + inventory.related.inventory_sources + ' failed. GET returned status: ' + status
|
Wait('start');
|
||||||
|
Rest.setUrl(inventory.related.inventory_sources + '?or__source=ec2&or__source=rax&order_by=-last_job_run&page_size=5');
|
||||||
|
Rest.get()
|
||||||
|
.success(function(data) {
|
||||||
|
$scope.$emit('GroupSummaryReady', event, inventory, data);
|
||||||
|
})
|
||||||
|
.error(function(data, status) {
|
||||||
|
ProcessErrors( $scope, data, status, null, { hdr: 'Error!',
|
||||||
|
msg: 'Call to ' + inventory.related.inventory_sources + ' failed. GET returned status: ' + status
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.showHostSummary = function(event, id) {
|
$scope.showHostSummary = function(event, id) {
|
||||||
var url, inventory;
|
try{
|
||||||
if (!Empty(id)) {
|
var elem = $(event.target).parent();
|
||||||
inventory = Find({ list: $scope.inventories, key: 'id', val: id });
|
// if the popover is visible already, then exit the function here
|
||||||
if (inventory.total_hosts > 0) {
|
if(elem.data()['bs.popover'].tip().hasClass('in')){
|
||||||
Wait('start');
|
return;
|
||||||
url = GetBasePath('jobs') + "?type=job&inventory=" + id + "&failed=";
|
}
|
||||||
url += (inventory.has_active_failures) ? 'true' : "false";
|
}
|
||||||
url += "&order_by=-finished&page_size=5";
|
catch(err){
|
||||||
Rest.setUrl(url);
|
var url, inventory;
|
||||||
Rest.get()
|
if (!Empty(id)) {
|
||||||
.success( function(data) {
|
inventory = Find({ list: $scope.inventories, key: 'id', val: id });
|
||||||
$scope.$emit('HostSummaryReady', event, data);
|
if (inventory.total_hosts > 0) {
|
||||||
})
|
Wait('start');
|
||||||
.error( function(data, status) {
|
url = GetBasePath('jobs') + "?type=job&inventory=" + id + "&failed=";
|
||||||
ProcessErrors( $scope, data, status, null, { hdr: 'Error!',
|
url += (inventory.has_active_failures) ? 'true' : "false";
|
||||||
msg: 'Call to ' + url + ' failed. GET returned: ' + status
|
url += "&order_by=-finished&page_size=5";
|
||||||
|
Rest.setUrl(url);
|
||||||
|
Rest.get()
|
||||||
|
.success( function(data) {
|
||||||
|
$scope.$emit('HostSummaryReady', event, data);
|
||||||
|
})
|
||||||
|
.error( function(data, status) {
|
||||||
|
ProcessErrors( $scope, data, status, null, { hdr: 'Error!',
|
||||||
|
msg: 'Call to ' + url + ' failed. GET returned: ' + status
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user