refs #2956. Added new param clientsPerPage
testing/ogGui-multibranch/pipeline/head There was a failure building this commit Details

pull/67/head
Manuel Aranda Rosales 2026-04-14 18:19:03 +02:00
parent 9c7778abcb
commit 382eb3e6db
5 changed files with 23 additions and 2 deletions

View File

@ -38,6 +38,12 @@
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field appearance="fill" class="full-width">
<mat-label>Clientes por página</mat-label>
<input matInput formControlName="clientsPerPage" type="number" min="1" placeholder="Por defecto (20)">
<mat-hint>Número de clientes mostrados por página en el listado</mat-hint>
</mat-form-field>
</form>
</mat-dialog-content>
<mat-dialog-actions class="action-container">

View File

@ -48,6 +48,7 @@ export class AddUserModalComponent implements OnInit {
password: ['', Validators.required],
role: ['', Validators.required],
groupsView: ['card', Validators.required],
clientsPerPage: [null, [Validators.min(1)]],
organizationalUnits: [[]]
});
@ -82,7 +83,8 @@ export class AddUserModalComponent implements OnInit {
username: response.username,
role: response.userGroups.length > 0 ? response.userGroups[0]['@id'] : null,
organizationalUnits: organizationalUnitIds,
groupsView: response.groupsView
groupsView: response.groupsView,
clientsPerPage: response.clientsPerPage ?? null
});
this.userId = response['@id'];
@ -108,7 +110,8 @@ export class AddUserModalComponent implements OnInit {
allowedOrganizationalUnits: this.userForm.value.organizationalUnits,
enabled: true,
userGroups: [this.userForm.value.role],
groupsView: this.userForm.value.groupsView
groupsView: this.userForm.value.groupsView,
clientsPerPage: this.userForm.value.clientsPerPage || null
};
if (!this.userId && this.userForm.value.password) {

View File

@ -38,6 +38,11 @@ export class UsersComponent implements OnInit {
header: 'Vista de Grupos',
cell: (user: any) => `${user.groupsView}`
},
{
columnDef: 'clientsPerPage',
header: 'Clientes por página',
cell: (user: any) => user.clientsPerPage != null ? `${user.clientsPerPage}` : '-'
},
{
columnDef: 'allowedOrganizationalUnits',
header: 'Unidades Organizacionales Permitidas',

View File

@ -151,6 +151,7 @@ export class GroupsComponent implements OnInit, OnDestroy {
this.treeDataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener);
this.currentView = this.auth.groupsView || 'list';
this.itemsPerPage = this.auth.clientsPerPage || 20;
}

View File

@ -15,6 +15,7 @@ interface JwtPayload {
id: number;
uuid: string;
groupsView: string;
clientsPerPage: number | null;
}
@Injectable({ providedIn: 'root' })
@ -94,6 +95,11 @@ export class AuthService {
return this.tokenPayload?.groupsView || null;
}
/** clientsPerPage del usuario */
get clientsPerPage(): number | null {
return this.tokenPayload?.clientsPerPage ?? null;
}
/**
* Devuelve el rol principal del usuario según prioridad.
*/