mirror of
https://github.com/ansible/awx.git
synced 2026-07-12 08:54:31 -02:30
AC-414 Making red/green bubbles consistent throughout the application. Changes made to Inventory and jobs pages. Tooltip text now dynamic. Improved deep linking, especially on status fields.
This commit is contained in:
@@ -12,13 +12,14 @@
|
||||
|
||||
function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, JobHostList,
|
||||
GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller,
|
||||
ClearScope, ProcessErrors, GetBasePath, Refresh)
|
||||
ClearScope, ProcessErrors, GetBasePath, Refresh, JobStatusToolTip)
|
||||
{
|
||||
ClearScope('htmlTemplate');
|
||||
var list = JobHostList;
|
||||
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||
var defaultUrl = GetBasePath(base) + $routeParams.id + '/job_host_summaries/';
|
||||
|
||||
var inventory_id;
|
||||
|
||||
// When viewing all summaries for a particular host, show job ID, otherwise row ID.
|
||||
if (base == 'hosts') {
|
||||
list.index = false;
|
||||
@@ -42,46 +43,71 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams,
|
||||
scope.host_id = null;
|
||||
}
|
||||
|
||||
if (scope.RemoveSetHostLink) {
|
||||
scope.RemoveSetHostLink();
|
||||
}
|
||||
scope.RemoveSetHostLink = scope.$on('setHostLink', function(e, inventory_id) {
|
||||
for (var i=0; i < scope.jobhosts.length; i++) {
|
||||
scope.jobhosts[i].hostLinkTo = '/#/inventories/' + inventory_id + '/hosts/?name=' +
|
||||
escape(scope.jobhosts[i].summary_fields.host.name);
|
||||
}
|
||||
});
|
||||
|
||||
// After a refresh, populate any needed summary field values on each row
|
||||
if (scope.PostRefreshRemove) {
|
||||
scope.PostRefreshRemove();
|
||||
}
|
||||
scope.PostRefershRemove = scope.$on('PostRefresh', function() {
|
||||
scope.PostRefreshRemove = scope.$on('PostRefresh', function() {
|
||||
|
||||
// Set status, tooltips, badget icons, etc.
|
||||
for( var i=0; i < scope.jobhosts.length; i++) {
|
||||
scope.jobhosts[i].host_name = scope.jobhosts[i].summary_fields.host.name;
|
||||
scope.jobhosts[i].status = (scope.jobhosts[i].failed) ? 'error' : 'success';
|
||||
scope.jobhosts[i].status = (scope.jobhosts[i].failed) ? 'failed' : 'success';
|
||||
scope.jobhosts[i].statusBadgeToolTip = JobStatusToolTip(scope.jobhosts[i].status) +
|
||||
" Click to view details.";
|
||||
scope.jobhosts[i].statusLinkTo = '/#/jobs/' + scope.jobhosts[i].job + '/job_events/?host=' +
|
||||
escape(scope.jobhosts[i].summary_fields.host.name);
|
||||
}
|
||||
|
||||
if (scope.job_id !== null && scope.job_id !== undefined && scope.job_id !== '') {
|
||||
// need job_status so we can show/hide refresh button
|
||||
Rest.setUrl(GetBasePath('jobs') + scope.job_id);
|
||||
Rest.get()
|
||||
.success( function(data, status, headers, config) {
|
||||
scope.job_status = data.status;
|
||||
scope.$emit('setHostLink', data.inventory);
|
||||
if (!(data.status == 'pending' || data.status == 'waiting' || data.status == 'running')) {
|
||||
if ($rootScope.timer) {
|
||||
clearInterval($rootScope.timer);
|
||||
}
|
||||
}
|
||||
})
|
||||
.error( function(data, status, headers, config) {
|
||||
.error( function(data, status, headers, config) {
|
||||
ProcessErrors(scope, data, status, null,
|
||||
{ hdr: 'Error!', msg: 'Failed to get job status for job: ' + scope.job_id + '. GET status: ' + status });
|
||||
});
|
||||
}
|
||||
if (base == 'hosts' && $routeParams['host_name']) {
|
||||
// Make the host name appear in breadcrumbs
|
||||
LoadBreadCrumbs({ path: '/hosts/' + scope['host_id'], title: $routeParams['host_name'] });
|
||||
}
|
||||
else {
|
||||
LoadBreadCrumbs();
|
||||
}
|
||||
});
|
||||
|
||||
SearchInit({ scope: scope, set: 'jobhosts', list: list, url: defaultUrl });
|
||||
PaginateInit({ scope: scope, list: list, url: defaultUrl });
|
||||
|
||||
// Called from Inventories tab, host failed events link:
|
||||
if ($routeParams.host) {
|
||||
if ($routeParams['host_name']) {
|
||||
scope[list.iterator + 'SearchField'] = 'host';
|
||||
scope[list.iterator + 'SearchValue'] = $routeParams.host;
|
||||
scope[list.iterator + 'SearchValue'] = $routeParams['host_name'];
|
||||
scope[list.iterator + 'SearchFieldLabel'] = list.fields['host'].label;
|
||||
}
|
||||
|
||||
scope.search(list.iterator);
|
||||
LoadBreadCrumbs();
|
||||
|
||||
|
||||
scope.showEvents = function(host_name, last_job) {
|
||||
// When click on !Failed Events link, redirect to latest job/job_events for the host
|
||||
@@ -113,5 +139,5 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams,
|
||||
|
||||
JobHostSummaryList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'JobHostList',
|
||||
'GenerateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope',
|
||||
'ProcessErrors', 'GetBasePath', 'Refresh'
|
||||
'ProcessErrors', 'GetBasePath', 'Refresh', 'JobStatusToolTip'
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user