Skip to content
Snippets Groups Projects
Commit dee9bf94 authored by Sam Kagan's avatar Sam Kagan
Browse files

Unmocked planes stuff and put the svc back the way it was

parent 2110d508
No related branches found
No related tags found
2 merge requests!25Merge 2.4.3 UI to main,!21Added tiles checklist for Accept-and-Archiving calibration jobs
......@@ -54,7 +54,7 @@
</div>
</div>
<div class="row no-gutters" *ngIf="jobDetail.queueName !== 'se_coarse_cube_imaging' && canAcceptArchive(jobDetail.status, jobDetail.archiveStatus)">
<div class="row no-gutters" *ngIf="canAcceptArchive(jobDetail.status, jobDetail.archiveStatus)">
<div class="col">
<button type="button" class="btn btn-success btn-sm" (click)="acceptQa()">Accept &amp; Archive</button>
</div>
......
......@@ -61,28 +61,33 @@ export class ExecutionDetailComponent implements OnInit, OnDestroy, OnChanges {
this.loadWeblogUrl();
}
});
this.jobService.getTiles(job.job_id).pipe(takeUntil(this.ngUnsubscribe)).subscribe(
(response: Tile[]) => {
this.tiles = new Map<string, Tile>(response.map(tile => {return [tile.name, tile]}));
for (const controlName in this.tilesFormGroup.controls) {
this.tilesFormGroup.removeControl(controlName);
if (this.canSelectTiles()) {
this.jobService.getTiles(job.job_id).pipe(takeUntil(this.ngUnsubscribe)).subscribe(
(response: Tile[]) => this.refreshTiles(response),
error => {
this.alertService.error(`Could not retrieve tiles: ${error}`);
});
}
if (this.canSelectPlanes()) {
this.jobService.getPlanes(job.job_id).subscribe((response: string) => {
this.planeKeys = response.split(/\r?\n|\r|\n/g); // Source: https://stackoverflow.com/a/21712066
for (const controlName in this.planesFormGroup.controls) {
this.planesFormGroup.removeControl(controlName);
}
Array.from(this.tiles.keys()).forEach(tile => this.tilesFormGroup.addControl(tile, new FormControl(true)));
this.planeKeys.forEach(key => this.planesFormGroup.addControl(key, new FormControl(true)));
},
error => {
this.alertService.error(`Could not retrieve tiles: ${error}`);
});
this.jobService.getPlanes(job.job_id).subscribe((response: string[]) => {
this.planeKeys = response;
for (const controlName in this.planesFormGroup.controls) {
this.planesFormGroup.removeControl(controlName);
error => {
this.alertService.error('Could not retrieve planes from planes.json. ' + error);
});
}
}
refreshTiles(newTiles: Tile[]) {
this.tiles = new Map<string, Tile>(newTiles.map(tile => {return [tile.name, tile]}));
for (const controlName in this.tilesFormGroup.controls) {
this.tilesFormGroup.removeControl(controlName);
}
this.planeKeys.forEach(key => this.planesFormGroup.addControl(key, new FormControl(true)));
},
error => {
this.alertService.error('Could not retrieve planes from planes.json. ' + error);
});
;
Array.from(this.tiles.keys()).forEach(tile => this.tilesFormGroup.addControl(tile, new FormControl(true)));
}
copyToClipboard(text: string): void {
......@@ -176,7 +181,7 @@ export class ExecutionDetailComponent implements OnInit, OnDestroy, OnChanges {
performQa(id: number, status: string, selectedTiles?: number[]) {
//console.log(status + 'ing QA');
let newStatus;
let newStatus: string = "";
if (status == 'accept' && (this.job.job_status === 'QA_READY' || this.job.job_status === 'QA_MANUAL')) {
newStatus = 'QA_ACCEPTED';
......@@ -195,11 +200,11 @@ export class ExecutionDetailComponent implements OnInit, OnDestroy, OnChanges {
};
canSelectPlanes(): boolean {
return this.jobDetail.queueName === 'se_continuum_cube_imaging' || true;
return this.jobDetail.queueName === 'se_continuum_cube_imaging' && this.canAcceptArchive(this.jobDetail.status, this.jobDetail.archiveStatus);
}
canSelectTiles(): boolean {
return this.jobDetail.queueName === 'calibration' || true;
return this.jobDetail.queueName === 'calibration' && this.canAcceptArchive(this.jobDetail.status, this.jobDetail.archiveStatus);
}
get tileNames(): string[] {
......
......@@ -166,12 +166,11 @@ export class JobsService {
}
// Returns a JSON encoded string of plane information
public getPlanes(id: number): Observable<string[]> {
// return this.http.get(this.configService.config.url + this.endPoint + 'jobs/' + id + '/planes', {observe: 'response'}).pipe(
// map(response => {
// return response;
// }));
return of(["plane1", "plane2", "plane3"]);
public getPlanes(id: number): Observable<string> {
return this.http.get<string>(this.configService.config.url + this.endPoint + 'jobs/' + id + '/planes', {observe: 'response'}).pipe(
map(response => {
return response.body;
}));
}
......@@ -204,16 +203,16 @@ export class JobsService {
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(
// switchMap(response => {
return this.http.put(ingestUrl, {}, {observe: "response"}).pipe(
switchMap(response => {
if (selectedTiles) {
// 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(tileUrl, selectedTiles, {observe: "response"}).pipe(map(response => response.body))
} else {
return of(response);
}
})
);
return this.http.post<Tile[]>(tileUrl, selectedTiles, {observe: "response"}).pipe(map(response => response.body))
// } else {
// return of(response.body);
// }
// })
// );
// }));
}
......
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