< Summary

Information
Class: Syki.Front.Pages.Academic.AcademicDisciplinesPage
Assembly: Front
File(s): /home/runner/work/syki/syki/Front/Pages/Academic/AcademicDisciplinesPage.razor
Tag: 22_11348620282
Line coverage
0%
Covered lines: 0
Uncovered lines: 18
Coverable lines: 18
Total lines: 73
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 4
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%
OpenDialog()0%620%
get__quickFilter()100%210%
GetNotFoundMessage()0%620%

File(s)

/home/runner/work/syki/syki/Front/Pages/Academic/AcademicDisciplinesPage.razor

#LineLine coverage
 1@using Syki.Front.Features.Academic.GetDisciplines
 2@using Syki.Front.Features.Academic.CreateDiscipline
 3
 4@namespace Syki.Front.Pages.Academic
 5
 6@page "/academic/disciplines"
 7@attribute [Authorize(Roles = "Academic")]
 8
 9<SykiPageTitle Title="Disciplinas" />
 10
 11<MudContainer Class="my-4 px-4">
 12    <SykiPageHeader Icon="@Icons.Material.Filled.Apps" Title="Disciplinas" ButtonText="Nova Disciplina" OnClick="@OpenDi
 13    <SykiPageAlert Text="Uma mesma disciplina pode compor a grade de cursos diferentes." />
 14    <MudContainer Class="px-0 mb-4">
 15        <MudDataGrid Class="pa-4" Items="@_disciplines" QuickFilter="@_quickFilter" Hover="true" Loading="@_loading" Den
 16            <ToolBarContent>
 17                <SykiDataGridSearchTextField @bind-Value="@_searchString" Placeholder="Busque por nome ou código" />
 18            </ToolBarContent>
 19            <Columns>
 20                <PropertyColumn Property="x => x.Name" Title="Nome" />
 21                <PropertyColumn Property="x => x.Code" Title="Código" />
 22            </Columns>
 23            <NoRecordsContent>
 24                @(GetNotFoundMessage())
 25            </NoRecordsContent>
 26            <PagerContent>
 27                <SykiDataGridPager T="DisciplineOut"/>
 28            </PagerContent>
 29        </MudDataGrid>
 30    </MudContainer>
 31</MudContainer>
 32
 33@inject GetDisciplinesClient Client
 34@inject IDialogService DialogService
 35@inject IBrowserViewportService BrowserViewportService
 36
 37@code
 38{
 39    private bool _loading;
 40    private string _searchString;
 041    private List<DisciplineOut> _disciplines = [];
 42
 43    protected override async Task OnInitializedAsync()
 44    {
 045        _loading = true;
 046        _disciplines = await Client.Get();
 047        _loading = false;
 048    }
 49
 50    private async Task OpenDialog()
 51    {
 052        var breakpoint = await BrowserViewportService.GetCurrentBreakpointAsync();
 053        var options = new DialogOptions {
 054            MaxWidth = MaxWidth.Small,
 055            FullWidth = true,
 056            FullScreen = breakpoint == Breakpoint.Xs,
 057        };
 058        var dialog = await DialogService.ShowAsync<CreateDisciplineDialog>("", options);
 59
 060        var result = await dialog.Result;
 61
 062        if (result!.Canceled) return;
 63
 064        await OnInitializedAsync();
 065    }
 66
 067    private Func<DisciplineOut, bool> _quickFilter => x => _searchString.IsIn(x.Name, x.Code);
 68
 69    private string GetNotFoundMessage()
 70    {
 071        return (_searchString.IsEmpty()) ? "Não existem disciplinas cadastradas ainda." : "Nenhuma disciplina encontrada
 72    }
 73}