Skip to content
Snippets Groups Projects
Commit 9939de1f authored by Daniel Lopez Sanders's avatar Daniel Lopez Sanders
Browse files

Code style changes and tech debt elimination for TypeScript files where there...

Code style changes and tech debt elimination for TypeScript files where there is code used for 'Accept & Archive'
parent 73c56916
No related branches found
No related tags found
2 merge requests!32Merge 2.4.4 UI to main,!26No story: Code style improvements and eliminating technical debt
......@@ -120,11 +120,7 @@ export class ExecutionDetailComponent implements OnInit, OnDestroy, OnChanges {
}
canAcceptArchive(status: string, archiveStatus: string): boolean {
if (status === 'QA_READY' || status === 'QA_MANUAL' || archiveStatus === 'ARCHIVE_ERROR') {
return true;
} else {
return false;
}
return (status === 'QA_READY' || status === 'QA_MANUAL' || archiveStatus === 'ARCHIVE_ERROR');
}
getConfigRootDataDirectory(): string {
......@@ -155,8 +151,8 @@ export class ExecutionDetailComponent implements OnInit, OnDestroy, OnChanges {
updateNotes() {
this.alertService.info('Saving Notes');
let notes = this.noteFormGroup.get('notes').value;
let id = this.noteFormGroup.get('id').value;
const notes = this.noteFormGroup.get('notes').value;
const id = this.noteFormGroup.get('id').value;
this.jobService.updateNotes(id, notes).subscribe(response => {
this.alertService.success('Notes Saved');
},
......@@ -183,13 +179,14 @@ export class ExecutionDetailComponent implements OnInit, OnDestroy, OnChanges {
}
performQa(id: number, status: string, selectedTiles?: number[]) {
//console.log(status + 'ing QA');
// console.log(status + 'ing QA');
let newStatus: string = "";
let newStatus = '';
const qaJobStatus = (this.job.job_status === 'QA_READY' || this.job.job_status === 'QA_MANUAL');
if (status == 'accept' && (this.job.job_status === 'QA_READY' || this.job.job_status === 'QA_MANUAL')) {
if (status === 'accept' && qaJobStatus) {
newStatus = 'QA_ACCEPTED';
} else if (status == 'reject' && (this.job.job_status === 'QA_READY' || this.job.job_status === 'QA_MANUAL')) {
} else if (status === 'reject' && qaJobStatus) {
newStatus = 'QA_REJECTED';
}
......@@ -201,10 +198,11 @@ export class ExecutionDetailComponent implements OnInit, OnDestroy, OnChanges {
this.alertService.error('QA Failed for ' + id);
});
}
};
}
canSelectPlanes(): boolean {
return this.jobDetail.queueName === 'se_coarse_cube_imaging' && this.canAcceptArchive(this.jobDetail.status, this.jobDetail.archiveStatus);
return (this.jobDetail.queueName === 'se_coarse_cube_imaging' &&
this.canAcceptArchive(this.jobDetail.status, this.jobDetail.archiveStatus));
}
canSelectTiles(): boolean {
......@@ -235,7 +233,7 @@ export class ExecutionDetailComponent implements OnInit, OnDestroy, OnChanges {
const planes = this.planesFormGroup.value;
for (const planeKey in planes) {
if (planes[planeKey] === true) {
planesText += planeKey + "\n";
planesText += planeKey + '\n';
}
}
planesText = planesText.trim();
......
......@@ -198,20 +198,25 @@ export class JobsService {
}
public performQA(id: number, status: string, queue: string, selectedTiles?: number[]) {
const ingestUrl = this.configService.config.url + this.endPoint + 'jobs/' + id + '/ingest?status=' + status + '&queue=' + queue;
return this.http.put(this.configService.config.url + this.endPoint + 'jobs/' + id + '/status?status=' + status + '&queue=' + queue, {}, {observe: "response"}).pipe(
const startingUrl = `${this.configService.config.url}${this.endPoint}jobs/${id}`;
const ingestUrl = `${startingUrl}/ingest?status=${status}&queue=${queue}`;
const statusUrl = `${startingUrl}/status?status=${status}&queue=${queue}`;
return this.http.put(statusUrl, {}, {observe: 'response'}).pipe(
switchMap(response => {
return this.http.put(ingestUrl, {}, {observe: "response"}).pipe(
return this.http.put(ingestUrl, {}, {observe: 'response'}).pipe(
switchMap(response => {
if (selectedTiles) {
const tileUrl = this.configService.config.url + this.endPoint + 'jobs/' + id + '/calAutoPimsTiles';
return this.http.post<Tile[]>(tileUrl, selectedTiles, {observe: "response"}).pipe(map(response => response.body))
} else {
return of(response.body);
}
})
);
}));
const tileUrl = `${startingUrl}/calAutoPimsTiles`;
return this.http.post<Tile[]>(tileUrl, selectedTiles,
{observe: 'response'}).pipe(map(response => response.body));
} else {
return of(response.body);
}
})
);
})
);
}
public deleteJobSpec(jobSpecId: number, queue: string): Observable<number> {
......
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