From 9c004441a8e19a98830d244a2f049f45c58be816 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Wed, 5 Mar 2025 09:02:07 +0100 Subject: [PATCH] Chagned filter groups and user improvements --- .../add-user-modal.component.ts | 23 ++++++----- .../components/groups/groups.component.html | 14 ++++++- .../app/components/groups/groups.component.ts | 39 +++++++++++++++++-- .../groups/services/data.service.ts | 2 +- .../app/layout/header/header.component.css | 4 +- 5 files changed, 65 insertions(+), 17 deletions(-) diff --git a/ogWebconsole/src/app/components/admin/users/users/add-user-modal/add-user-modal.component.ts b/ogWebconsole/src/app/components/admin/users/users/add-user-modal/add-user-modal.component.ts index 5c742c6..c5987ba 100644 --- a/ogWebconsole/src/app/components/admin/users/users/add-user-modal/add-user-modal.component.ts +++ b/ogWebconsole/src/app/components/admin/users/users/add-user-modal/add-user-modal.component.ts @@ -94,14 +94,20 @@ export class AddUserModalComponent implements OnInit { onSubmit(): void { if (this.userForm.valid) { - const payload = { + const payload: any = { username: this.userForm.value.username, - allowedOrganizationalUnits: this.userForm.value.organizationalUnit, - password: this.userForm.value.password, + allowedOrganizationalUnits: this.userForm.value.organizationalUnits, enabled: true, - userGroups: [this.userForm.value.role ], + userGroups: [this.userForm.value.role], groupsView: this.userForm.value.groupsView }; + + if (!this.userId && this.userForm.value.password) { + payload.password = this.userForm.value.password; + } else if (this.userId && this.userForm.value.password.trim() !== '') { + payload.password = this.userForm.value.password; + } + this.loading = true; if (this.userId) { @@ -109,12 +115,11 @@ export class AddUserModalComponent implements OnInit { (response) => { this.toastService.success('Usuario editado correctamente'); this.dialogRef.close(); - this.loading = false + this.loading = false; }, (error) => { this.toastService.error(error['error']['hydra:description']); - this.loading = false - + this.loading = false; } ); } else { @@ -122,11 +127,11 @@ export class AddUserModalComponent implements OnInit { (response) => { this.toastService.success('Usuario aƱadido correctamente'); this.dialogRef.close(); - this.loading = false + this.loading = false; }, (error) => { this.toastService.error(error['error']['hydra:description']); - this.loading = false + this.loading = false; } ); } diff --git a/ogWebconsole/src/app/components/groups/groups.component.html b/ogWebconsole/src/app/components/groups/groups.component.html index 694f3fd..6eac0b7 100644 --- a/ogWebconsole/src/app/components/groups/groups.component.html +++ b/ogWebconsole/src/app/components/groups/groups.component.html @@ -59,6 +59,18 @@ close + + + + {{ option.name }} + + + + + +