diff --git a/ogWebconsole/src/app/components/groups/shared/organizational-units/manage-organizational-unit/manage-organizational-unit.component.ts b/ogWebconsole/src/app/components/groups/shared/organizational-units/manage-organizational-unit/manage-organizational-unit.component.ts index 1ae3a86..649b584 100644 --- a/ogWebconsole/src/app/components/groups/shared/organizational-units/manage-organizational-unit/manage-organizational-unit.component.ts +++ b/ogWebconsole/src/app/components/groups/shared/organizational-units/manage-organizational-unit/manage-organizational-unit.component.ts @@ -182,7 +182,8 @@ export class ManageOrganizationalUnitComponent implements OnInit { setOrganizationalUnitDefaults(unitId: string): void { const selectedUnit: any = this.parentUnitsWithPaths.find(unit => unit.id === unitId); - if (selectedUnit) { + const exclude = this.generalFormGroup.get('excludeParentChanges')?.value; + if (selectedUnit && !exclude) { this.networkSettingsFormGroup.patchValue({ repository: selectedUnit.repository || null, hardwareProfile: selectedUnit.hardwareProfile || null, @@ -229,14 +230,14 @@ export class ManageOrganizationalUnitComponent implements OnInit { const url = `${this.baseUrl}/pxe-templates?page=1&itemsPerPage=10000`; this.http.get(url).subscribe( - response => { + response => { this.pxeTemplates = response['hydra:member']; resolve(); - }, - error => { + }, + error => { console.error('Error fetching pxe templates:', error); reject(error); - } + } ); }); } @@ -331,35 +332,42 @@ export class ManageOrganizationalUnitComponent implements OnInit { this.http.get(url).subscribe( data => { + const exclude = data.excludeParentChanges; + this.generalFormGroup.patchValue({ name: data.name, parent: data.parent ? data.parent['@id'] : '', description: data.description, type: data.type, - excludeParentChanges: data.excludeParentChanges + excludeParentChanges: exclude }); + this.additionalInfoFormGroup.patchValue({ comments: data.comments }); - this.networkSettingsFormGroup.patchValue({ - proxy: data.networkSettings?.proxy, - dns: data.networkSettings?.dns, - netmask: data.networkSettings?.netmask, - router: data.networkSettings?.router, - ntp: data.networkSettings?.ntp, - netiface: data.networkSettings?.netiface, - p2pMode: data.networkSettings?.p2pMode, - p2pTime: data.networkSettings?.p2pTime, - mcastIp: data.networkSettings?.mcastIp, - mcastSpeed: data.networkSettings?.mcastSpeed, - mcastPort: data.networkSettings?.mcastPort, - mcastMode: data.networkSettings?.mcastMode, - menu: data.networkSettings?.menu ? data.networkSettings.menu['@id'] : null, - hardwareProfile: data.networkSettings?.hardwareProfile ? data.networkSettings.hardwareProfile['@id'] : null, - ogLive: data.networkSettings?.ogLive ? data.networkSettings.ogLive['@id'] : null, - repository: data.networkSettings?.repository ? data.networkSettings.repository['@id'] : null, - pxeTemplate: data.networkSettings?.pxeTemplate ? data.networkSettings.pxeTemplate['@id'] : null - }); + + if (!exclude) { + this.networkSettingsFormGroup.patchValue({ + proxy: data.networkSettings?.proxy, + dns: data.networkSettings?.dns, + netmask: data.networkSettings?.netmask, + router: data.networkSettings?.router, + ntp: data.networkSettings?.ntp, + netiface: data.networkSettings?.netiface, + p2pMode: data.networkSettings?.p2pMode, + p2pTime: data.networkSettings?.p2pTime, + mcastIp: data.networkSettings?.mcastIp, + mcastSpeed: data.networkSettings?.mcastSpeed, + mcastPort: data.networkSettings?.mcastPort, + mcastMode: data.networkSettings?.mcastMode, + menu: data.networkSettings?.menu ? data.networkSettings.menu['@id'] : null, + hardwareProfile: data.networkSettings?.hardwareProfile ? data.networkSettings.hardwareProfile['@id'] : null, + ogLive: data.networkSettings?.ogLive ? data.networkSettings.ogLive['@id'] : null, + repository: data.networkSettings?.repository ? data.networkSettings.repository['@id'] : null, + pxeTemplate: data.networkSettings?.pxeTemplate ? data.networkSettings.pxeTemplate['@id'] : null + }); + } + this.classroomInfoFormGroup.patchValue({ location: data.location, projector: data.projector, @@ -367,6 +375,7 @@ export class ManageOrganizationalUnitComponent implements OnInit { capacity: data.capacity, remoteCalendar: data.remoteCalendar ? data.remoteCalendar['@id'] : null }); + resolve(); },