@namespace ThingsGateway.Gateway.Razor
@using ThingsGateway.Admin.Application
@using ThingsGateway.Admin.Razor
@using ThingsGateway.Gateway.Application
@{
    #if !Management
}
@page "/gateway/backendlog"
@attribute [Authorize]
@attribute [RolePermission]

@{
    #endif
}
@inherits ComponentDefault

<Chart @ref=LineChart OnInitAsync="OnInit" Height="var(--line-chart-height)" Width="100%" />
    <div class="line-chart-table-height">
    <AdminTable TItem="BackendLog" AutoGenerateColumns="true" ShowDefaultButtons=false 
                AllowResizing="true" IsFixedHeader=true IsMultipleSelect=false
                ShowExtendEditButton=false ShowExtendDeleteButton=false ShowExtendButtons=false
                ShowSearchButton="false"
                ShowExportButton="true"  
                OnQueryAsync="OnQueryAsync" IsPagination=true CustomerSearchModel="@CustomerSearchModel">
        <CustomerSearchTemplate>
            @if (context is BackendLogPageInput model)
            {
                @Render(model)
            }
        </CustomerSearchTemplate>
        <ExportButtonDropdownTemplate Context="ExportContext">
            <div class="dropdown-item" @onclick="() => ExcelExportAsync(ExportContext)">
                <i class="fas fa-file-export"></i>
                <span>@RazorLocalizer["TablesExportButtonExcelText"]</span>
            </div>
        </ExportButtonDropdownTemplate>
    </AdminTable>
</div>
@code {
    RenderFragment Render(BackendLogPageInput model) =>
    @<div class="row form-inline g-2">
        <div class="col-12 ">
            <BootstrapInput @bind-Value="model.LogSource" ShowLabel="true" />
        </div>
        <div class="col-12 ">
            <DateTimeRange @bind-Value="model.SearchDate" ShowLabel="true" />
        </div>
        <div class="col-12 ">
            <Select @bind-Value="model.LogLevel" ShowLabel="true" PlaceHolder="All"  />
        </div>
    </div>;

}
