Componente detailOverview
This commit is contained in:
+1
-1
@@ -15,7 +15,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.MONO.DECODER", "MP.MONO.
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.MONO.ANALYZER", "MP.MONO.ANALYZER\MP.MONO.ANALYZER.csproj", "{4C9BEAED-1A33-41A7-B9D6-7C173A43FDB8}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MP.MONO.ADAPTER", "MP.MONO.ADAPTER\MP.MONO.ADAPTER.csproj", "{873736BA-CDB6-4CE5-A340-6D904C11C07C}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.MONO.ADAPTER", "MP.MONO.ADAPTER\MP.MONO.ADAPTER.csproj", "{873736BA-CDB6-4CE5-A340-6D904C11C07C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
@if (ListRecords != null && ListRecords.Count > 0)
|
||||
{
|
||||
<ul class="list-group">
|
||||
@* <ul class="list-group">
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<li class="list-group-item list-group-item-action">
|
||||
@@ -18,7 +18,8 @@
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</ul>*@
|
||||
<DetailOverview></DetailOverview>
|
||||
|
||||
}
|
||||
else
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
@using MP.MONO.UI.Components
|
||||
@using MP.MONO.Core.DTO
|
||||
@using MP.MONO.UI.Data
|
||||
|
||||
@inject CurrentDataService MMDataService
|
||||
|
||||
@if (ListRecords != null && ListRecords.Count > 0)
|
||||
{
|
||||
<ul class="list-group">
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<li class="list-group-item list-group-item-action">
|
||||
<div class="col-4">
|
||||
@if (!string.IsNullOrEmpty(item.CssIcon))
|
||||
{
|
||||
<div class="d-flex flex-column">
|
||||
<div class="small"><sup>@item.Title</sup></div>
|
||||
<div><i class="@item.CssIcon"></i></div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div>@item.Title</div>
|
||||
}
|
||||
</div>
|
||||
<div class="col-8 float-end">
|
||||
<div class="d-flex flex-column">
|
||||
<div class="d-flex flex-row-reverse"><h5 class="float-end"><b>@item.Value</b></h5></div>
|
||||
@if (item.ShowBar)
|
||||
{
|
||||
<div class="w-100">
|
||||
<div class="progress" style="height: 0.3rem;">
|
||||
<div class="progress-bar" role="progressbar" style="@percProgress(item.ValueNum, item.MinVal, item.MaxVal)" aria-valuenow="@item.ValueNum" aria-valuemin="@item.MinVal" aria-valuemax="@item.MaxVal"></div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.AspNetCore.Components.Routing;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.Web.Virtualization;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.MONO.UI;
|
||||
using MP.MONO.UI.Shared;
|
||||
using MP.MONO.UI.Components;
|
||||
using MP.MONO.Core.DTO;
|
||||
using MP.MONO.UI.Data;
|
||||
using Newtonsoft.Json;
|
||||
using MP.MONO.Data;
|
||||
|
||||
namespace MP.MONO.UI.Components
|
||||
{
|
||||
public partial class DetailOverview
|
||||
{
|
||||
private List<DisplayDataDTO>? ListRecords { get; set; } = null;
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
MMDataService.toolsPipe.EA_NewMessage += ToolsPipe_EA_NewMessage;
|
||||
}
|
||||
|
||||
private void ToolsPipe_EA_NewMessage(object? sender, EventArgs e)
|
||||
{
|
||||
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
||||
if (!string.IsNullOrEmpty(currArgs.newMessage))
|
||||
{
|
||||
try
|
||||
{
|
||||
ListRecords = JsonConvert.DeserializeObject<List<DisplayDataDTO>>(currArgs.newMessage);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
InvokeAsync(() =>
|
||||
{
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
protected string percProgress(double num, double minVal, double maxVal)
|
||||
{
|
||||
string answ = "width: 0%;";
|
||||
double den = (maxVal - minVal) != 0 ? (maxVal - minVal) : 1;
|
||||
double ratio = ((double)num) / den;
|
||||
answ = $"width: {ratio:P0};";
|
||||
return answ;
|
||||
}
|
||||
protected async Task ReloadData()
|
||||
{
|
||||
ListRecords = await MMDataService.getTools();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,20 +6,40 @@
|
||||
|
||||
@if (ListRecords != null && ListRecords.Count > 0)
|
||||
{
|
||||
<ul class="list-group">
|
||||
@*<ul class="list-group">
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<li class="list-group-item list-group-item-action">
|
||||
<div class="d-flex w-100 justify-content-between" title="order">
|
||||
<div>@item.Title</div>
|
||||
<div>
|
||||
<h5> <b>@item.Value</b></h5>
|
||||
<div class="col-4">
|
||||
@if (!string.IsNullOrEmpty(item.CssIcon))
|
||||
{
|
||||
<div class="d-flex flex-column">
|
||||
<div class="small"><sup>@item.Title</sup></div>
|
||||
<div><i class="@item.CssIcon"></i></div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div>@item.Title</div>
|
||||
}
|
||||
</div>
|
||||
<div class="col-8 float-end">
|
||||
<div class="d-flex flex-column">
|
||||
<div class="d-flex flex-row-reverse"><h5 class="float-end"><b>@item.Value</b></h5></div>
|
||||
@if (item.ShowBar)
|
||||
{
|
||||
<div class="w-100">
|
||||
<div class="progress" style="height: 0.3rem;">
|
||||
<div class="progress-bar" role="progressbar" style="@percProgress(item.ValueNum, item.MinVal, item.MaxVal)" aria-valuenow="@item.ValueNum" aria-valuemin="@item.MinVal" aria-valuemax="@item.MaxVal"></div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
|
||||
</ul>*@
|
||||
<DetailOverview></DetailOverview>
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -48,6 +48,14 @@ namespace MP.MONO.UI.Components
|
||||
});
|
||||
}
|
||||
|
||||
protected string percProgress(double num, double minVal, double maxVal)
|
||||
{
|
||||
string answ = "width: 0%;";
|
||||
double den = (maxVal - minVal) != 0 ? (maxVal - minVal) : 1;
|
||||
double ratio = ((double)num) / den;
|
||||
answ = $"width: {ratio:P0};";
|
||||
return answ;
|
||||
}
|
||||
protected async Task ReloadData()
|
||||
{
|
||||
ListRecords = await MMDataService.getTools();
|
||||
|
||||
Reference in New Issue
Block a user