Skip to content
Snippets Groups Projects
Commit 4406870c authored by Reid Givens's avatar Reid Givens
Browse files

added alerts to execution QA processes, and fixed the service endpoint supporting them

parent 0f14a68d
No related branches found
No related tags found
No related merge requests found
import {Component, Input, OnDestroy, OnInit} from '@angular/core';
import {Component, EventEmitter, Input, OnDestroy, OnInit, Output} from '@angular/core';
import {Job, JobExecution} from "../../../model/job";
import {Subscription} from "rxjs";
import {JobsService} from "../../../services/jobs.service";
......@@ -15,6 +15,7 @@ import {AlertService} from "../../../services/alert.service";
export class ExecutionDetailComponent implements OnInit, OnDestroy {
@Input() job: Job;
@Output() reload = new EventEmitter();
private jobDetail$: Subscription;
public jobDetail: JobExecution;
......@@ -73,7 +74,6 @@ export class ExecutionDetailComponent implements OnInit, OnDestroy {
}
canAcceptArchive(status: string, archiveStatus: string): boolean {
console.log(status, archiveStatus);
if (status === 'QA_READY' || status === 'QA_MANUAL' || archiveStatus === 'ARCHIVE_ERROR') {
return true;
} else {
......@@ -102,12 +102,14 @@ export class ExecutionDetailComponent implements OnInit, OnDestroy {
}
acceptQa() {
this.alertService.info('Accepting ' + this.job.job_id);
this.performQa(this.job.job_id, 'accept');
}
rejectQa() {
let yesno = confirm("Are you sure you want to reject this image?");
if (yesno) {
this.alertService.info('Rejecting ' + this.job.job_id);
this.performQa(this.job.job_id, 'reject');
}
}
......@@ -125,7 +127,10 @@ export class ExecutionDetailComponent implements OnInit, OnDestroy {
if (['QA_ACCEPTED', 'QA_MANUAL_ACCEPTED', 'QA_REJECTED', 'QA_MANUAL_REJECTED'].indexOf(newStatus) > -1) {
this.jobService.performQA(this.job.job_id, newStatus, this.jobDetail.queueName).subscribe(response => {
// this.hideDetails();
this.alertService.success('QA Performed for ' + id);
this.reload.emit('reload');
}, error => {
this.alertService.error('QA Failed for ' + id);
});
}
};
......
......@@ -47,7 +47,7 @@
</div>
<div class="p-3 mx-1 mt-1 mb-2 bg-white shadow" *ngIf="detailsExposed" @vslider>
<app-execution-detail [job]="job"></app-execution-detail>
<app-execution-detail [job]="job" (reload)="reload.emit($event)"></app-execution-detail>
</div>
<div class="border-bottom mx-1"></div>
import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core';
import {Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges} from '@angular/core';
import {Job, JobQueue} from "../../model/job";
import {verticleSlide} from "../../animations";
import {faCopy, faExclamationTriangle, faExternalLinkAlt} from "@fortawesome/free-solid-svg-icons";
......@@ -18,6 +18,7 @@ export class ExecutionComponent implements OnInit, OnChanges {
@Input() job: Job;
@Input() queue: JobQueue;
@Input() alertThresholdDays: number;
@Output() reload = new EventEmitter();
productStatuses: Array<string> = [
'PROCESSING',
......@@ -136,4 +137,5 @@ export class ExecutionComponent implements OnInit, OnChanges {
this.duration = dur;
}
}
......@@ -43,8 +43,8 @@
<div class="col-1 px-2 py-3 thead_th">Archive Status</div>
</div>
<ng-container *ngFor="let job of jobs">
<app-execution-job [job]="job" [queue]="filters['JOB_QUEUE']"
[alertThresholdDays]="alertAfterDays"></app-execution-job>
<app-execution-job [job]="job" [queue]="filters['JOB_QUEUE']" [alertThresholdDays]="alertAfterDays"
(reload)="getJobs()"></app-execution-job>
</ng-container>
</ng-container>
......
......@@ -120,7 +120,7 @@ export class JobsService {
public performQA(id: number, status: string, queue: string) {
return this.http.put(this.configService.config.url + this.endPoint + 'jobs/' + id + '/status?status=' + status + '&queue=' + queue, {}, {observe: "response"}).pipe(
switchMap(response => {
return this.http.put(this.configService.config.url + this.endPoint + 'jobs/' + id + '/images?status=' + status + '&queue=' + queue, {}, {observe: "response"}).pipe(
return this.http.put(this.configService.config.url + this.endPoint + 'jobs/' + id + '/ingest?status=' + status + '&queue=' + queue, {}, {observe: "response"}).pipe(
map(response => {
return response.status;
}));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment