Skip to content
Snippets Groups Projects
Commit e972e686 authored by Nathan Bockisch's avatar Nathan Bockisch
Browse files

Fixed issue with notes not updating after changing versions, and changes not...

Fixed issue with notes not updating after changing versions, and changes not appearing in window after clicking out and back into the editor
parent bc57171f
No related branches found
No related tags found
1 merge request!932Fixed issue with notes not updating after changing versions, and changes not appearing in window after clicking out and back into the editor
Pipeline #5200 passed
......@@ -6,6 +6,7 @@
modalTitleText="DA Notes"
[textToEdit]="daNotes"
(newEditEvent)="emitEditEventToParent($event)"
(click)="getDaNotesURL()"
>
<span class="fas fa-edit"></span>
DA Notes
......
......@@ -35,19 +35,12 @@ export class DANotesComponent implements OnInit {
@Input() currentVersion: CapabilityVersion;
public daNotes: string;
private curCapabilityRequestId: string;
private curCapabilityVersion: string;
private url: string;
constructor(
private workflowService: WorkflowService,
constructor( private workflowService: WorkflowService,
private httpClient: HttpClient,
) {}
ngOnInit(): void {
this.curCapabilityRequestId = this.capabilityRequest.id;
this.curCapabilityVersion = this.currentVersion.version_number.toString();
this.url = "/capability/request/" + this.curCapabilityRequestId + "/version/" + this.curCapabilityVersion + "/da_notes";
if (!this.daNotes) {
this.getDaNotesURL();
......@@ -55,13 +48,17 @@ export class DANotesComponent implements OnInit {
}
// Get da_notes contents for editing
private async getDaNotesURL() {
async getDaNotesURL() {
this.daNotes = await new Promise<string>(resolve =>
this.retrieveFromDaNotesEndpoint().subscribe(notes => resolve(notes['resp'])));
}
private retrieveFromDaNotesEndpoint(): Observable<string> {
return this.httpClient.get<any>(this.url);
var curCapabilityRequestId = this.capabilityRequest.id;
var curCapabilityVersion = this.currentVersion.version_number.toString();
const url = "/capability/request/" + curCapabilityRequestId + "/version/" + curCapabilityVersion + "/da_notes";
return this.httpClient.get<any>(url);
}
private saveDaNotesObserver = {
......@@ -70,7 +67,11 @@ export class DANotesComponent implements OnInit {
};
private saveDaNotes(edits: string): Observable<string> {
return this.httpClient.post<any>(this.url, JSON.stringify({"edits":edits}));
var curCapabilityRequestId = this.capabilityRequest.id;
var curCapabilityVersion = this.currentVersion.version_number.toString();
const url = "/capability/request/" + curCapabilityRequestId + "/version/" + curCapabilityVersion + "/da_notes";
return this.httpClient.post<any>(url, JSON.stringify({"edits":edits}));
}
emitEditEventToParent(edits: string): void {
......
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