diff --git a/apps/web/src/app/workspaces/components/capability-request/capability-request.component.ts b/apps/web/src/app/workspaces/components/capability-request/capability-request.component.ts index 28b6a46b74d7637b580f0daee742053c2618c84f..fca17d4662b9beb81745330a0904aeb98e2090c5 100644 --- a/apps/web/src/app/workspaces/components/capability-request/capability-request.component.ts +++ b/apps/web/src/app/workspaces/components/capability-request/capability-request.component.ts @@ -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 { diff --git a/apps/web/src/app/workspaces/components/capability-request/components/request-operations/request-operations.component.html b/apps/web/src/app/workspaces/components/capability-request/components/request-operations/request-operations.component.html index 8d7bc76a5909a6934e35ba335380a37555290577..1a198160f5f1063ebcb51186be15d5b84cb0fb7a 100644 --- a/apps/web/src/app/workspaces/components/capability-request/components/request-operations/request-operations.component.html +++ b/apps/web/src/app/workspaces/components/capability-request/components/request-operations/request-operations.component.html @@ -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) " > diff --git a/apps/web/src/app/workspaces/services/capability-launcher.service.ts b/apps/web/src/app/workspaces/services/capability-launcher.service.ts index bbf79060b9efdb06b913be1491f8476f397d06f0..25402cf0d0bdd553987123b48adf02ad80483be6 100644 --- a/apps/web/src/app/workspaces/services/capability-launcher.service.ts +++ b/apps/web/src/app/workspaces/services/capability-launcher.service.ts @@ -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