refactor: conditionally update network settings based on excludeParentChanges flag
testing/ogGui-multibranch/pipeline/head This commit looks good
Details
testing/ogGui-multibranch/pipeline/head This commit looks good
Details
parent
639f55edb3
commit
4ff21afb57
|
@ -182,7 +182,8 @@ export class ManageOrganizationalUnitComponent implements OnInit {
|
||||||
|
|
||||||
setOrganizationalUnitDefaults(unitId: string): void {
|
setOrganizationalUnitDefaults(unitId: string): void {
|
||||||
const selectedUnit: any = this.parentUnitsWithPaths.find(unit => unit.id === unitId);
|
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({
|
this.networkSettingsFormGroup.patchValue({
|
||||||
repository: selectedUnit.repository || null,
|
repository: selectedUnit.repository || null,
|
||||||
hardwareProfile: selectedUnit.hardwareProfile || null,
|
hardwareProfile: selectedUnit.hardwareProfile || null,
|
||||||
|
@ -229,14 +230,14 @@ export class ManageOrganizationalUnitComponent implements OnInit {
|
||||||
const url = `${this.baseUrl}/pxe-templates?page=1&itemsPerPage=10000`;
|
const url = `${this.baseUrl}/pxe-templates?page=1&itemsPerPage=10000`;
|
||||||
|
|
||||||
this.http.get<any>(url).subscribe(
|
this.http.get<any>(url).subscribe(
|
||||||
response => {
|
response => {
|
||||||
this.pxeTemplates = response['hydra:member'];
|
this.pxeTemplates = response['hydra:member'];
|
||||||
resolve();
|
resolve();
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.error('Error fetching pxe templates:', error);
|
console.error('Error fetching pxe templates:', error);
|
||||||
reject(error);
|
reject(error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -331,35 +332,42 @@ export class ManageOrganizationalUnitComponent implements OnInit {
|
||||||
|
|
||||||
this.http.get<any>(url).subscribe(
|
this.http.get<any>(url).subscribe(
|
||||||
data => {
|
data => {
|
||||||
|
const exclude = data.excludeParentChanges;
|
||||||
|
|
||||||
this.generalFormGroup.patchValue({
|
this.generalFormGroup.patchValue({
|
||||||
name: data.name,
|
name: data.name,
|
||||||
parent: data.parent ? data.parent['@id'] : '',
|
parent: data.parent ? data.parent['@id'] : '',
|
||||||
description: data.description,
|
description: data.description,
|
||||||
type: data.type,
|
type: data.type,
|
||||||
excludeParentChanges: data.excludeParentChanges
|
excludeParentChanges: exclude
|
||||||
});
|
});
|
||||||
|
|
||||||
this.additionalInfoFormGroup.patchValue({
|
this.additionalInfoFormGroup.patchValue({
|
||||||
comments: data.comments
|
comments: data.comments
|
||||||
});
|
});
|
||||||
this.networkSettingsFormGroup.patchValue({
|
|
||||||
proxy: data.networkSettings?.proxy,
|
if (!exclude) {
|
||||||
dns: data.networkSettings?.dns,
|
this.networkSettingsFormGroup.patchValue({
|
||||||
netmask: data.networkSettings?.netmask,
|
proxy: data.networkSettings?.proxy,
|
||||||
router: data.networkSettings?.router,
|
dns: data.networkSettings?.dns,
|
||||||
ntp: data.networkSettings?.ntp,
|
netmask: data.networkSettings?.netmask,
|
||||||
netiface: data.networkSettings?.netiface,
|
router: data.networkSettings?.router,
|
||||||
p2pMode: data.networkSettings?.p2pMode,
|
ntp: data.networkSettings?.ntp,
|
||||||
p2pTime: data.networkSettings?.p2pTime,
|
netiface: data.networkSettings?.netiface,
|
||||||
mcastIp: data.networkSettings?.mcastIp,
|
p2pMode: data.networkSettings?.p2pMode,
|
||||||
mcastSpeed: data.networkSettings?.mcastSpeed,
|
p2pTime: data.networkSettings?.p2pTime,
|
||||||
mcastPort: data.networkSettings?.mcastPort,
|
mcastIp: data.networkSettings?.mcastIp,
|
||||||
mcastMode: data.networkSettings?.mcastMode,
|
mcastSpeed: data.networkSettings?.mcastSpeed,
|
||||||
menu: data.networkSettings?.menu ? data.networkSettings.menu['@id'] : null,
|
mcastPort: data.networkSettings?.mcastPort,
|
||||||
hardwareProfile: data.networkSettings?.hardwareProfile ? data.networkSettings.hardwareProfile['@id'] : null,
|
mcastMode: data.networkSettings?.mcastMode,
|
||||||
ogLive: data.networkSettings?.ogLive ? data.networkSettings.ogLive['@id'] : null,
|
menu: data.networkSettings?.menu ? data.networkSettings.menu['@id'] : null,
|
||||||
repository: data.networkSettings?.repository ? data.networkSettings.repository['@id'] : null,
|
hardwareProfile: data.networkSettings?.hardwareProfile ? data.networkSettings.hardwareProfile['@id'] : null,
|
||||||
pxeTemplate: data.networkSettings?.pxeTemplate ? data.networkSettings.pxeTemplate['@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({
|
this.classroomInfoFormGroup.patchValue({
|
||||||
location: data.location,
|
location: data.location,
|
||||||
projector: data.projector,
|
projector: data.projector,
|
||||||
|
@ -367,6 +375,7 @@ export class ManageOrganizationalUnitComponent implements OnInit {
|
||||||
capacity: data.capacity,
|
capacity: data.capacity,
|
||||||
remoteCalendar: data.remoteCalendar ? data.remoteCalendar['@id'] : null
|
remoteCalendar: data.remoteCalendar ? data.remoteCalendar['@id'] : null
|
||||||
});
|
});
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue