mirror of
https://github.com/ansible/awx.git
synced 2026-02-25 23:16:01 -03:30
AC-463. Reduced refresh button to automatic page refreh every 10 sec. Duration btwn refreshes can be adjusted in config.js.
This commit is contained in:
@@ -141,6 +141,22 @@ function JobEventsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
cDate = new Date(set[i].created);
|
||||
set[i].created = FormatDate(cDate);
|
||||
}
|
||||
|
||||
// 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;
|
||||
if (!(data.status == 'pending' || data.status == 'waiting' || data.status == 'running')) {
|
||||
if ($rootScope.timer) {
|
||||
clearInterval($rootScope.timer);
|
||||
}
|
||||
}
|
||||
})
|
||||
.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 });
|
||||
});
|
||||
});
|
||||
|
||||
SearchInit({ scope: scope, set: 'jobevents', list: list, url: defaultUrl });
|
||||
|
||||
@@ -50,7 +50,24 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams,
|
||||
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';
|
||||
}
|
||||
}
|
||||
if (scope.host_id == null) {
|
||||
// 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;
|
||||
if (!(data.status == 'pending' || data.status == 'waiting' || data.status == 'running')) {
|
||||
if ($rootScope.timer) {
|
||||
clearInterval($rootScope.timer);
|
||||
}
|
||||
}
|
||||
})
|
||||
.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 });
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
SearchInit({ scope: scope, set: 'jobhosts', list: list, url: defaultUrl });
|
||||
|
||||
@@ -262,6 +262,12 @@ function JobsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
|
||||
scope.playbook_options = null;
|
||||
scope.playbook = null;
|
||||
|
||||
function calcRows (content) {
|
||||
var n = content.match(/\n/g);
|
||||
var rows = (n) ? n.length : 1;
|
||||
return (rows > 15) ? 15 : rows;
|
||||
}
|
||||
|
||||
// Retrieve detail record and prepopulate the form
|
||||
Rest.setUrl(defaultUrl + ':id/');
|
||||
Rest.get({ params: {id: id} })
|
||||
@@ -336,17 +342,20 @@ function JobsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
|
||||
relatedSets[set] = { url: related[set], iterator: form.related[set].iterator };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Calc row size of stdout and traceback textarea fields
|
||||
var n = scope['result_stdout'].match(/\n/g);
|
||||
var rows = (n) ? n.length : 1;
|
||||
rows = (rows > 15) ? 15 : rows;
|
||||
scope['stdout_rows'] = rows;
|
||||
//var n = scope['result_stdout'].match(/\n/g);
|
||||
//var rows = (n) ? n.length : 1;
|
||||
//rows = (rows > 15) ? 15 : rows;
|
||||
//rows;
|
||||
|
||||
n = scope['result_traceback'].match(/\n/g);
|
||||
var rows = (n) ? n.length : 1;
|
||||
rows = (rows > 15) ? 15 : rows;
|
||||
scope['traceback_rows'] = rows;
|
||||
scope['stdout_rows'] = calcRows(scope['result_stdout']);
|
||||
|
||||
//n = scope['result_traceback'].match(/\n/g);
|
||||
//var rows = (n) ? n.length : 1;
|
||||
//rows = (rows > 15) ? 15 : rows;
|
||||
|
||||
scope['traceback_rows'] = calcRows(scope['result_traceback']);
|
||||
|
||||
LookUpInit({
|
||||
scope: scope,
|
||||
@@ -461,6 +470,13 @@ function JobsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
|
||||
scope.status = data.status;
|
||||
scope.result_stdout = data.result_stdout;
|
||||
scope.result_traceback = data.result_traceback;
|
||||
scope['stdout_rows'] = calcRows(scope['result_stdout']);
|
||||
scope['traceback_rows'] = calcRows(scope['result_traceback']);
|
||||
if (!(data.status == 'pending' || data.status == 'waiting' || data.status == 'running')) {
|
||||
if ($rootScope.timer) {
|
||||
clearInterval($rootScope.timer);
|
||||
}
|
||||
}
|
||||
scope.statusSearchSpin = false;
|
||||
})
|
||||
.error( function(data, status, headers, config) {
|
||||
|
||||
@@ -27,8 +27,11 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
$rootScope.flashMessage = null;
|
||||
|
||||
var url = (base == 'teams') ? GetBasePath('teams') + $routeParams.team_id + '/projects/' : defaultUrl;
|
||||
SelectionInit({ scope: scope, list: list, url: url, returnToCaller: 1 });
|
||||
|
||||
if (mode == 'select') {
|
||||
SelectionInit({ scope: scope, list: list, url: url, returnToCaller: 1 });
|
||||
}
|
||||
|
||||
if (scope.projectsPostRefresh) {
|
||||
scope.projectsPostRefresh();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user