panoptes/src/PanoptesFrontend/Pages/ModDisplay.razor

59 lines
1.6 KiB
Plaintext

@page "/test"
@using System.Net;
@using PanoptesFrontend.Data
@using PanoptesFrontend.Services
@using System.Text.Json;
@using Microsoft.AspNetCore.Components.Web
@inject IHttpService httpService
@inject IJSRuntime JSRuntime
@if (tables != null | graphs != null)
{
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
@foreach (var component in tables)
{
<div class="card mb-3">
<div class="card-body">
<DynamicTable data="@component.Data" TableId="@component.Id"/>
</div>
</div>
}
</div>
<div class="col-md-6">
@foreach (var component in graphs)
{
<div class="card mb-3">
<div class="card-body">
<DynamicChart StatsList="@component.Stats"
SelectedChartType="@component.Graph"
ChartTitle="@component.Title"
ChartId="@component.Id"/>
</div>
</div>
}
</div>
</div>
</div>
}
@code {
private TableComponent[] tables;
private GraphComponent[] graphs;
private string module = "localhost:8080";
protected async override Task OnInitializedAsync()
{
var schema = await httpService.GetAsync<Schema>($"http://localhost:10000/{module}/schema");
tables = schema.tables;
graphs = schema.graphs;
}
}