refactor: conditionally update network settings based on excludeParentChanges flag
testing/ogGui-multibranch/pipeline/head This commit looks good Details

pull/23/head
Lucas Lara García 2025-05-16 12:59:03 +02:00
parent 639f55edb3
commit 4ff21afb57
1 changed files with 34 additions and 25 deletions

View File

@ -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,
@ -331,16 +332,21 @@ export class ManageOrganizationalUnitComponent implements OnInit {
this.http.get<any>(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
});
if (!exclude) {
this.networkSettingsFormGroup.patchValue({
proxy: data.networkSettings?.proxy,
dns: data.networkSettings?.dns,
@ -360,6 +366,8 @@ export class ManageOrganizationalUnitComponent implements OnInit {
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();
},