dynamic routing for modules
This commit is contained in:
parent
5308961541
commit
5817300283
@ -39,6 +39,8 @@
|
||||
public string SelectedChartType {get; set;}
|
||||
[Parameter]
|
||||
public int ChartId {get; set;}
|
||||
[Parameter]
|
||||
public string module {get; set;}
|
||||
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
@ -53,8 +55,7 @@
|
||||
|
||||
private async Task UpdateChartSeries()
|
||||
{
|
||||
string module = "localhost:8080";
|
||||
var response = await httpService.GetAsync<GraphComponent>($"http://localhost:10000/{module}/{ChartId}");
|
||||
var response = await httpService.GetAsync<GraphComponent>($"http://localhost:10000/component/{module}/{ChartId}");
|
||||
StatsList = response.Stats;
|
||||
await chart.UpdateSeriesAsync(true);
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
|
||||
@ -25,6 +25,8 @@
|
||||
public List<Dictionary<string, object>> data { get; set; }
|
||||
[Parameter]
|
||||
public int TableId {get; set;}
|
||||
[Parameter]
|
||||
public string module {get; set;}
|
||||
|
||||
public IDictionary<string, Type> columns { get; set; }
|
||||
public string GetColumnPropertyExpression(string name, Type type)
|
||||
@ -63,9 +65,7 @@
|
||||
|
||||
private async Task Update()
|
||||
{
|
||||
string module = "localhost:8080";
|
||||
|
||||
var response = await httpService.GetAsync<TableComponent>($"http://localhost:10000/{module}/{TableId}");
|
||||
var response = await httpService.GetAsync<TableComponent>($"http://localhost:10000/component/{module}/{TableId}");
|
||||
|
||||
if (response.Data != null)
|
||||
{
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
@page "/test"
|
||||
@page "/module/{moduleId}"
|
||||
|
||||
@using System.Net;
|
||||
@using PanoptesFrontend.Data
|
||||
@ -17,7 +17,7 @@
|
||||
{
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
<DynamicTable data="@component.Data" TableId="@component.Id"/>
|
||||
<DynamicTable data="@component.Data" TableId="@component.Id" module="@moduleId"/>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@ -30,7 +30,8 @@
|
||||
<DynamicChart StatsList="@component.Stats"
|
||||
SelectedChartType="@component.Graph"
|
||||
ChartTitle="@component.Title"
|
||||
ChartId="@component.Id"/>
|
||||
ChartId="@component.Id"
|
||||
module="@moduleId"/>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@ -44,12 +45,12 @@
|
||||
@code {
|
||||
private TableComponent[] tables;
|
||||
private GraphComponent[] graphs;
|
||||
|
||||
private string module = "localhost:8080";
|
||||
[Parameter]
|
||||
public string moduleId { get; set; }
|
||||
|
||||
protected async override Task OnInitializedAsync()
|
||||
{
|
||||
var schema = await httpService.GetAsync<Schema>($"http://localhost:10000/{module}/schema");
|
||||
var schema = await httpService.GetAsync<Schema>("http://localhost:10000/" + @moduleId + "/schema");
|
||||
tables = schema.tables;
|
||||
graphs = schema.graphs;
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
{
|
||||
@foreach (var module in response){
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href=@module.Name Match="NavLinkMatch.All">
|
||||
<NavLink class="nav-link" href=/module/@module.Name Match="NavLinkMatch.All">
|
||||
<span class="oi oi-home" aria-hidden="true"></span> @module.Name
|
||||
</NavLink>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user