Enhance GridPlanner and GenerateGridDialog for improved slot management and user experience
ci / build-backend (push) Successful in 2m30s
ci / build-frontend (push) Successful in 1m7s
ci / tests (push) Successful in 2m58s
ci / sonar (push) Successful in 6m28s

Refactored the GridPlanner class to optimize slot management during grid generation, ensuring more efficient handling of slots. Updated the GenerateGridDialog component to improve its layout and usability, enhancing the overall user experience when interacting with slot lists. These changes contribute to better functionality and accessibility in grid management.
This commit is contained in:
Leonid Pershin
2026-07-27 10:35:52 +03:00
parent b8d6b6aad2
commit 062f4aa200
8 changed files with 1197 additions and 0 deletions
@@ -0,0 +1,60 @@
using NSubstitute;
using TeleWave.Application.Admin.Users.ListUsers;
using TeleWave.Application.Common.Interfaces;
using TeleWave.Application.Common.Models;
using Xunit;
namespace TeleWave.Application.Tests.Admin;
/// <summary>
/// Список пользователей: хендлер только перекладывает параметры запроса в порт — Identity живёт
/// вне <c>IAppDbContext</c>. Проверяется именно перекладка: потерянный фильтр здесь означал бы
/// заблокированных вперемешку с активными.
/// </summary>
public class ListUsersTests
{
[Fact]
public async Task PassesEveryFilterToIdentityService()
{
var identity = Substitute.For<IIdentityService>();
var roleId = Guid.NewGuid();
var page = new PagedList<UserSummaryDto>([], 0, 2, 25);
identity
.ListUsersAsync(Arg.Any<UserListFilter>(), Arg.Any<CancellationToken>())
.Returns(page);
var result = await new ListUsersQueryHandler(identity).Handle(
new ListUsersQuery(2, 25, "иван", roleId, IsBlocked: true, Sort: "created", Desc: true),
CancellationToken.None
);
Assert.Same(page, result);
await identity
.Received(1)
.ListUsersAsync(
new UserListFilter(2, 25, "иван", roleId, true, "created", true),
Arg.Any<CancellationToken>()
);
}
[Fact]
public async Task DefaultsSortAndDirection_WhenNotAsked()
{
var identity = Substitute.For<IIdentityService>();
identity
.ListUsersAsync(Arg.Any<UserListFilter>(), Arg.Any<CancellationToken>())
.Returns(new PagedList<UserSummaryDto>([], 0, 1, 20));
await new ListUsersQueryHandler(identity).Handle(
new ListUsersQuery(1, 20, null, null, null),
CancellationToken.None
);
await identity
.Received(1)
.ListUsersAsync(
Arg.Is<UserListFilter>(f => f.Sort == null && !f.Desc && f.Search == null),
Arg.Any<CancellationToken>()
);
}
}