Skip to content
Snippets Groups Projects
Commit e992d68a authored by Janet Goldstein's avatar Janet Goldstein
Browse files

WS-858: in front end, use selectedVersion object rather than selectedVersion.version_number

parent 0b83fc95
No related branches found
No related tags found
3 merge requests!718WS-858: fix bugs in `create_follow_on_capability_request`, hopefully for the last time,!716WS-858: unit test for `create_follow_on_capability_request`.,!714WS-858: lay groundwork for fixing `create_follow_on_capability_request`.
Pipeline #4008 passed
This commit is part of merge request !718. Comments created here will be created in the context of that merge request.
......@@ -49,6 +49,12 @@ export class CapabilityRequestComponent implements OnInit, OnDestroy {
private capabilityRequestObserver = {
next: (request) => {
this.capabilityRequest = request;
if (this.latestVersion === undefined) {
this.latestVersion = this.capabilityRequest.versions[this.capabilityRequest.versions.length - 1]
}
if (this.currentVersion === undefined) {
this.currentVersion = this.latestVersion
}
if (this.currentVersion.current_execution !== null) {
this.capabilityExecution = this.currentVersion.current_execution;
} else {
......
......@@ -4,6 +4,7 @@
<app-create-new-version-form
id="create-new-version-form"
class="d-flex align-self-center"
[capabilityRequest]="capabilityRequest"
[selectedVersion]="selectedVersion"
></app-create-new-version-form>
</div>
......@@ -21,7 +22,7 @@
class="btn btn-warning"
(click)="
capabilityLauncherService
.createImageRequestFromPreviousCal('std_cms_imaging', capabilityRequest.id, selectedVersion.version_number)
.createImageRequestFromPreviousCal('std_cms_imaging', capabilityRequest.id, selectedVersion)
.subscribe(followonRequestObserver)
"
>
......
......@@ -22,6 +22,7 @@ import { Observable } from "rxjs";
import { CapabilityRequest } from "../model/capability-request";
import { CapabilityExecution } from "../model/capability-execution";
import { JsonObject } from "@angular/compiler-cli/ngcc/src/packages/entry_point";
import {CapabilityVersion} from "../model/capability-version";
@Injectable({
providedIn: "root",
......@@ -42,19 +43,19 @@ export class CapabilityLauncherService {
}
/**
* Create standard CMS imaging request from previously exeuted calibration request and send it to capability service
* Create standard CMS imaging request from previously executed calibration request and send it to capability service
* @param: capabilityName Name of capability to create request for
* @param: requestId Id of calibration request to image
*/
createImageRequestFromPreviousCal(
followonType: string,
requestId: string,
versionNumber: number,
selectedVersion: CapabilityVersion,
): Observable<CapabilityRequest> {
const url = this.endpoint + "request/" + requestId + + "/version/" + versionNumber + "/followon/" + followonType;
const url = this.endpoint + "request/" + requestId + "/version/" + selectedVersion.version_number + "/followon/" + followonType;
return this.httpClient.post<CapabilityRequest>(url, null);
}
/**
* Submit capability request
* @param: requestId ID of capability request to submit
......
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