Files
SystemX.Web/Projects/WebClient/Web.Operation/Components/Pages/CPMeta.razor
2026-02-04 15:50:57 +09:00

102 lines
3.7 KiB
Plaintext

@page "/CpMeta"
@rendermode InteractiveServer
@using Web.Operation.Module;
@using Web.Operation.Services
@using Packet
@inject ConfigService<WebClientConfig> _configService
@inject CPMetaService _cpMetaService
@inject PopupService PopupService
<h3>CPMeta</h3>
<RadzenFieldset Style="margin-bottom: 10px;" Text="Server Info">
<div style="margin-bottom: 10px;">
<RadzenLabel Style="width: 130px;" Text="Server Address"></RadzenLabel>
<RadzenTextBox Style="margin-right: 50px;" @bind-Value="@ServerAddress"></RadzenTextBox>
<RadzenLabel Style="width: 70px;" Text="ShardID"></RadzenLabel>
<RadzenTextBox Style="margin-right: 10px;" @bind-Value="@ShardID"></RadzenTextBox>
</div>
</RadzenFieldset>
<RadzenFieldset Style="margin-bottom: 10px;" Text="View Options">
<div style="margin-bottom: 10px;">
<RadzenLabel Style="margin-right: 5px;" Text="ProductID"></RadzenLabel>
<RadzenTextBox Style="margin-right: 10px;width: 30rem;" @bind-Value="@SearchProductID"></RadzenTextBox>
<RadzenButton Style="margin-right: 30px;" Click="@(() => SearchByProductID())">Search</RadzenButton>
<RadzenLabel Style="margin-right: 5px;" Text="MacAddress"></RadzenLabel>
<RadzenTextBox Style="margin-right: 10px; width: 30rem;" @bind-Value="@SearchProductMacAddress"></RadzenTextBox>
<RadzenButton Style="margin-right: 30px;" Click="@(() => SearchByMacAddress())">Search</RadzenButton>
</div>
</RadzenFieldset>
<br />
<!--count-->
@* <div style="display: flex; justify-content: space-between; margin-bottom: 0.7rem;">
<div style="display: flex; align-items:center;">
<RadzenLabel Style="color:#BA68C8; font-weight: 600; font-size: 1.1rem; margin-right: 1.2rem;" Text=@($"Total Count: {history.Count}")></RadzenLabel>
<RadzenLabel Style="color:#64B5F6; font-weight: 600; font-size: 1.1rem;" Text=@($"Filter Count: {grid.View.Count()}")></RadzenLabel>
</div>
<div>
<RadzenButton Style="background: #7E57C2; margin-right: 0.5rem;" Text="Export CSV(Full Data)" Click="@(() => OnClickExportCSV(false))"></RadzenButton>
<RadzenButton Style="background: #1976D2;" Text="Export CSV(Filter Data)" Click="@(() => OnClickExportCSV(true))"></RadzenButton>
</div>
</div> *@
<OperationGrid TDataModel="tWbms" DataList="@response.Wbms">
</OperationGrid>
@code {
private string ServerAddress = "192.168.0.126:9000";
private string ShardID = "1";
private string SearchProductID = string.Empty;
private string SearchProductMacAddress = string.Empty;
Response_GetWbmsMeta response = new Response_GetWbmsMeta();
protected override async Task OnInitializedAsync()
{
ServerAddress = _cpMetaService.ApiHost;
}
private async Task SearchByProductID()
{
PopupService.OpenIndicator("");
if(Int32.TryParse(ShardID, out var outValue))
{
if (string.IsNullOrEmpty(SearchProductID) == false)
response = await _cpMetaService.GetWbmsMetaByProductID(SearchProductID, ServerAddress, outValue);
}
if(response == null)
{
response = new Response_GetWbmsMeta();
}
await Task.Delay(300);
PopupService.CloseIndicator();
}
private async Task SearchByMacAddress()
{
PopupService.OpenIndicator("");
if (Int32.TryParse(ShardID, out var outValue))
{
if (string.IsNullOrEmpty(SearchProductMacAddress) == false)
response = await _cpMetaService.GetWbmsMetaByMacAddress(SearchProductMacAddress, ServerAddress, outValue);
}
if (response == null)
{
response = new Response_GetWbmsMeta();
}
await Task.Delay(300);
PopupService.CloseIndicator();
}
}