schema generation from request - not working
This commit is contained in:
parent
0036cbbcea
commit
9d20919f2c
12
src/PanoptesFrontend/Data/Component.cs
Normal file
12
src/PanoptesFrontend/Data/Component.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
public class Component {
|
||||||
|
public int Type {get; set;}
|
||||||
|
public string Text {get; set;}
|
||||||
|
public List<Stats> Chart {get; set;}
|
||||||
|
|
||||||
|
|
||||||
|
public Component(int type, string text="", List<Stats> chart = null){
|
||||||
|
Type = type;
|
||||||
|
Text = text;
|
||||||
|
Chart = chart;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +0,0 @@
|
|||||||
public class Person
|
|
||||||
{
|
|
||||||
public string Name { get; set; }
|
|
||||||
public int Age { get; set; }
|
|
||||||
public string Email { get; set; }
|
|
||||||
}
|
|
||||||
4
src/PanoptesFrontend/Data/Stats.cs
Normal file
4
src/PanoptesFrontend/Data/Stats.cs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
public class Stats {
|
||||||
|
String Label {get; set;}
|
||||||
|
Int64 Value {get; set;}
|
||||||
|
}
|
||||||
@ -1,14 +0,0 @@
|
|||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
@Data.Name
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<p>Age: @Data.Age</p>
|
|
||||||
<p>Email: @Data.Email</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@code {
|
|
||||||
[Parameter]
|
|
||||||
public Person Data { get; set; }
|
|
||||||
}
|
|
||||||
10
src/PanoptesFrontend/Pages/TestCard.razor
Normal file
10
src/PanoptesFrontend/Pages/TestCard.razor
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<p>@Data.Text</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter]
|
||||||
|
public Component Data { get; set; }
|
||||||
|
}
|
||||||
@ -1,25 +1,29 @@
|
|||||||
@page "/people"
|
@page "/test"
|
||||||
|
|
||||||
@using System.Net.Http.Json
|
@using System.Net.Http.Json
|
||||||
@using System.Text.Json
|
@using System.Text.Json
|
||||||
|
|
||||||
@inject HttpClient httpClient
|
@inject HttpClient httpClient
|
||||||
|
|
||||||
@if (people != null)
|
@if (data != null)
|
||||||
{
|
{
|
||||||
@foreach (var person in people)
|
@foreach (var component in data) {
|
||||||
{
|
switch (component.Type) {
|
||||||
<PersonCard Data="@person" />
|
case 0:
|
||||||
|
<TestCard Data="@component" />
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private List<Person> people;
|
public List<Component> data;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
var response = await httpClient.GetAsync("http://localhost:8080");
|
var response = await httpClient.GetAsync("http://localhost:8080");
|
||||||
var json = await response.Content.ReadAsStringAsync();
|
var json = await response.Content.ReadAsStringAsync();
|
||||||
people = JsonSerializer.Deserialize<List<Person>>(json);
|
data = JsonSerializer.Deserialize<List<Component>>(json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
Binary file not shown.
@ -31,8 +31,8 @@ build_metadata.AdditionalFiles.CssScope =
|
|||||||
build_metadata.AdditionalFiles.TargetPath = UGFnZXNcSW5kZXgucmF6b3I=
|
build_metadata.AdditionalFiles.TargetPath = UGFnZXNcSW5kZXgucmF6b3I=
|
||||||
build_metadata.AdditionalFiles.CssScope =
|
build_metadata.AdditionalFiles.CssScope =
|
||||||
|
|
||||||
[C:/Users/user/Documents/Panoptes/2023-ca400-murphg62-byrnm257/src/PanoptesFrontend/Pages/PersonCard.razor]
|
[C:/Users/user/Documents/Panoptes/2023-ca400-murphg62-byrnm257/src/PanoptesFrontend/Pages/TestCard.razor]
|
||||||
build_metadata.AdditionalFiles.TargetPath = UGFnZXNcUGVyc29uQ2FyZC5yYXpvcg==
|
build_metadata.AdditionalFiles.TargetPath = UGFnZXNcVGVzdENhcmQucmF6b3I=
|
||||||
build_metadata.AdditionalFiles.CssScope =
|
build_metadata.AdditionalFiles.CssScope =
|
||||||
|
|
||||||
[C:/Users/user/Documents/Panoptes/2023-ca400-murphg62-byrnm257/src/PanoptesFrontend/Pages/TestRequest.razor]
|
[C:/Users/user/Documents/Panoptes/2023-ca400-murphg62-byrnm257/src/PanoptesFrontend/Pages/TestRequest.razor]
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
280f506f1a47e4ea08b5e9891f5fe3ce43a1a5db
|
84500de425a5aa9d6b1d6919ac86ff6fd49c4373
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2,3 +2,11 @@
|
|||||||
2.0
|
2.0
|
||||||
2.0
|
2.0
|
||||||
2.0
|
2.0
|
||||||
|
2.0
|
||||||
|
2.0
|
||||||
|
2.0
|
||||||
|
2.0
|
||||||
|
2.0
|
||||||
|
2.0
|
||||||
|
2.0
|
||||||
|
2.0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user