< Summary - Syki

Information
Class: Syki.Front.Pages.Adm.AdmEventPage
Assembly: Front
File(s): /home/runner/work/syki/syki/Front/Pages/Adm/AdmEventPage.razor
Tag: 4_16869239191
Line coverage
0%
Covered lines: 0
Uncovered lines: 21
Coverable lines: 21
Total lines: 155
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
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%
GetIdentedData()0%620%
OnInitializedAsync()100%210%
GoToTaskDetails(...)100%210%
GetNotFoundMessage()100%210%

File(s)

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

#LineLine coverage
 1@using Newtonsoft.Json
 2@using Newtonsoft.Json.Linq
 3@using Syki.Front.Features.Adm.GetDomainEvent
 4@using Syki.Front.Features.Adm.GetCommandsSummary
 5
 6@namespace Syki.Front.Pages.Adm
 7
 8@page "/adm/events/{id:guid}"
 9@attribute [Authorize(Roles = "Adm")]
 10
 11<SykiPageTitle Title="Evento" />
 12
 13<MudContainer Class="my-4 px-4">
 14    <MudCard>
 15        <MudCardContent>
 16            <MudGrid>
 17                <MudItem xs="12" sm="8" md="8" lg="8">
 18                    <MudStack Row="true" AlignItems="AlignItems.Center">
 19                        <MudIcon Icon="@Icons.Material.Filled.StickyNote2" Class="mb-1" Size="Size.Large"/>
 020                        <MudText Typo="Typo.h5" Class="mt-1" Style="font-weight: bold">@($"Evento - {_data.Type}")</MudT
 21                    </MudStack>
 22                </MudItem>
 23                <MudItem xs="12" sm="4" md="4" lg="4" Class="d-flex justify-end">
 24                    <MudChip
 25                        T="string"
 26                        Class="px-5 ma-0"
 27                        Size="Size.Large"
 28                        Icon="@_data.Status.GetIcon()"
 29                        Color="@_data.Status.GetColor()"
 30                        IconColor="Color.Default"
 31                    >
 032                        @_data.Status.GetDescription()
 33                    </MudChip>
 34                </MudItem>
 35            </MudGrid>
 36        </MudCardContent>
 37    </MudCard>
 38
 39    <MudContainer Class="px-0 my-4">
 40        <MudGrid Spacing="2">
 41            <MudItem xs="12" sm="4" md="4" lg="4">
 42                <InfoCard Icon="@Icons.Material.Filled.AccessTime" Color="@Colors.BlueGray.Lighten4" Title="Ocorrido" Co
 43            </MudItem>
 44            <MudItem xs="12" sm="4" md="4" lg="4">
 45                <InfoCard Icon="@Icons.Material.Filled.AccessTimeFilled" Color="@GetProcessedAtIconColor()" Title="Proce
 46            </MudItem>
 47            <MudItem xs="12" sm="4" md="4" lg="4">
 48                <InfoCard Icon="@Icons.Material.Filled.Timer" Color="@Colors.Indigo.Darken1" Title="Duração (ms)" Conten
 49            </MudItem>
 50            <MudItem xs="12" sm="12" md="12" lg="12">
 51                <InfoCard Icon="@Icons.Material.Filled.DataObject" Color="@Colors.Blue.Darken1" Title="Dados" Content="@
 52            </MudItem>
 53            <MudItem xs="12" sm="12" md="12" lg="12">
 54                <InfoCard Icon="@Icons.Material.Filled.TripOrigin" Color="@Colors.Orange.Darken1" Title="Origem">
 055                    <MudText>Este evento foi emitido por uma entidade do tipo <b>@_data.EntityName</b> com id <b>@_data.
 56                </InfoCard>
 57            </MudItem>
 058            @if (_data.Error.HasValue())
 59            {
 60                <MudItem xs="12" sm="12" md="12" lg="12">
 61                    <InfoCard Icon="@Icons.Material.Filled.Error" Color="@Colors.Red.Darken1" Title="Erro" Content="@_da
 62                </MudItem>
 63            }
 64        </MudGrid>
 65    </MudContainer>
 66
 67    <MudContainer Class="px-0 my-4">
 68        <style>
 69            .mud-table-toolbar {
 70                height: auto;
 71            }
 72        </style>
 73        <MudTable
 74            Class="mb-4"
 75            Dense="true"
 76            Hover="true"
 77            RowsPerPage="10"
 78            Loading="@_loading"
 79            Items="@_data.Commands"
 80            T="DomainEventCommandOut"
 81            Breakpoint="Breakpoint.Sm"
 82        >
 83            <ToolBarContent>
 84                <MudStack Row="true" AlignItems="AlignItems.Center" Class="mt-2">
 85                    <MudIcon Icon="@Icons.Material.Filled.Task" Class="mb-1" Size="Size.Medium"/>
 86                    <MudText Typo="Typo.h6" Style="font-weight: bold">Comandos</MudText>
 87                </MudStack>
 88            </ToolBarContent>
 89
 90            <HeaderContent>
 91                <MudTh>Tipo</MudTh>
 92                <MudTh>Status</MudTh>
 93                <MudTh>Criação</MudTh>
 94                <MudTh>Processamento</MudTh>
 95                <MudTh>Duração (ms)</MudTh>
 96                <MudTh></MudTh>
 97            </HeaderContent>
 98            <RowTemplate>
 099                <MudTd DataLabel="Tipo">@context.Type</MudTd>
 100                <MudTd DataLabel="Status">
 101                    <CommandStatusChip Status="@context.Status" />
 102                </MudTd>
 0103                <MudTd DataLabel="Criação">@context.CreatedAt.ToMinuteString()</MudTd>
 0104                <MudTd DataLabel="Processamento">@context.ProcessedAt.ToMinuteString()</MudTd>
 0105                <MudTd DataLabel="Duração (ms)">@context.Duration.ToThousandSeparated()</MudTd>
 106
 107                <MudTd>
 0108                    <MudIconButton Size="@Size.Small" Icon="@Icons.Material.Filled.RemoveRedEye" OnClick="@(() => GoToTa
 109                </MudTd>
 110            </RowTemplate>
 111            <NoRecordsContent>
 0112                @(GetNotFoundMessage())
 113            </NoRecordsContent>
 114        </MudTable>
 115    </MudContainer>
 116</MudContainer>
 117
 118@inject NavigationManager Nav
 119@inject GetDomainEventClient GetDomainEventClient
 120
 121@code
 122{
 123  [Parameter]
 0124  public Guid Id { get; set; }
 125
 126    private bool _loading;
 0127    private DomainEventOut _data = new();
 128
 129    private string GetProcessedAtIconColor()
 130    {
 0131        return _data.ProcessedAt == null ? Colors.BlueGray.Lighten4 : Colors.Green.Darken1;
 132    }
 133
 134    private string GetIdentedData()
 135    {
 0136        return _data.Data.HasValue() ? JValue.Parse(_data.Data).ToString(Formatting.Indented) : "";
 137    }
 138
 139    protected override async Task OnInitializedAsync()
 140    {
 0141        _loading = true;
 0142        _data = await GetDomainEventClient.Get(Id);
 0143        _loading = false;
 0144    }
 145
 146    private void GoToTaskDetails(Guid id)
 147    {
 0148        Nav.NavigateTo($"adm/commands/{id}");
 0149    }
 150
 151    private string GetNotFoundMessage()
 152    {
 0153        return "Este evento não possui comandos.";
 154    }
 155}