refs #434. Fixed bug

pull/4/head
Manuel Aranda Rosales 2024-07-15 12:52:38 +02:00
parent 5c72cc2fd6
commit 26a8122890
2 changed files with 7 additions and 3 deletions

View File

@ -38,6 +38,7 @@ export class CreateClientComponent implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
console.log(this.data);
this.loadParentUnits(); // Load parent units when component initializes this.loadParentUnits(); // Load parent units when component initializes
this.loadHardwareProfiles(); this.loadHardwareProfiles();
this.clientForm = this.fb.group({ this.clientForm = this.fb.group({
@ -48,8 +49,8 @@ export class CreateClientComponent implements OnInit {
netDriver: null, netDriver: null,
mac: ['', Validators.required], mac: ['', Validators.required],
ip: ['', Validators.required], ip: ['', Validators.required],
menu: [this.data.organizationalUnit && this.data.organizationalUnit.networkSettings.menu ? this.data.organizationalUnit.menu['@id'] : null], menu: [this.data.organizationalUnit && this.data.organizationalUnit.networkSettings && this.data.organizationalUnit.networkSettings.menu ? this.data.organizationalUnit.networkSettings.menu['@id'] : null],
hardwareProfile: [this.data.organizationalUnit && this.data.organizationalUnit.networkSettings.hardwareProfile ? this.data.organizationalUnit.networkSettings.hardwareProfile['@id'] : null], hardwareProfile: [this.data.organizationalUnit && this.data.organizationalUnit.networkSettings && this.data.organizationalUnit.networkSettings.hardwareProfile ? this.data.organizationalUnit.networkSettings.hardwareProfile['@id'] : null],
}); });
} }
@ -57,9 +58,11 @@ export class CreateClientComponent implements OnInit {
this.dataService.getHardwareProfiles().subscribe( this.dataService.getHardwareProfiles().subscribe(
(data: any[]) => { (data: any[]) => {
this.hardwareProfiles = data; this.hardwareProfiles = data;
this.loading = false
}, },
(error: any) => { (error: any) => {
console.error('Error fetching hardware profiles', error); console.error('Error fetching hardware profiles', error);
this.loading = false
} }
); );
} }

View File

@ -166,9 +166,10 @@ export class EditOrganizationalUnitComponent implements OnInit {
description: this.generalFormGroup.value.description, description: this.generalFormGroup.value.description,
comments: this.additionalInfoFormGroup.value.comments, comments: this.additionalInfoFormGroup.value.comments,
type: this.generalFormGroup.value.type, type: this.generalFormGroup.value.type,
...this.networkSettingsFormGroup.value networkSettings: this.networkSettingsFormGroup.value
}; };
if (this.isEditMode) { if (this.isEditMode) {
// Edit mode: Send PUT request to update the unit // Edit mode: Send PUT request to update the unit
const putUrl = `http://127.0.0.1:8080/organizational-units/${this.data.uuid}`; const putUrl = `http://127.0.0.1:8080/organizational-units/${this.data.uuid}`;