From 48cd746b5983bf08e4bb1f796a01404e5274ad67 Mon Sep 17 00:00:00 2001 From: Mariela Bonilla Date: Tue, 6 Jul 2021 22:53:02 -0600 Subject: [PATCH 1/2] listar usuarios historia de usuario: listar usuarios registrados --- .../webapp/app/entities/user/user.model.ts | 13 +++++++- .../app/entities/user/user.service.spec.ts | 6 ++-- .../webapp/app/entities/user/user.service.ts | 3 ++ .../list/usuario-extra.component.html | 30 +++++++++-------- .../list/usuario-extra.component.scss | 12 +++++++ .../list/usuario-extra.component.ts | 33 +++++++++++++++++-- .../service/usuario-extra.service.ts | 8 +++++ 7 files changed, 87 insertions(+), 18 deletions(-) create mode 100644 src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.scss diff --git a/src/main/webapp/app/entities/user/user.model.ts b/src/main/webapp/app/entities/user/user.model.ts index 2792389..add3f05 100644 --- a/src/main/webapp/app/entities/user/user.model.ts +++ b/src/main/webapp/app/entities/user/user.model.ts @@ -1,10 +1,21 @@ export interface IUser { id?: number; login?: string; + firstName?: string | null; + lastName?: string | null; + email?: string; + authorities?: string[]; } export class User implements IUser { - constructor(public id: number, public login: string) {} + constructor( + public id: number, + public login: string, + public firstName?: string, + public lastName?: string, + public email?: string, + public authorities?: string[] + ) {} } export function getUserIdentifier(user: IUser): number | undefined { diff --git a/src/main/webapp/app/entities/user/user.service.spec.ts b/src/main/webapp/app/entities/user/user.service.spec.ts index 02c8695..3982373 100644 --- a/src/main/webapp/app/entities/user/user.service.spec.ts +++ b/src/main/webapp/app/entities/user/user.service.spec.ts @@ -32,8 +32,10 @@ describe('Service Tests', () => { }); const req = httpMock.expectOne({ method: 'GET' }); - req.flush([new User(123, 'user')]); - expect(expectedResult).toEqual([{ id: 123, login: 'user' }]); + req.flush([new User(123, 'user', 'fist name', 'last name', 'email@gmail.com', ['ROLE_USER'])]); + expect(expectedResult).toEqual([ + { id: 123, login: 'user', firstName: 'fist name', lastName: 'last name', email: 'email@gmail.com', authorities: ['ROLE_USER'] }, + ]); }); it('should propagate not found response', () => { diff --git a/src/main/webapp/app/entities/user/user.service.ts b/src/main/webapp/app/entities/user/user.service.ts index 7d23e9e..9d4571a 100644 --- a/src/main/webapp/app/entities/user/user.service.ts +++ b/src/main/webapp/app/entities/user/user.service.ts @@ -7,6 +7,9 @@ import { createRequestOption } from 'app/core/request/request-util'; import { isPresent } from 'app/core/util/operators'; import { Pagination } from 'app/core/request/request.model'; import { IUser, getUserIdentifier } from './user.model'; +import { map } from 'rxjs/operators'; + +export type EntityResponseType = HttpResponse; @Injectable({ providedIn: 'root' }) export class UserService { diff --git a/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.html b/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.html index 768a830..e69f537 100644 --- a/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.html +++ b/src/main/webapp/app/entities/usuario-extra/list/usuario-extra.component.html @@ -32,34 +32,38 @@ - - + - + + + - - + + - - + + - -
IDNombreRol de usuario Icono PerfilFecha NacimientoNombre UsuarioNombre CompletoCorreo electrónico EstadoUserPlantilla
+
    +
  • +

    {{ userRole }}

    +
  • +
+
- {{ usuarioExtra.id }} +
{{ usuarioExtra.nombre }}{{ usuarioExtra.iconoPerfil }}{{ usuarioExtra.fechaNacimiento | formatMediumDatetime }}{{ usuarioExtra.user.firstName }} {{ usuarioExtra.user.lastName }}{{ usuarioExtra.user.email }} {{ usuarioExtra.estado }} - {{ usuarioExtra.user?.id }} - +
- -