< Summary - Syki

Information
Class: Syki.Front.Pages.Adm.AdmBatchPage
Assembly: Front
File(s): /home/runner/work/syki/syki/Front/Pages/Adm/AdmBatchPage.razor
Tag: 4_16869239191
Line coverage
0%
Covered lines: 0
Uncovered lines: 29
Coverable lines: 29
Total lines: 173
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 10
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Id()100%210%
.ctor()100%210%
GetProcessedAtIconColor()0%620%
OnInitializedAsync()100%210%
GetSubcommandsNotFoundMessage()100%210%
GoToDetails(...)100%210%
GoToEvent(...)100%210%
GoToCommand(...)100%210%

File(s)

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

#LineLine coverage
 1@using Newtonsoft.Json
 2@using Newtonsoft.Json.Linq
 3@using Syki.Front.Features.Adm.GetCommandsSummary
 4
 5@namespace Syki.Front.Pages.Adm
 6
 7@page "/adm/batches/{id:guid}"
 8@attribute [Authorize(Roles = "Adm")]
 9
 10<SykiPageTitle Title="Lotes" />
 11
 12<MudContainer Class="my-4 px-4">
 13    <MudCard>
 14        <MudCardContent>
 15            <MudGrid>
 16                <MudItem xs="12" sm="8" md="8" lg="8">
 17                    <MudStack Row="true" AlignItems="AlignItems.Center">
 18                        <MudIcon Icon="@Icons.Material.Filled.BorderOuter" Class="mb-1" Size="Size.Large"/>
 019                        <MudText Typo="Typo.h5" Class="mt-1" Style="font-weight: bold">@($"Lote - {_data.Type.GetDescrip
 20                    </MudStack>
 21                </MudItem>
 22                <MudItem xs="12" sm="4" md="4" lg="4" Class="d-flex justify-end">
 23                    <MudChip
 24                        T="string"
 25                        Class="px-5 ma-0"
 26                        Size="Size.Large"
 27                        Icon="@_data.Status.GetIcon()"
 28                        Color="@_data.Status.GetColor()"
 29                        IconColor="Color.Default"
 30                    >
 031                        @_data.Status.GetDescription()
 32                    </MudChip>
 33                </MudItem>
 34            </MudGrid>
 35        </MudCardContent>
 36    </MudCard>
 37
 38    <MudContainer Class="px-0 my-4">
 39        <MudGrid Spacing="2">
 40            <MudItem xs="12" sm="4" md="4" lg="4">
 41                <InfoCard Icon="@Icons.Material.Filled.AccessTime" Color="@Colors.BlueGray.Lighten4" Title="Criação" Con
 42            </MudItem>
 43            <MudItem xs="12" sm="4" md="4" lg="4">
 44                <InfoCard Icon="@Icons.Material.Filled.AccessTimeFilled" Color="@GetProcessedAtIconColor()" Title="Proce
 45            </MudItem>
 46            <MudItem xs="12" sm="4" md="4" lg="4">
 47                <InfoCard Icon="@Icons.Material.Filled.Timer" Color="@Colors.Indigo.Darken1" Title="Comandos" Content="@
 48            </MudItem>
 049            @if (_data.EventId != null)
 50            {
 51                <MudItem xs="12" sm="12" md="12" lg="12">
 52                    <InfoCard Icon="@Icons.Material.Filled.TripOrigin" Color="@Colors.Orange.Darken1" Title="Origem">
 053                        <MudLink OnClick="@(() => GoToEvent(_data.EventId.Value))" Color="Color.Primary">Este lote foi o
 54                    </InfoCard>
 55                </MudItem>
 56            }
 057            @if (_data.SourceCommandId != null)
 58            {
 59                <MudItem xs="12" sm="12" md="12" lg="12">
 60                    <InfoCard Icon="@Icons.Material.Filled.TripOrigin" Color="@Colors.Orange.Darken1" Title="Origem">
 061                        <MudLink OnClick="@(() => GoToCommand(_data.SourceCommandId.Value))" Color="Color.Primary">Este 
 62                    </InfoCard>
 63                </MudItem>
 64            }
 065            @if (_data.NextCommandId != null)
 66            {
 67                <MudItem xs="12" sm="12" md="12" lg="12">
 68                    <InfoCard Icon="@Icons.Material.Filled.NextPlan" Color="@Colors.Teal.Darken1" Title="Próximo comando
 069                        <MudLink OnClick="@(() => GoToDetails(_data.NextCommandId.Value))" Color="Color.Primary">Este lo
 70                    </InfoCard>
 71                </MudItem>
 72            }
 73        </MudGrid>
 74    </MudContainer>
 75
 076    @if (_data.Commands.Count > 0)
 77    {
 78        <style>
 79            .mud-table-toolbar {
 80                height: auto;
 81            }
 82        </style>
 83        <MudContainer Class="px-0 my-4">
 84            <MudTable
 85                Class="mb-4"
 86                Dense="true"
 87                Hover="true"
 88                T="CommandOut"
 89                RowsPerPage="10"
 90                Loading="@_loading"
 91                Items="@_data.Commands"
 92                Breakpoint="Breakpoint.Sm"
 93            >
 94                <ToolBarContent>
 95                    <MudStack Row="true" AlignItems="AlignItems.Center" Class="mt-2">
 96                        <MudIcon Icon="@Icons.Material.Filled.SubdirectoryArrowRight" Class="mb-1" Size="Size.Medium"/>
 97                        <MudText Typo="Typo.h6" Style="font-weight: bold">Comandos</MudText>
 98                    </MudStack>
 99                </ToolBarContent>
 100
 101                <HeaderContent>
 102                    <MudTh>Tipo</MudTh>
 103                    <MudTh>Criação</MudTh>
 104                    <MudTh>Processamento</MudTh>
 105                    <MudTh>Duração (ms)</MudTh>
 106                    <MudTh></MudTh>
 107                </HeaderContent>
 108                <RowTemplate>
 109                    <MudTd DataLabel="Tipo">
 110                        <MudStack Row="true" AlignItems="AlignItems.Center" Spacing="1">
 111                            <MudIcon Icon="@context.Status.GetIcon()" Color="@context.Status.GetColor()" Size="Size.Smal
 0112                            <MudText Typo="Typo.body2">@context.Description</MudText>
 113                        </MudStack>
 114                    </MudTd>
 0115                    <MudTd DataLabel="Criação">@context.CreatedAt.ToMinuteString()</MudTd>
 0116                    <MudTd DataLabel="Processamento">@context.ProcessedAt.ToMinuteString()</MudTd>
 0117                    <MudTd DataLabel="Duração (ms)">@context.Duration.ToThousandSeparated()</MudTd>
 118                    <MudTd>
 0119                        <MudIconButton Size="@Size.Small" Icon="@Icons.Material.Filled.RemoveRedEye" OnClick="@(() => Go
 120                    </MudTd>
 121                </RowTemplate>
 122                <NoRecordsContent>
 0123                    @(GetSubcommandsNotFoundMessage())
 124                </NoRecordsContent>
 125            </MudTable>
 126        </MudContainer>
 127    }
 128</MudContainer>
 129
 130@inject NavigationManager Nav
 131@inject GetBatchClient GetBatchClient
 132@inject ReprocessCommandClient ReprocessCommandClient
 133
 134@code
 135{
 136  [Parameter]
 0137  public Guid Id { get; set; }
 138
 139    private bool _loading;
 0140    private BatchOut _data = new();
 141
 142    private string GetProcessedAtIconColor()
 143    {
 0144        return _data.ProcessedAt == null ? Colors.BlueGray.Lighten4 : Colors.Green.Darken1;
 145    }
 146
 147    protected override async Task OnInitializedAsync()
 148    {
 0149        _loading = true;
 0150        _data = await GetBatchClient.Get(Id);
 0151        _loading = false;
 0152    }
 153
 154    private string GetSubcommandsNotFoundMessage()
 155    {
 0156        return "Este lote não possui comandos.";
 157    }
 158
 159    private void GoToDetails(Guid id)
 160    {
 0161        Nav.NavigateTo($"adm/commands/{id}");
 0162    }
 163
 164    private void GoToEvent(Guid id)
 165    {
 0166        Nav.NavigateTo($"adm/events/{id}");
 0167    }
 168
 169    private void GoToCommand(Guid id)
 170    {
 0171        Nav.NavigateTo($"adm/commands/{id}");
 0172    }
 173}