mirror of
https://github.com/ansible/awx.git
synced 2026-05-16 13:57:39 -02:30
Job detail page
Added 'Loading...' message to each table. Loading message is turned on at initial page load. It is turned off at the last possible second after completion of page rendering. It is turned on before each API call and back off after the API call completes.
This commit is contained in:
@@ -33,6 +33,12 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
|
||||
scope.tasksMaxRows = 200;
|
||||
scope.playsMaxRows = 200;
|
||||
|
||||
// Set the following to true when 'Loading...' message desired
|
||||
scope.playsLoading = true;
|
||||
scope.tasksLoading = true;
|
||||
scope.hostResultsLoading = true;
|
||||
scope.hostSummariesLoading = true;
|
||||
|
||||
scope.liveEventProcessing = true; // true while job is active and live events are arriving
|
||||
scope.pauseLiveEvents = false; // control play/pause state of event processing
|
||||
|
||||
@@ -137,6 +143,7 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
|
||||
scope.removeInitialLoadComplete = scope.$on('InitialLoadComplete', function() {
|
||||
var url;
|
||||
Wait('stop');
|
||||
|
||||
if (JobIsFinished(scope)) {
|
||||
scope.liveEventProcessing = false; // signal that event processing is over and endless scroll
|
||||
scope.pauseLiveEvents = false; // should be enabled
|
||||
@@ -529,6 +536,12 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
|
||||
scope.removeLoadJobRow = scope.$on('LoadJob', function() {
|
||||
Wait('start');
|
||||
scope.job_status = {};
|
||||
|
||||
scope.playsLoading = true;
|
||||
scope.tasksLoading = true;
|
||||
scope.hostResultsLoading = true;
|
||||
scope.LoadHostSummaries = true;
|
||||
|
||||
// Load the job record
|
||||
Rest.setUrl(GetBasePath('jobs') + job_id + '/');
|
||||
Rest.get()
|
||||
@@ -939,6 +952,7 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
|
||||
// check for more plays when user scrolls to bottom of play list...
|
||||
if (((!scope.liveEventProcessing) || (scope.liveEventProcessing && scope.pauseLiveEvents)) && scope.next_plays) {
|
||||
$('#playsMoreRows').fadeIn();
|
||||
scope.playsLoading = true;
|
||||
Rest.setUrl(scope.next_plays);
|
||||
Rest.get()
|
||||
.success( function(data) {
|
||||
@@ -989,6 +1003,7 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
|
||||
skipped = (event.skipped_count) ? event.skipped_count : 0;
|
||||
|
||||
scope.plays[scope.plays.length - 1].hostCount = ok + changed + failed + skipped;
|
||||
scope.playsLoading = false;
|
||||
});
|
||||
$('#playsMoreRows').fadeOut(400);
|
||||
})
|
||||
@@ -1003,6 +1018,7 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
|
||||
// check for more tasks when user scrolls to bottom of task list...
|
||||
if (((!scope.liveEventProcessing) || (scope.liveEventProcessing && scope.pauseLiveEvents)) && scope.next_tasks) {
|
||||
$('#tasksMoreRows').fadeIn();
|
||||
scope.tasksLoading = true;
|
||||
Rest.setUrl(scope.next_tasks);
|
||||
Rest.get()
|
||||
.success(function(data) {
|
||||
@@ -1060,6 +1076,7 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
|
||||
});
|
||||
});
|
||||
$('#tasksMoreRows').fadeOut(400);
|
||||
scope.tasksLoading = false;
|
||||
})
|
||||
.error(function(data, status) {
|
||||
$('#tasksMoreRows').fadeOut(400);
|
||||
@@ -1073,6 +1090,7 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
|
||||
// check for more hosts when user scrolls to bottom of host results list...
|
||||
if (((!scope.liveEventProcessing) || (scope.liveEventProcessing && scope.pauseLiveEvents)) && scope.next_host_results) {
|
||||
$('#hostResultsMoreRows').fadeIn();
|
||||
scope.hostResultsLoading = true;
|
||||
Rest.setUrl(scope.next_host_results);
|
||||
Rest.get()
|
||||
.success(function(data) {
|
||||
@@ -1121,6 +1139,7 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
|
||||
msg: (row.event_data && row.event_data.res) ? row.event_data.res.msg : '',
|
||||
item: item
|
||||
});
|
||||
scope.hostResultsLoading = false;
|
||||
});
|
||||
$('#hostResultsMoreRows').fadeOut(400);
|
||||
})
|
||||
@@ -1135,6 +1154,7 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
|
||||
scope.hostSummariesScrollDown = function() {
|
||||
// check for more hosts when user scrolls to bottom of host summaries list...
|
||||
if (((!scope.liveEventProcessing) || (scope.liveEventProcessing && scope.pauseLiveEvents)) && scope.next_host_summaries) {
|
||||
scope.hostSummariesLoading = true;
|
||||
Rest.setUrl(scope.next_host_summaries);
|
||||
Rest.get()
|
||||
.success(function(data) {
|
||||
@@ -1157,6 +1177,7 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
|
||||
});
|
||||
});
|
||||
$('#hostSummariesMoreRows').fadeOut();
|
||||
scope.hostSummariesLoading = false;
|
||||
})
|
||||
.error(function(data, status) {
|
||||
$('#hostSummariesMoreRows').fadeOut();
|
||||
|
||||
@@ -665,7 +665,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
||||
url = scope.job.url + 'job_plays/?page_size=' + scope.playsMaxRows + '&order_by=id';
|
||||
url += (scope.search_play_name) ? '&play__icontains=' + scope.search_play_name : '';
|
||||
url += (scope.search_play_status === 'failed') ? '&failed=true' : '';
|
||||
|
||||
scope.playsLoading = true;
|
||||
Rest.setUrl(url);
|
||||
Rest.get()
|
||||
.success(function(data) {
|
||||
@@ -717,6 +717,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
||||
id: (scope.plays.length > 0) ? scope.plays[0].id : null,
|
||||
callback: callback
|
||||
});
|
||||
scope.playsLoading = false;
|
||||
})
|
||||
.error(function(data) {
|
||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||
@@ -774,6 +775,8 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
||||
return true;
|
||||
});
|
||||
|
||||
scope.tasksLoading = true;
|
||||
|
||||
Rest.setUrl(url);
|
||||
Rest.get()
|
||||
.success(function(data) {
|
||||
@@ -852,6 +855,8 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
||||
callback: callback
|
||||
});
|
||||
|
||||
scope.tasksLoading = false;
|
||||
|
||||
})
|
||||
.error(function(data) {
|
||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||
@@ -909,7 +914,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
||||
url += (scope.search_host_name) ? 'host__name__icontains=' + scope.search_host_name + '&' : '';
|
||||
url += (scope.search_host_status === 'failed') ? 'failed=true&' : '';
|
||||
url += 'event__startswith=runner&page_size=' + scope.hostResultsMaxRows + '&order_by=host__name';
|
||||
|
||||
scope.hostResultsLoading = true;
|
||||
Rest.setUrl(url);
|
||||
Rest.get()
|
||||
.success(function(data) {
|
||||
@@ -963,6 +968,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
||||
item: item
|
||||
});
|
||||
}
|
||||
scope.hostResultsLoading = false;
|
||||
});
|
||||
if (callback) {
|
||||
scope.$emit(callback);
|
||||
@@ -995,6 +1001,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
||||
url += '&page_size=' + scope.hostSummariesMaxRows + '&order_by=host_name';
|
||||
|
||||
scope.hosts = [];
|
||||
scope.hostSummariesLoading = true;
|
||||
|
||||
Rest.setUrl(url);
|
||||
Rest.get()
|
||||
@@ -1017,6 +1024,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
||||
failed: event.failures,
|
||||
status: (event.failed) ? 'failed' : 'successful'
|
||||
});
|
||||
scope.hostSummariesLoading = false;
|
||||
});
|
||||
if (callback) {
|
||||
scope.$emit(callback);
|
||||
@@ -1399,6 +1407,13 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
||||
|
||||
DrawHostSummaries({ scope: scope });
|
||||
|
||||
setTimeout(function() {
|
||||
scope.playsLoading = false;
|
||||
scope.tasksLoading = false;
|
||||
scope.hostResultsLoading = false;
|
||||
scope.LoadHostSummaries = false;
|
||||
},100);
|
||||
|
||||
if (scope.host_summary.total > 0) {
|
||||
DrawGraph({ scope: scope, resize: true });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user