CORS, Theme, Better flow and dotnet tools

This commit is contained in:
2023-01-04 09:38:00 -07:00
parent a3938d1916
commit 978e698da5
72 changed files with 528 additions and 774 deletions

View File

@ -3,15 +3,5 @@
<PageTitle>Counter</PageTitle>
<MudText Typo="Typo.h3" GutterBottom="true">Counter</MudText>
<MudText Class="mb-4">Current count: @currentCount</MudText>
<MudButton Color="Color.Primary" Variant="Variant.Filled" @onclick="IncrementCount">Click me</MudButton>
@code {
private int currentCount = 0;
private void IncrementCount()
{
currentCount++;
}
}
<MudText Class="mb-4">Current count: @_CurrentCount</MudText>
<MudButton Color="Color.Primary" Variant="Variant.Filled" @onclick="IncrementCount">Click me</MudButton>

View File

@ -0,0 +1,20 @@
using Microsoft.AspNetCore.Components;
namespace Expose.MyIT.Client.Pages;
public partial class Counter
{
[Inject] protected ILogger<Counter>? Logger { get; set; }
private int _CurrentCount = 0;
private void IncrementCount()
{
if (Logger is null)
throw new NullReferenceException(nameof(Logger));
Logger.LogWarning("Someone has clicked me!");
_CurrentCount++;
}
}

View File

@ -1,5 +1,4 @@
@page "/fetchdata"
@using Expose.MyIT.Shared
@using Expose.MyIT.Shared.ViewModels
<PageTitle>Weather forecast</PageTitle>

View File

@ -1,5 +1,4 @@
@page "/fetchServiceShoporders"
@using Expose.MyIT.Shared
@using Expose.MyIT.Shared.ViewModels
<PageTitle>Service-Shop Orders</PageTitle>
@ -13,12 +12,21 @@ else
{
<MudTable Items="_ServiceShopOrders" Hover="true" SortLabel="Sort By" Elevation="0">
<HeaderContent>
<MudTh><MudTableSortLabel InitialDirection="SortDirection.Ascending" SortBy="new Func<ServiceShopOrder, object>(x=>x.CreatedDate)">CreatedDate</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortBy="new Func<ServiceShopOrder, object>(x=>x.Id)">Id</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortBy="new Func<ServiceShopOrder, object>(x=>x.Name)">Name</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortBy="new Func<ServiceShopOrder, object>(x=>x.BookingNames)">Booking Names</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortBy="new Func<ServiceShopOrder, object>(x=>x.Type)">Type</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortBy="new Func<ServiceShopOrder, object>(x=>x.State)">State</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortBy="new Func<ServiceShopOrder, object>(x=>x.ItemNumber)">Item Number</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel InitialDirection="SortDirection.Descending" SortBy="new Func<ServiceShopOrder, object>(x=>x.CreatedDate)">Created Date</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortBy="new Func<ServiceShopOrder, object>(x=>x.DecidedDate)">Decided Date</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortBy="new Func<ServiceShopOrder, object>(x=>x.Recipient)">Recipient</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortBy="new Func<ServiceShopOrder, object>(x=>x.Requestor)">Requestor</MudTableSortLabel></MudTh>
</HeaderContent>
<RowTemplate>
<MudTd DataLabel="Id">@context.Id</MudTd>
<MudTd DataLabel="Name">@context.Name</MudTd>
<MudTd DataLabel="BookingNames">@context.BookingNames</MudTd>
<MudTd DataLabel="BookingNames">@string.Join(' ', context.BookingNames)</MudTd>
<MudTd DataLabel="Type">@context.Type</MudTd>
<MudTd DataLabel="State">@context.State</MudTd>
<MudTd DataLabel="ItemNumber">@context.ItemNumber</MudTd>

View File

@ -27,6 +27,7 @@ public partial class FetchServiceShopOrders
if (Http is null)
throw new NullReferenceException(nameof(Http));
string controllerName = MyIT.Shared.Models.Stateless.Methods.IServiceShopOrderController.GetRouteName();
_ServiceShopOrders = await Http.GetFromJsonAsync<ServiceShopOrder[]>($"api/{controllerName}");
string actionName = nameof(MyIT.Shared.Models.Stateless.Methods.ISsaOrderController.GetAllSsaOrders).Substring(3, 3);
_ServiceShopOrders = await Http.GetFromJsonAsync<ServiceShopOrder[]>($"api/{controllerName}/{actionName}");
}
}

View File

@ -1,34 +0,0 @@
@page "/fetchssaorders"
@using Expose.MyIT.Shared
@using Expose.MyIT.Shared.ViewModels
<PageTitle>SSA Orders</PageTitle>
<MudText Typo="Typo.h3" GutterBottom="true">SSA Orders</MudText>
@if (_SsaOrders == null)
{
<MudProgressCircular Color="Color.Default" Indeterminate="true" />
}
else
{
<MudTable Items="_SsaOrders" Hover="true" SortLabel="Sort By" Elevation="0">
<HeaderContent>
<MudTh><MudTableSortLabel InitialDirection="SortDirection.Ascending" SortBy="new Func<SsaOrder, object>(x=>x.CreatedDate)">CreatedDate</MudTableSortLabel></MudTh>
</HeaderContent>
<RowTemplate>
<MudTd DataLabel="Id">@context.Id</MudTd>
<MudTd DataLabel="Name">@context.Name</MudTd>
<MudTd DataLabel="BookingNames">@context.BookingNames</MudTd>
<MudTd DataLabel="Type">@context.Type</MudTd>
<MudTd DataLabel="State">@context.State</MudTd>
<MudTd DataLabel="ItemNumber">@context.ItemNumber</MudTd>
<MudTd DataLabel="CreatedDate">@context.CreatedDate</MudTd>
<MudTd DataLabel="DecidedDate">@context.DecidedDate</MudTd>
<MudTd DataLabel="Recipient">@context.Recipient</MudTd>
<MudTd DataLabel="Requestor">@context.Requestor</MudTd>
</RowTemplate>
<PagerContent>
<MudTablePager PageSizeOptions="new int[]{50, 100}" />
</PagerContent>
</MudTable>
}

View File

@ -1,32 +0,0 @@
using Expose.MyIT.Shared.ViewModels;
using Microsoft.AspNetCore.Components;
using System.Net.Http.Json;
namespace Expose.MyIT.Client.Pages;
public partial class FetchSsaOrders
{
[Inject] protected HttpClient? Http { get; set; }
private SsaOrder[]? _SsaOrders;
//Id
//Name
//BookingNames
//Type
//State
//ItemNumber
//CreatedDate
//DecidedDate
//Recipient
//Requestor
protected override async Task OnInitializedAsync()
{
if (Http is null)
throw new NullReferenceException(nameof(Http));
string controllerName = MyIT.Shared.Models.Stateless.Methods.ISsaOrderController.GetRouteName();
_SsaOrders = await Http.GetFromJsonAsync<SsaOrder[]>($"api/{controllerName}");
}
}