diff --git a/ogWebconsole/src/app/components/groups/clients/create-client/create-client.component.ts b/ogWebconsole/src/app/components/groups/clients/create-client/create-client.component.ts index 876277d..a5ce5db 100644 --- a/ogWebconsole/src/app/components/groups/clients/create-client/create-client.component.ts +++ b/ogWebconsole/src/app/components/groups/clients/create-client/create-client.component.ts @@ -38,6 +38,7 @@ export class CreateClientComponent implements OnInit { } ngOnInit(): void { + console.log(this.data); this.loadParentUnits(); // Load parent units when component initializes this.loadHardwareProfiles(); this.clientForm = this.fb.group({ @@ -48,8 +49,8 @@ export class CreateClientComponent implements OnInit { netDriver: null, mac: ['', Validators.required], ip: ['', Validators.required], - menu: [this.data.organizationalUnit && this.data.organizationalUnit.networkSettings.menu ? this.data.organizationalUnit.menu['@id'] : null], - hardwareProfile: [this.data.organizationalUnit && this.data.organizationalUnit.networkSettings.hardwareProfile ? this.data.organizationalUnit.networkSettings.hardwareProfile['@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 && 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( (data: any[]) => { this.hardwareProfiles = data; + this.loading = false }, (error: any) => { console.error('Error fetching hardware profiles', error); + this.loading = false } ); } diff --git a/ogWebconsole/src/app/components/groups/organizational-units/edit-organizational-unit/edit-organizational-unit.component.ts b/ogWebconsole/src/app/components/groups/organizational-units/edit-organizational-unit/edit-organizational-unit.component.ts index 280632e..74564f8 100644 --- a/ogWebconsole/src/app/components/groups/organizational-units/edit-organizational-unit/edit-organizational-unit.component.ts +++ b/ogWebconsole/src/app/components/groups/organizational-units/edit-organizational-unit/edit-organizational-unit.component.ts @@ -166,9 +166,10 @@ export class EditOrganizationalUnitComponent implements OnInit { description: this.generalFormGroup.value.description, comments: this.additionalInfoFormGroup.value.comments, type: this.generalFormGroup.value.type, - ...this.networkSettingsFormGroup.value + networkSettings: this.networkSettingsFormGroup.value }; + if (this.isEditMode) { // Edit mode: Send PUT request to update the unit const putUrl = `http://127.0.0.1:8080/organizational-units/${this.data.uuid}`;