mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 09:51:09 +03:00
account for existence of 'check' project update jobs
This commit is contained in:
parent
60d311c1a9
commit
56935fef94
@ -184,7 +184,6 @@ function getInventoryDetails () {
|
||||
|
||||
function getProjectDetails () {
|
||||
const project = resource.model.get('summary_fields.project');
|
||||
const projectUpdate = resource.model.get('summary_fields.project_update');
|
||||
|
||||
if (!project) {
|
||||
return null;
|
||||
@ -195,17 +194,32 @@ function getProjectDetails () {
|
||||
const value = $filter('sanitize')(project.name);
|
||||
const tooltip = strings.get('resourceTooltips.PROJECT');
|
||||
|
||||
if (projectUpdate) {
|
||||
const update = {
|
||||
link: `/#/jobz/project/${projectUpdate.id}`,
|
||||
tooltip: strings.get('resourceTooltips.PROJECT_UPDATE'),
|
||||
status: projectUpdate.status,
|
||||
};
|
||||
return { label, link, value, tooltip };
|
||||
}
|
||||
|
||||
return { label, link, value, tooltip, update };
|
||||
function getProjectStatusDetails (projectStatus) {
|
||||
const project = resource.model.get('summary_fields.project');
|
||||
const jobStatus = projectStatus || resource.model.get('summary_fields.project_update.status');
|
||||
|
||||
if (!project) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return { label, link, value, tooltip };
|
||||
return jobStatus;
|
||||
}
|
||||
|
||||
function getProjectUpdateDetails (updateId) {
|
||||
const project = resource.model.get('summary_fields.project');
|
||||
const jobId = updateId || resource.model.get('summary_fields.project_update.id');
|
||||
|
||||
if (!project) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const link = `/#/jobz/project/${jobId}`;
|
||||
const tooltip = strings.get('resourceTooltips.PROJECT_UPDATE');
|
||||
|
||||
return { link, tooltip };
|
||||
}
|
||||
|
||||
function getSCMRevisionDetails () {
|
||||
@ -495,6 +509,8 @@ function AtJobDetailsController (
|
||||
vm.sourceWorkflowJob = getSourceWorkflowJobDetails();
|
||||
vm.inventory = getInventoryDetails();
|
||||
vm.project = getProjectDetails();
|
||||
vm.projectUpdate = getProjectUpdateDetails();
|
||||
vm.projectStatus = getProjectStatusDetails();
|
||||
vm.scmRevision = getSCMRevisionDetails();
|
||||
vm.playbook = getPlaybookDetails();
|
||||
vm.resultTraceback = getResultTracebackDetails();
|
||||
@ -533,16 +549,15 @@ function AtJobDetailsController (
|
||||
vm.deleteJob = deleteJob;
|
||||
vm.toggleLabels = toggleLabels;
|
||||
|
||||
$scope.$watch(status.getStarted, value => { vm.started = getStartDetails(value); });
|
||||
$scope.$watch(status.getJobStatus, value => { vm.status = getStatusDetails(value); });
|
||||
$scope.$watch(status.getFinished, value => { vm.finished = getFinishDetails(value); });
|
||||
const observe = (getter, transform, key) => {
|
||||
$scope.$watch(getter, value => { vm[key] = transform(value); });
|
||||
};
|
||||
|
||||
$scope.$watch(status.getProjectStatus, value => {
|
||||
if (!value) return;
|
||||
|
||||
vm.project.update = vm.project.update || {};
|
||||
vm.project.update.status = value;
|
||||
});
|
||||
observe(status.getStarted, getStartDetails, 'started');
|
||||
observe(status.getJobStatus, getStatusDetails, 'status');
|
||||
observe(status.getFinished, getFinishDetails, 'finished');
|
||||
observe(status.getProjectUpdateId, getProjectUpdateDetails, 'projectUpdate');
|
||||
observe(status.getProjectStatus, getProjectStatusDetails, 'projectStatus');
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -119,11 +119,11 @@
|
||||
<div class="JobResults-resultRow" ng-if="vm.project">
|
||||
<label class="JobResults-resultRowLabel">{{ vm.project.label }}</label>
|
||||
<div class="JobResults-resultRowText">
|
||||
<a href="{{ vm.project.update.link }}"
|
||||
ng-if="vm.project.update"
|
||||
aw-tool-tip="{{ vm.project.update.tooltip }}"
|
||||
<a href="{{ vm.projectUpdate.link }}"
|
||||
ng-if="vm.projectUpdate"
|
||||
aw-tool-tip="{{ vm.projectUpdate.tooltip }}"
|
||||
data-placement="top">
|
||||
<i class="JobResults-statusResultIcon fa icon-job-{{ vm.project.update.status }}"></i>
|
||||
<i ng-if="vm.projectStatus" class="JobResults-statusResultIcon fa icon-job-{{ vm.projectStatus }}"></i>
|
||||
</a>
|
||||
<a href="{{ vm.project.link }}"
|
||||
aw-tool-tip="{{ vm.project.tooltip }}"
|
||||
|
@ -18,7 +18,7 @@ function JobsStrings (BaseString) {
|
||||
|
||||
ns.status = {
|
||||
RUNNING: t.s('The host status bar will update when the job is complete.'),
|
||||
UNAVAILABLE: t.s('Host status information for this job unavailable.'),
|
||||
UNAVAILABLE: t.s('Host status information for this job is unavailable.'),
|
||||
};
|
||||
|
||||
ns.resourceTooltips = {
|
||||
|
@ -23,6 +23,7 @@ function JobStatusService (_moment_) {
|
||||
this.finished = resource.model.get('finished');
|
||||
this.jobStatus = resource.model.get('status');
|
||||
this.projectStatus = resource.model.get('summary_fields.project_update.status');
|
||||
this.projectUpdateId = resource.model.get('summary_fields.project_update.id');
|
||||
|
||||
this.latestTime = null;
|
||||
this.playCount = null;
|
||||
@ -43,6 +44,7 @@ function JobStatusService (_moment_) {
|
||||
this.setJobStatus(data.status);
|
||||
} else if (isProjectEvent) {
|
||||
this.setProjectStatus(data.status);
|
||||
this.setProjectUpdateId(data.unified_job_id);
|
||||
}
|
||||
|
||||
if (this.isCommand()) {
|
||||
@ -130,6 +132,7 @@ function JobStatusService (_moment_) {
|
||||
this.getHostStatusCounts = () => this.hostStatusCounts || {};
|
||||
this.getJobStatus = () => this.jobStatus;
|
||||
this.getProjectStatus = () => this.projectStatus;
|
||||
this.getProjectUpdateId = () => this.projectUpdateId;
|
||||
this.getElapsed = () => this.elapsed;
|
||||
this.getStatsEvent = () => this.statsEvent;
|
||||
this.getStarted = () => this.started;
|
||||
@ -153,6 +156,10 @@ function JobStatusService (_moment_) {
|
||||
this.projectStatus = status;
|
||||
};
|
||||
|
||||
this.setProjectUpdateId = id => {
|
||||
this.projectUpdateId = id;
|
||||
};
|
||||
|
||||
this.setFinished = time => {
|
||||
this.finished = time;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user