Skip to content
Snippets Groups Projects
Commit bc58b41a authored by Nathan Hertz's avatar Nathan Hertz
Browse files

Updated front-end yet again; this time, to use the newly created

submit_capability_request view
parent 9ced7ecd
No related branches found
No related tags found
1 merge request!96WS-31: Submit capability request view
......@@ -21,7 +21,7 @@ export class CapabilityLauncherService {
createRequest(
capabilityName: string,
parameters: string
): Observable<string> {
): Observable<CapabilityRequest> {
const url =
environment.workspacesUrl +
this.endpoint +
......@@ -30,15 +30,18 @@ export class CapabilityLauncherService {
const requestParams = JSON.stringify({
parameters: parameters,
});
return this.httpClient.post<string>(url, requestParams);
return this.httpClient.post<CapabilityRequest>(url, requestParams);
}
/**
* Submit capability request
* @param: requestId ID of capability request to submit
*/
submit(requestId: string): Observable<CapabilityExecution> {
const url = `${environment.workspacesUrl}${this.endpoint}request/${requestId}/submit`;
submit(
capabilityName: string,
requestId: string
): Observable<CapabilityExecution> {
const url = `${environment.workspacesUrl}${this.endpoint}${capabilityName}/request/${requestId}/submit`;
return this.httpClient.post<CapabilityExecution>(url, null);
}
}
......@@ -42,19 +42,20 @@ export class WorkspacesComponent implements OnInit {
// Create capability request
this.capabilityLauncher.createRequest(capabilityName, parameters).subscribe(
(requestResponse) => {
const capabilityRequest = JSON.parse(requestResponse);
this.capabilityRequests.push(capabilityRequest);
if (capabilityRequest.id) {
this.capabilityRequests.push(requestResponse);
if (requestResponse.id) {
// Capability request created; ID found
// Submit capability request
this.capabilityLauncher.submit(capabilityRequest.id).subscribe(
(submitResponse) => {
this.capabilityExecutions.push(submitResponse);
},
(error) => {
console.log(error);
}
);
this.capabilityLauncher
.submit(capabilityName, requestResponse.id)
.subscribe(
(submitResponse) => {
this.capabilityExecutions.push(submitResponse);
},
(error) => {
console.log(error);
}
);
}
},
(error) => {
......
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