diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a4108e..ea4e4a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [1.14.1] - 2026-10-06 ### Fixed +- **UI/UX (Componentes Genéricos)**: Refactorizado el comportamiento de `app-ou-select` para que devuelva siempre el identificador URI (`@id`) de la unidad organizativa en lugar de su ID numérico. Esto corrige varios errores críticos en cadena (como el error al mover clientes o añadir clientes a subredes de DHCP) provocados porque la API de Symfony (API Platform) requiere referencias URI (`/api/organizational_units/X`) para mapear entidades relacionales, en vez de identificadores enteros puros. - **DHCP Subnets**: Solucionado un error al añadir equipos a una subred donde la petición al servidor enviaba la unidad organizativa como "undefined", impidiendo listar los equipos del aula seleccionada. ## [1.14.0] - 2026-10-05 diff --git a/ogWebconsole/src/app/components/groups/shared/change-parent/change-parent.component.ts b/ogWebconsole/src/app/components/groups/shared/change-parent/change-parent.component.ts index 1de639e..10a1fbf 100644 --- a/ogWebconsole/src/app/components/groups/shared/change-parent/change-parent.component.ts +++ b/ogWebconsole/src/app/components/groups/shared/change-parent/change-parent.component.ts @@ -52,9 +52,12 @@ export class ChangeParentComponent implements OnInit { } save() { + const selectedUnit = this.units.find(u => u.id === this.newOU || u['@id'] === this.newOU); + const unitIri = selectedUnit ? selectedUnit['@id'] : (typeof this.newOU === 'number' ? `/api/organizational_units/${this.newOU}` : this.newOU); + this.http.post(`${this.baseUrl}/clients/change-organizational-unit`, { clients: this.data.clients.map((client: any) => client['@id']), - organizationalUnit: this.newOU + organizationalUnit: unitIri }).subscribe({ next: (response) => { this.toastService.success(this.translate.instant('parentChangedSuccessfully')); diff --git a/ogWebconsole/src/app/components/ogdhcp/add-clients-to-subnet/add-clients-to-subnet.component.ts b/ogWebconsole/src/app/components/ogdhcp/add-clients-to-subnet/add-clients-to-subnet.component.ts index eae3a7a..8824e39 100644 --- a/ogWebconsole/src/app/components/ogdhcp/add-clients-to-subnet/add-clients-to-subnet.component.ts +++ b/ogWebconsole/src/app/components/ogdhcp/add-clients-to-subnet/add-clients-to-subnet.component.ts @@ -65,7 +65,8 @@ export class AddClientsToSubnetComponent implements OnInit { loadChildUnits(event: any) { - this.http.get(`${this.baseUrl}/clients?organizationalUnit.id=${event.value}&exists[subnet]=false`).subscribe( + const unitId = typeof event.value === 'string' && event.value.includes('/') ? event.value.split('/').pop() : event.value; + this.http.get(`${this.baseUrl}/clients?organizationalUnit.id=${unitId}&exists[subnet]=false`).subscribe( response => { this.clients = response['hydra:member']; }, diff --git a/ogWebconsole/src/app/components/shared/ou-select/ou-select.component.html b/ogWebconsole/src/app/components/shared/ou-select/ou-select.component.html index 12791ac..bc65b1b 100644 --- a/ogWebconsole/src/app/components/shared/ou-select/ou-select.component.html +++ b/ogWebconsole/src/app/components/shared/ou-select/ou-select.component.html @@ -9,8 +9,8 @@ - @for (unit of filteredUnits; track (unit.id || unit['@id'])) { - + @for (unit of filteredUnits; track (unit['@id'] || unit.id)) { +
{{ unit.name }}
@if (unit.path) {
{{ unit.path }}
diff --git a/ogWebconsole/src/app/components/shared/ou-select/ou-select.component.ts b/ogWebconsole/src/app/components/shared/ou-select/ou-select.component.ts index 11b4e90..4d5a8ec 100644 --- a/ogWebconsole/src/app/components/shared/ou-select/ou-select.component.ts +++ b/ogWebconsole/src/app/components/shared/ou-select/ou-select.component.ts @@ -69,9 +69,9 @@ export class OuSelectComponent implements ControlValueAccessor { getSelectedName(): string { if (this.multiple) { if (!this.value || !Array.isArray(this.value)) return ''; - return this.units.filter(u => this.value.includes(u.id || u['@id'])).map(u => u.name).join(', '); + return this.units.filter(u => this.value.includes(u['@id'] || u.id)).map(u => u.name).join(', '); } else { - return this.units.find(u => (u.id || u['@id']) === this.value)?.name || ''; + return this.units.find(u => (u['@id'] || u.id) === this.value)?.name || ''; } } }