Revize e75c5129
Přidáno uživatelem Dominik Chlouba před téměř 4 roky(ů)
src/Core/Application/Leuze.Core.Application.UI/Pages/Users/Components/UserAside.razor | ||
---|---|---|
312 | 312 |
|
313 | 313 |
private async Task FetchUsers() |
314 | 314 |
{ |
315 |
var result = await _mediator.Send(new GetUsersList.Query(false, Role));
|
|
315 |
var result = await _mediator.Send(new GetUsersList.Query(false, "TL"));
|
|
316 | 316 |
if (result.IsSuccess && result.Result is not null) |
317 | 317 |
{ |
318 | 318 |
if (UserId == default(Guid)) Users = result.Result.List; |
src/Core/Application/Leuze.Core.Application.UI/Pages/Users/List.razor | ||
---|---|---|
19 | 19 |
<th>@T["Email"]</th> |
20 | 20 |
<th>@T["Role"]</th> |
21 | 21 |
<th>@T["Type"]</th> |
22 |
<th>@T["Senior"]</th> |
|
22 | 23 |
<th>@T["Actions"]</th> |
23 | 24 |
</tr> |
24 | 25 |
@foreach (var user in Users) |
25 | 26 |
{ |
26 |
<tr> |
|
27 |
<td>@user.Name</td> |
|
28 |
<td>@user.Email</td> |
|
29 |
<td>@user.Role</td> |
|
30 |
<td>@(user.IsAdUser ? "AD" : "Lokální")</td> |
|
31 |
<td> |
|
32 |
<div class="button-ui" @onclick="() => SetUserAsideId(user.Id)"> |
|
33 |
<i class="fal fa-edit"></i> |
|
34 |
@T["Edit"] |
|
35 |
</div> |
|
36 |
</td> |
|
37 |
</tr> |
|
27 |
<tr> |
|
28 |
<td>@user.Name</td> |
|
29 |
<td>@user.Email</td> |
|
30 |
<td>@user.Role</td> |
|
31 |
<td>@(user.IsAdUser ? "AD" : "Lokální")</td> |
|
32 |
<td>@(user.SeniorName is not null ? user.SeniorName : "Bez nadřízeného")</td> |
|
33 |
<td> |
|
34 |
<div class="button-ui" @onclick="() => SetUserAsideId(user.Id)"> |
|
35 |
<i class="fal fa-edit"></i> |
|
36 |
@T["Edit"] |
|
37 |
</div> |
|
38 |
</td> |
|
39 |
</tr> |
|
38 | 40 |
} |
39 | 41 |
</table> |
40 | 42 |
@if (Users.Count > 0) |
src/Core/Application/Leuze.Core.Application/CQRS/Users/Queries/GetUsersList.cs | ||
---|---|---|
1 | 1 |
using Leuze.Core.Domain.Domains.Users.DTOs; |
2 | 2 |
using Leuze.Core.Domain.Repositories; |
3 |
using Microsoft.AspNetCore.Components.Authorization; |
|
4 |
using System; |
|
5 | 3 |
using System.Collections.Generic; |
6 | 4 |
using System.Linq; |
7 |
using System.Security.Claims; |
|
8 | 5 |
using System.Threading; |
9 | 6 |
using System.Threading.Tasks; |
10 | 7 |
using Leuze.Core.Application.Authentication; |
... | ... | |
19 | 16 |
/// <summary> |
20 | 17 |
/// |
21 | 18 |
/// </summary> |
22 |
public record Query(bool ExcludeMyself, Guid LimitForRole) : IBaseRequest<Response>;
|
|
19 |
public record Query(bool ExcludeMyself, string? LimitForRole) : IBaseRequest<Response>;
|
|
23 | 20 |
|
24 | 21 |
/// <summary> |
25 | 22 |
/// |
src/Core/Domain/Leuze.Core.Domain/Domains/Users/DTOs/UserDto.cs | ||
---|---|---|
5 | 5 |
/// <summary> |
6 | 6 |
/// |
7 | 7 |
/// </summary> |
8 |
public record UserDto(Guid Id, string Name, string Email, string Role, bool IsAdUser); |
|
8 |
public record UserDto(Guid Id, string Name, string? SeniorName, string Email, string Role, bool IsAdUser);
|
|
9 | 9 |
} |
src/Core/Domain/Leuze.Core.Domain/Domains/Users/DTOs/UserShortDto.cs | ||
---|---|---|
5 | 5 |
/// <summary> |
6 | 6 |
/// |
7 | 7 |
/// </summary> |
8 |
public record UserShortDto(Guid Id, string Name); |
|
8 |
public record UserShortDto(Guid Id, string Name, Guid? SeniorId, Guid RoleId, string RoleName);
|
|
9 | 9 |
} |
src/Core/Domain/Leuze.Core.Domain/Repositories/IDomainUserRepository.cs | ||
---|---|---|
52 | 52 |
/// |
53 | 53 |
/// </summary> |
54 | 54 |
/// <returns></returns> |
55 |
Task<List<UserShortDto>> GetListAsync(Guid limitForRole);
|
|
55 |
Task<List<UserShortDto>> GetListAsync(string? limitForRole);
|
|
56 | 56 |
|
57 | 57 |
/// <summary> |
58 | 58 |
/// |
... | ... | |
60 | 60 |
/// <param name="id"></param> |
61 | 61 |
/// <returns></returns> |
62 | 62 |
Task<UserDetailDto> GetDetailByIdAsync(Guid id); |
63 |
|
|
64 |
/// <summary> |
|
65 |
/// |
|
66 |
/// </summary> |
|
67 |
/// <returns></returns> |
|
68 |
Task<List<UserShortDto>> GetAllNonAdminUsers(); |
|
69 |
|
|
70 |
/// <summary> |
|
71 |
/// |
|
72 |
/// </summary> |
|
73 |
/// <returns></returns> |
|
74 |
Task<List<UserShortDto>> GetAllTLUsers(); |
|
75 |
|
|
76 |
/// <summary> |
|
77 |
/// |
|
78 |
/// </summary> |
|
79 |
/// <param name="id"></param> |
|
80 |
/// <returns></returns> |
|
81 |
Task<List<UserShortDto>> GetAllMAUsersFromTL(Guid id); |
|
82 |
|
|
63 | 83 |
} |
64 | 84 |
} |
src/Core/Infrastructure/Leuze.Core.Infrastructure.Persistence/Repository/DomainUserRepository.cs | ||
---|---|---|
45 | 45 |
/// <inheritdoc/> |
46 | 46 |
public async Task<(List<UserDto> List, int Total)> GetFilteredListAsync(int pageNumber, int pageSize) |
47 | 47 |
{ |
48 |
var query = dbSet.Include(o => o.User).ThenInclude(o => o.Roles).AsNoTracking().AsQueryable(); |
|
48 |
var query = dbSet.Include(o => o.SeniorUser).Include(o => o.User).ThenInclude(o => o.Roles).AsNoTracking().AsQueryable();
|
|
49 | 49 |
|
50 | 50 |
var total = await query.CountAsync(); |
51 | 51 |
|
52 |
var list = await query.Select(o => new UserDto(o.UserId, o.Name.FullName, o.EmailAddress.Email, o.User.Roles.Single().Name, o.User.IsAdUser)) |
|
52 |
var list = await query.Select(o => new UserDto(o.UserId, o.Name.FullName, o.SeniorUser != null ? o.SeniorUser.Name.FullName : null!, o.EmailAddress.Email, o.User.Roles.Single().Name, o.User.IsAdUser))
|
|
53 | 53 |
.Skip((pageNumber - 1) * pageSize) |
54 | 54 |
.Take(pageSize) |
55 | 55 |
.ToListAsync(); |
... | ... | |
71 | 71 |
.SingleOrDefaultAsync(); |
72 | 72 |
|
73 | 73 |
/// <inheritdoc/> |
74 |
public async Task<List<UserShortDto>> GetListAsync(Guid limitForRole)
|
|
74 |
public async Task<List<UserShortDto>> GetListAsync(string? limitForRole)
|
|
75 | 75 |
{ |
76 |
var query = dbSet.AsQueryable(); |
|
76 |
var query = dbSet.Include(o => o.User).ThenInclude(o => o.Roles).AsQueryable();
|
|
77 | 77 |
|
78 |
return await query.Select(o => new UserShortDto(o.UserId, o.Name.FullName)).ToListAsync(); |
|
78 |
if (limitForRole is not null) query = query.Where(o => o.User.Roles.Any(a => a.NormalizedName == limitForRole.ToUpper())); |
|
79 |
|
|
80 |
return await query.Select(o => new UserShortDto(o.UserId, o.Name.FullName, o.SeniorUserId, o.User.Roles.First().Id, o.User.Roles.First().Name)).ToListAsync(); |
|
79 | 81 |
} |
82 |
|
|
83 |
/// <inheritdoc/> |
|
84 |
public async Task<List<UserShortDto>> GetAllNonAdminUsers() |
|
85 |
=> await dbSet.Include(o => o.User).ThenInclude(o => o.Roles) |
|
86 |
.Where(o => o.User.Roles.Any(a => a.NormalizedName != "ADMIN")) |
|
87 |
.Select(o => new UserShortDto(o.UserId, o.Name.FullName, o.SeniorUserId, o.User.Roles.First().Id, o.User.Roles.First().Name)).ToListAsync(); |
|
88 |
|
|
89 |
/// <inheritdoc/> |
|
90 |
public async Task<List<UserShortDto>> GetAllTLUsers() |
|
91 |
=> await dbSet.Include(o => o.User).ThenInclude(o => o.Roles) |
|
92 |
.Where(o => o.User.Roles.Any(a => a.NormalizedName == "TL")) |
|
93 |
.Select(o => new UserShortDto(o.UserId, o.Name.FullName, o.SeniorUserId, o.User.Roles.First().Id, o.User.Roles.First().Name)).ToListAsync(); |
|
94 |
|
|
95 |
/// <inheritdoc/> |
|
96 |
public async Task<List<UserShortDto>> GetAllMAUsersFromTL(Guid id) |
|
97 |
=> await dbSet.Include(o => o.User).ThenInclude(o => o.Roles) |
|
98 |
.Where(o => o.SeniorUserId.HasValue && o.SeniorUserId.Value == id && o.User.Roles.Any(a => a.NormalizedName == "MA")) |
|
99 |
.Select(o => new UserShortDto(o.UserId, o.Name.FullName, o.SeniorUserId, o.User.Roles.First().Id, o.User.Roles.First().Name)).ToListAsync(); |
|
80 | 100 |
} |
81 | 101 |
} |
src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/GoalDefinitionDetail.razor | ||
---|---|---|
39 | 39 |
<td>@range.PercentileFinal</td> |
40 | 40 |
<td> |
41 | 41 |
<div class="flex"> |
42 |
<div></div> |
|
42 | 43 |
<div></div> |
43 | 44 |
<div class="button-ui" @onclick='() => SetDetailId(range.Id)'> |
44 | 45 |
<i class="fal fa-eye"></i> |
... | ... | |
165 | 166 |
.flex{ |
166 | 167 |
display: grid; |
167 | 168 |
align-items: center; |
168 |
grid-template-columns: repeat(3, 100px);
|
|
169 |
grid-template-columns: repeat(4, 120px);
|
|
169 | 170 |
justify-content: right; |
170 | 171 |
} |
171 | 172 |
.flex > div:not(:last-child) { |
src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/GoalsManagement.razor | ||
---|---|---|
40 | 40 |
<td> |
41 | 41 |
<div class="flex"> |
42 | 42 |
<AuthorizeView Roles="TL"> |
43 |
<div></div> |
|
43 | 44 |
<div class="button-ui" @onclick='() => _nav.NavigateTo($"/goals/detail/{range.Id}")'> |
44 | 45 |
<i class="fal fa-eye"></i> |
45 | 46 |
@T["Open"] |
... | ... | |
145 | 146 |
.flex{ |
146 | 147 |
display: grid; |
147 | 148 |
align-items: center; |
148 |
grid-template-columns: repeat(3, 100px);
|
|
149 |
grid-template-columns: repeat(4, 120px);
|
|
149 | 150 |
justify-content: right; |
150 | 151 |
} |
151 | 152 |
.flex > div:not(:last-child) { |
Také k dispozici: Unified diff
Updated UserShortDto, methods in DomainUserRepository for fetching users with different roles, UI fixes