网站首页 网站源码
website
站点相关全部源代码,隐藏了一些关于服务器的信息
@page "/logs"
@page "/logs/list"
@attribute [Authorize]

<MudText Typo="Typo.h5" Color="Color.Primary" Class="mb-4">查看日志</MudText>
<MudExpansionPanels>
            <MudExpansionPanel Text="查询">
                <MudGrid>
                    <MudItem xs="12" sm="6" md="6">
                        <MudSelect T="string"
                                   Placeholder="select level"
                                   @bind-value="_level"
                                   Clearable="true"
                                   IconSize="Size.Medium"
                                   Class="mt-2"
                                   AdornmentColor="Color.Primary">
                            @foreach (var item in _levelList)
                            {
                                <MudSelectItem Value="@item">@item</MudSelectItem>
                            }
                        </MudSelect>
                    </MudItem>
                    <MudItem xs="12" sm="6" md="6">
                        <MudSelect T="string"
                                   Placeholder="select logger"
                                   @bind-value="_logger"
                                   Clearable="true"
                                   IconSize="Size.Medium"
                                   Class="mt-2"
                                   AdornmentColor="Color.Primary">
                            @foreach (var item in _loggerList)
                            {
                                <MudSelectItem Value="@item">@item</MudSelectItem>
                            }
                        </MudSelect>
                    </MudItem>
                    <MudItem xs="12" sm="6" md="6">
                        <MudTextField T="string"
                                      Placeholder="Message"
                                      @bind-value="_message"
                                      Clearable="true"
                                      AdornmentColor="Color.Primary"
                                      IconSize="Size.Medium"
                                      Class="mt-2">
                        </MudTextField>
                    </MudItem>
                    <MudItem xs="12" sm="6" md="6">
                        <MudButton
                            Size="Size.Large"
                            EndIcon="@Icons.Material.Filled.Search"
                            Color="Color.Primary"
                            OnClick="Search"
                            Variant="Variant.Filled">
                            查询
                        </MudButton>
                    </MudItem>
                </MudGrid>
            </MudExpansionPanel>
        </MudExpansionPanels>
<MudTable Hover="true"
          @ref="_table"
          ServerData="x => LoadDataAsync(x)"
          CurrentPage="@(_pageIndex - 1)"
          RowsPerPage="PageSize">
    <HeaderContent>
        <MudTh>
            Level
        </MudTh>
        <MudTh>
            Logger
        </MudTh>
        <MudTh>
            Message
        </MudTh>
        <MudTh>
            RecordTime
        </MudTh>
        <MudTh>
            Detail
        </MudTh>
    </HeaderContent>
    <RowTemplate>
        <MudTd DataLabel="Level">
            <MudHighlighter Text="@context.Level" HighlightedText="@_level"/>
        </MudTd>

        <MudTd DataLabel="Logger">
            <MudHighlighter Text="@context.Logger" HighlightedText="@_logger"/>
        </MudTd>
        <MudTd DataLabel="Message">
            <MudHighlighter Text="@context.Message" HighlightedText="@_message"/>
        </MudTd>
        <MudTd DataLabel="RecordTime">
            @context.RecordTime.ToString("yyyy-MM-dd HH:mm:ss.fff")
        </MudTd>
        <MudTd DataLabel="Detail">
            <MudButton Variant="Variant.Text" Color="Color.Primary" Disabled="_viewLoading" OnClick="async () => await ViewDetailAsync(context)">
                @if (_viewLoading)
                {
                    <MudProgressCircular Class="ms-n1" Size="Size.Small" Indeterminate="true"/>
                    <MudText Class="ms-2">正在查询</MudText>
                }
                else
                {
                    <MudText>@(context.ShowDetail ? "收起详情" : "查看详情")</MudText>
                }
            </MudButton>
        </MudTd>
    </RowTemplate>
    <ChildRowContent>
        @if (context.ShowDetail)
        {
            <MudTr>
                <td colspan="9">
                    <MudCard>
                        <MudCardHeader>
                            <CardHeaderContent>
                                <MudText Typo="Typo.body1">日志详情</MudText>
                            </CardHeaderContent>
                        </MudCardHeader>
                        <MudCardContent>
                            <pre style="max-height: 500px;width: calc(100vw - 23.5em);" class="line-numbers language-json rainbow-braces match-braces"><code>@context.Detail</code></pre>
                        </MudCardContent>
                    </MudCard>
                </td>
            </MudTr>
        }
    </ChildRowContent>
    <PagerContent>
        <MudTablePager RowsPerPageString="每页数量"
                       HideRowsPerPage="true"
                       PageSizeOptions="new[] {15, 20, 30}"
                       InfoFormat="此页显示{first_item}-{last_item} 共{all_items}条"/>
    </PagerContent>
</MudTable>
loading