< Summary

Information
Class: Syki.Front.Pages.Adm.AdmUsersPage
Assembly: Front
File(s): /home/runner/work/syki/syki/Front/Pages/Adm/AdmUsersPage.razor
Tag: 22_11348620282
Line coverage
0%
Covered lines: 0
Uncovered lines: 7
Coverable lines: 7
Total lines: 52
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%210%
OnInitializedAsync()100%210%
get__quickFilter()100%210%
GetNotFoundMessage()0%620%

File(s)

/home/runner/work/syki/syki/Front/Pages/Adm/AdmUsersPage.razor

#LineLine coverage
 1@namespace Syki.Front.Pages.Adm
 2
 3@page "/adm/users"
 4@attribute [Authorize(Roles = "Adm")]
 5
 6<SykiPageTitle Title="Usuários" />
 7
 8<MudContainer Class="my-4 px-4">
 9    <SykiPageHeader Icon="@Icons.Material.Filled.People" Title="Usuários" />
 10    <MudContainer Class="px-0 my-4">
 11        <MudDataGrid Class="pa-4" Items="@_users" QuickFilter="@_quickFilter" Hover="true" Loading="@_loading" Dense="tr
 12            <ToolBarContent>
 13                <SykiDataGridSearchTextField @bind-Value="@_searchString" Placeholder="Busque por qualquer atributo" />
 14            </ToolBarContent>
 15            <Columns>
 16                <PropertyColumn Property="x => x.Name" Title="Nome" />
 17                <PropertyColumn Property="x => x.Email" Title="Email" />
 18                <PropertyColumn Property="x => x.Institution" Title="Instituição" />
 19                <PropertyColumn Property="x => x.Role" Title="Role" />
 20            </Columns>
 21            <NoRecordsContent>
 22                @(GetNotFoundMessage())
 23            </NoRecordsContent>
 24            <PagerContent>
 25                <SykiDataGridPager T="UserOut" />
 26            </PagerContent>
 27        </MudDataGrid>
 28    </MudContainer>
 29</MudContainer>
 30
 31@inject GetUsersClient GetUsersClient
 32
 33@code
 34{
 35    private bool _loading;
 36    private string _searchString;
 037    private List<UserOut> _users = [];
 38
 39    protected override async Task OnInitializedAsync()
 40    {
 041        _loading = true;
 042        _users = await GetUsersClient.Get();
 043        _loading = false;
 044    }
 45
 046    private Func<UserOut, bool> _quickFilter => x => _searchString.IsIn(x.Name, x.Email, x.Institution, x.Role);
 47
 48    private string GetNotFoundMessage()
 49    {
 050        return (_searchString.IsEmpty()) ? "Não existem usuários cadastrados ainda." : "Nenhum usuário encontrado.";
 51    }
 52}