< Summary - Syki

Information
Class: Syki.Front.Pages.Academic.AcademicWebhookCallPage
Assembly: Front
File(s): /home/runner/work/syki/syki/Front/Pages/Academic/AcademicWebhookCallPage.razor
Tag: 4_16869239191
Line coverage
0%
Covered lines: 0
Uncovered lines: 19
Coverable lines: 19
Total lines: 156
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
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%
GetIdentedData()100%210%
OnParametersSetAsync()100%210%
Reprocess()100%210%

File(s)

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

#LineLine coverage
 1@using Newtonsoft.Json
 2@using Newtonsoft.Json.Linq
 3@using Syki.Front.Features.Academic.GetWebhookCall
 4
 5@namespace Syki.Front.Pages.Academic
 6
 7@page "/academic/webhooks/calls/{id:guid}"
 8@attribute [Authorize(Roles = "Academic")]
 9
 10<SykiPageTitle Title="Chamada de Webhook" />
 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.CallMade" Class="mb-1" Size="Size.Large"/>
 19                        <MudText Typo="Typo.h5" Class="mt-1" Style="font-weight: bold">Chamada de Webhook</MudText>
 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="12" md="12" lg="12">
 41                <InfoCard Icon="@Icons.Material.Filled.TripOrigin" Color="@Colors.Orange.Darken1" Title="Webhook">
 042                    <MudLink Href="@($"/academic/webhooks/{_data.WebhookId}")" Color="Color.Primary">Esta chamada perten
 43                </InfoCard>
 44            </MudItem>
 45
 46            <MudItem xs="12" sm="4" md="4" lg="4">
 47                <InfoCard Icon="@Icons.Material.Filled.AccessTime" Color="@Colors.BlueGray.Lighten4" Title="Criação" Con
 48            </MudItem>
 49            <MudItem xs="12" sm="4" md="4" lg="4">
 50                <InfoCard Icon="@Icons.Material.Filled.StickyNote2" Color="@Colors.Green.Darken1" Title="Evento" Content
 51            </MudItem>
 52            <MudItem xs="12" sm="4" md="4" lg="4">
 53                <InfoCard Icon="@Icons.Material.Filled.CallMissedOutgoing" Color="@Colors.BlueGray.Lighten4" Title="Tent
 54            </MudItem>
 55
 56            <MudItem xs="12" sm="12" md="12" lg="12">
 57                <InfoCard Icon="@Icons.Material.Filled.DataObject" Color="@Colors.Blue.Darken1" Title="Dados" Content="@
 58            </MudItem>
 59        </MudGrid>
 60    </MudContainer>
 61
 62    <style>
 63        .mud-table-toolbar {
 64            height: auto;
 65        }
 66    </style>
 67    <MudContainer Class="px-0 my-4">
 68        <MudTable
 69            Class="mb-4"
 70            Dense="true"
 71            Hover="true"
 72            RowsPerPage="10"
 73            Loading="@_loading"
 74            Items="@_data.Attempts"
 75            Breakpoint="Breakpoint.Sm"
 76            T="GetWebhookCallAttemptOut"
 77        >
 78            <ToolBarContent>
 79                <MudStack Row="true" AlignItems="AlignItems.Center" Class="my-4 ml-1 mr-2" Style="width: 100%">
 80                    <MudItem xs="12" sm="8" md="8" lg="8">
 81                        <MudStack Row="true" AlignItems="AlignItems.Center">
 82                            <MudIcon Icon="@Icons.Material.Filled.CallMissedOutgoing" Class="mb-1" Size="Size.Medium"/>
 83                            <MudText Typo="Typo.h6" Style="font-weight: bold">Tentativas</MudText>
 84                        </MudStack>
 85                    </MudItem>
 86                    <MudItem xs="12" sm="4" md="4" lg="4" Class="d-flex justify-end">
 87                        <MudButton
 88                            OnClick="@Reprocess"
 89                            Size="Size.Medium"
 90                            Color="Color.Primary"
 91                            IconSize="Size.Medium"
 92                            Variant="Variant.Filled"
 93                            Disabled="@_disableButton"
 94                            StartIcon="@Icons.Material.Outlined.Autorenew"
 95                        >
 96                            Reprocessar
 97                        </MudButton>
 98                    </MudItem>
 99                </MudStack>
 100            </ToolBarContent>
 101
 102            <HeaderContent>
 103                <MudTh>Status</MudTh>
 104                <MudTh>Criação</MudTh>
 105                <MudTh>Status Code</MudTh>
 106                <MudTh>Response</MudTh>
 107            </HeaderContent>
 108            <RowTemplate>
 109                <MudTd DataLabel="Status">
 110                    <WebhookCallAttemptStatusChip Status="@context.Status" />
 111                </MudTd>
 0112                <MudTd DataLabel="Criação">@context.CreatedAt.ToMinuteString()</MudTd>
 0113                <MudTd DataLabel="Status Code">@context.StatusCode</MudTd>
 0114                <MudTd DataLabel="Response">@context.Response</MudTd>
 115            </RowTemplate>
 116            <NoRecordsContent>
 117                Esta chamada não possui tentativas.
 118            </NoRecordsContent>
 119        </MudTable>
 120    </MudContainer>
 121</MudContainer>
 122
 123@inject GetWebhookCallClient GetWebhookCallClient
 124@inject ReprocessWebhookCallClient ReprocessWebhookCallClient
 125
 126@code
 127{
 128  [Parameter]
 0129  public Guid Id { get; set; }
 130
 131    private bool _loading;
 132    private bool _disableButton;
 0133    private GetWebhookCallFullOut _data = new();
 134
 135    private string GetIdentedData()
 136    {
 0137        return _data.Payload.ParseJsonString();
 138    }
 139
 140    protected override async Task OnParametersSetAsync()
 141    {
 0142        _loading = true;
 0143        _data = await GetWebhookCallClient.Get(Id);
 0144        _loading = false;
 0145    }
 146
 147    private async Task Reprocess()
 148    {
 0149        _disableButton = true;
 0150        await ReprocessWebhookCallClient.Reprocess(Id);
 0151        _loading = true;
 0152        _data = await GetWebhookCallClient.Get(Id);
 0153        _loading = false;
 0154        _disableButton = false;
 0155    }
 156}