Merge pull request #5273 from tsiegleauq/new-projector-reference

Create new projectors with clos reference
This commit is contained in:
Sean 2020-03-23 17:31:13 +01:00 committed by GitHub
commit 7d86f62e2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -135,4 +135,11 @@ export class ProjectorRepositoryService extends BaseRepository<ViewProjector, Pr
public async setReferenceProjector(projector_id: number): Promise<void> {
await this.http.post<void>(`/rest/core/projector/${projector_id}/set_reference_projector/`);
}
/**
* return the id of the current reference projector
*/
public getReferenceProjectorId(): number {
return this.getViewModelList().find(projector => projector.isReferenceProjector).id;
}
}

View File

@ -113,7 +113,8 @@ export class ProjectorListComponent extends BaseViewComponent implements OnInit,
dialogRef.afterClosed().subscribe(result => {
if (result) {
const projectorToCreate: Partial<Projector> = {
name: this.createForm.value.name
name: this.createForm.value.name,
reference_projector_id: this.repo.getReferenceProjectorId()
};
this.repo.create(projectorToCreate).then(() => {