removing reload call when a job ends from the socket listener

on the job results page
This commit is contained in:
jaredevantabor
2016-12-19 11:37:17 -08:00
parent 439b699e73
commit 5de93aa05c
3 changed files with 29 additions and 22 deletions

View File

@@ -459,7 +459,11 @@ function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTy
data.status === "error" ||
data.status === "canceled") {
clearInterval(elapsedInterval);
$state.go('.', null, { reload: true });
// When the fob is finished retrieve the job data to
// correct anything that was out of sync from the job run
jobResultsService.getJobData($scope.job.id).then(function(data){
$scope.job = data;
})
}
} else if (parseInt(data.project_id, 10) ===
parseInt($scope.job.project,10)) {

View File

@@ -34,26 +34,8 @@ export default {
},
resolve: {
// the GET for the particular job
jobData: ['Rest', 'GetBasePath', '$stateParams', '$q', '$state', 'Alert', function(Rest, GetBasePath, $stateParams, $q, $state, Alert) {
var val = $q.defer();
Rest.setUrl(GetBasePath('jobs') + $stateParams.id);
Rest.get()
.then(function(data) {
val.resolve(data.data);
}, function(data) {
val.reject(data);
if (data.status === 404) {
Alert('Job Not Found', 'Cannot find job.', 'alert-info');
} else if (data.status === 403) {
Alert('Insufficient Permissions', 'You do not have permission to view this job.', 'alert-info');
}
$state.go('jobs');
});
return val.promise;
jobData: ['Rest', 'GetBasePath', '$stateParams', '$q', '$state', 'Alert', 'jobResultsService', function(Rest, GetBasePath, $stateParams, $q, $state, Alert, jobResultsService) {
return jobResultsService.getJobData($stateParams.id);
}],
Dataset: ['QuerySet', '$stateParams', 'jobData',
function(qs, $stateParams, jobData) {

View File

@@ -5,7 +5,7 @@
*************************************************/
export default ['$q', 'Prompt', '$filter', 'Wait', 'Rest', '$state', 'ProcessErrors', 'InitiatePlaybookRun', function ($q, Prompt, $filter, Wait, Rest, $state, ProcessErrors, InitiatePlaybookRun) {
export default ['$q', 'Prompt', '$filter', 'Wait', 'Rest', '$state', 'ProcessErrors', 'InitiatePlaybookRun', 'GetBasePath', function ($q, Prompt, $filter, Wait, Rest, $state, ProcessErrors, InitiatePlaybookRun, GetBasePath) {
var val = {
// the playbook_on_stats event returns the count data in a weird format.
// format to what we need!
@@ -191,6 +191,27 @@ export default ['$q', 'Prompt', '$filter', 'Wait', 'Rest', '$state', 'ProcessErr
relaunchJob: function(scope) {
InitiatePlaybookRun({ scope: scope, id: scope.job.id,
relaunch: true });
},
getJobData: function(id){
var val = $q.defer();
Rest.setUrl(GetBasePath('jobs') + id );
Rest.get()
.then(function(data) {
val.resolve(data.data);
}, function(data) {
val.reject(data);
if (data.status === 404) {
Alert('Job Not Found', 'Cannot find job.', 'alert-info');
} else if (data.status === 403) {
Alert('Insufficient Permissions', 'You do not have permission to view this job.', 'alert-info');
}
$state.go('jobs');
});
return val.promise;
}
};
return val;