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