mirror of
https://github.com/ansible/awx.git
synced 2026-03-01 16:58:46 -03:30
actually fix relaunch status value issue
This commit is contained in:
@@ -1,8 +1,4 @@
|
|||||||
export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count', '$scope', 'ParseTypeChange', 'ParseVariableString', 'jobResultsService', 'eventQueue', '$compile', '$log', 'Dataset', '$q', 'Rest', '$state', 'QuerySet', function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTypeChange, ParseVariableString, jobResultsService, eventQueue, $compile, $log, Dataset, $q, Rest, $state, QuerySet) {
|
export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count', '$scope', 'ParseTypeChange', 'ParseVariableString', 'jobResultsService', 'eventQueue', '$compile', '$log', 'Dataset', '$q', 'Rest', '$state', 'QuerySet', '$rootScope', function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTypeChange, ParseVariableString, jobResultsService, eventQueue, $compile, $log, Dataset, $q, Rest, $state, QuerySet, $rootScope) {
|
||||||
// if the job_status hasn't been set by the websocket, set it now
|
|
||||||
if (!$scope.job_status) {
|
|
||||||
$scope.job_status = jobData.status;
|
|
||||||
}
|
|
||||||
|
|
||||||
// used for tag search
|
// used for tag search
|
||||||
$scope.job_event_dataset = Dataset.data;
|
$scope.job_event_dataset = Dataset.data;
|
||||||
@@ -52,7 +48,6 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count'
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.status_label = getTowerLabel('status');
|
|
||||||
$scope.type_label = getTowerLabel('job_type');
|
$scope.type_label = getTowerLabel('job_type');
|
||||||
$scope.verbosity_label = getTowerLabel('verbosity');
|
$scope.verbosity_label = getTowerLabel('verbosity');
|
||||||
};
|
};
|
||||||
@@ -68,6 +63,27 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count'
|
|||||||
$scope.labels = jobLabels;
|
$scope.labels = jobLabels;
|
||||||
$scope.jobFinished = jobFinished;
|
$scope.jobFinished = jobFinished;
|
||||||
|
|
||||||
|
// update label in left pane and tooltip in right pane when the job_status
|
||||||
|
// changes
|
||||||
|
$scope.$watch('job_status', function(status) {
|
||||||
|
if (status) {
|
||||||
|
$scope.status_label = $scope.jobOptions.status.choices
|
||||||
|
.filter(val => val[0] === status)
|
||||||
|
.map(val => val[1])[0];
|
||||||
|
$scope.status_tooltip = "Job " + $scope.status_label;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// update the job_status value. Use the cached rootScope value if there
|
||||||
|
// is one. This is a workaround when the rest call for the jobData is
|
||||||
|
// made before some socket events come in for the job status
|
||||||
|
if ($rootScope['lastSocketStatus' + jobData.id]) {
|
||||||
|
$scope.job_status = $rootScope['lastSocketStatus' + jobData.id];
|
||||||
|
delete $rootScope['lastSocketStatus' + jobData.id];
|
||||||
|
} else {
|
||||||
|
$scope.job_status = jobData.status;
|
||||||
|
}
|
||||||
|
|
||||||
// turn related api browser routes into tower routes
|
// turn related api browser routes into tower routes
|
||||||
getTowerLinks();
|
getTowerLinks();
|
||||||
|
|
||||||
@@ -424,13 +440,19 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count'
|
|||||||
$scope.$on(`ws-jobs`, function(e, data) {
|
$scope.$on(`ws-jobs`, function(e, data) {
|
||||||
if (parseInt(data.unified_job_id, 10) ===
|
if (parseInt(data.unified_job_id, 10) ===
|
||||||
parseInt($scope.job.id,10)) {
|
parseInt($scope.job.id,10)) {
|
||||||
|
// controller is defined, so set the job_status
|
||||||
$scope.job_status = data.status;
|
$scope.job_status = data.status;
|
||||||
}
|
} else if (parseInt(data.project_id, 10) ===
|
||||||
if (parseInt(data.project_id, 10) ===
|
|
||||||
parseInt($scope.job.project,10)) {
|
parseInt($scope.job.project,10)) {
|
||||||
|
// this is a project status update message, so set the
|
||||||
|
// project status in the left pane
|
||||||
$scope.project_status = data.status;
|
$scope.project_status = data.status;
|
||||||
$scope.project_update_link = `/#/scm_update/${data
|
$scope.project_update_link = `/#/scm_update/${data
|
||||||
.unified_job_id}`;
|
.unified_job_id}`;
|
||||||
|
} else {
|
||||||
|
// controller was previously defined, but is not yet defined
|
||||||
|
// for this job. cache the socket status on root scope
|
||||||
|
$rootScope['lastSocketStatus' + data.unified_job_id] = data.status;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}];
|
}];
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
<div class="JobResults-resultRowText">
|
<div class="JobResults-resultRowText">
|
||||||
<i class="JobResults-statusResultIcon
|
<i class="JobResults-statusResultIcon
|
||||||
fa
|
fa
|
||||||
icon-job-{{ job.status }}">
|
icon-job-{{ job_status }}">
|
||||||
</i> {{ status_label }}
|
</i> {{ status_label }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -415,6 +415,7 @@
|
|||||||
<i class="JobResults-statusResultIcon
|
<i class="JobResults-statusResultIcon
|
||||||
fa icon-job-{{ job_status }}"
|
fa icon-job-{{ job_status }}"
|
||||||
aw-tool-tip="Job {{status_label}}"
|
aw-tool-tip="Job {{status_label}}"
|
||||||
|
data-tip-watch="status_tooltip"
|
||||||
aw-tip-placement="top"
|
aw-tip-placement="top"
|
||||||
data-original-title>
|
data-original-title>
|
||||||
</i>
|
</i>
|
||||||
|
|||||||
@@ -35,8 +35,9 @@ export default {
|
|||||||
resolve: {
|
resolve: {
|
||||||
// the GET for the particular job
|
// the GET for the particular job
|
||||||
jobData: ['Rest', 'GetBasePath', '$stateParams', '$q', '$state', 'Alert', function(Rest, GetBasePath, $stateParams, $q, $state, Alert) {
|
jobData: ['Rest', 'GetBasePath', '$stateParams', '$q', '$state', 'Alert', function(Rest, GetBasePath, $stateParams, $q, $state, Alert) {
|
||||||
Rest.setUrl(GetBasePath('jobs') + $stateParams.id);
|
|
||||||
var val = $q.defer();
|
var val = $q.defer();
|
||||||
|
|
||||||
|
Rest.setUrl(GetBasePath('jobs') + $stateParams.id);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
.then(function(data) {
|
.then(function(data) {
|
||||||
val.resolve(data.data);
|
val.resolve(data.data);
|
||||||
@@ -51,6 +52,7 @@ export default {
|
|||||||
|
|
||||||
$state.go('jobs');
|
$state.go('jobs');
|
||||||
});
|
});
|
||||||
|
|
||||||
return val.promise;
|
return val.promise;
|
||||||
}],
|
}],
|
||||||
Dataset: ['QuerySet', '$stateParams', 'jobData',
|
Dataset: ['QuerySet', '$stateParams', 'jobData',
|
||||||
|
|||||||
Reference in New Issue
Block a user