Added Blazor back
This commit is contained in:
parent
2f1353d36c
commit
7173c0795a
@ -6,6 +6,7 @@
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MudBlazor" Version="6.1.8" />
|
||||
<PackageReference Include="IgniteUI.Blazor" Version="22.2.24" />
|
||||
<PackageReference Include="Serilog.Sinks.BrowserConsole" Version="1.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.BrowserHttp" Version="1.0.0-dev-00032" />
|
||||
|
@ -24,6 +24,7 @@
|
||||
<link rel="icon" type="image/png" href="favicon.png" />
|
||||
<link rel="apple-touch-icon" sizes="512x512" href="icon-512.png" />
|
||||
<link rel="apple-touch-icon" sizes="192x192" href="icon-192.png" />
|
||||
<link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet" />
|
||||
<link href="_content/IgniteUI.Blazor/themes/light/bootstrap.css" rel="stylesheet" />
|
||||
|
||||
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
|
||||
@ -61,6 +62,7 @@
|
||||
</div>
|
||||
|
||||
<script src="_framework/blazor.server.js"></script>
|
||||
<script src="_content/MudBlazor/MudBlazor.min.js"></script>
|
||||
<script src="_content/IgniteUI.Blazor/app.bundle.js"></script>
|
||||
<script src="js/bootstrap.min.js" type="text/javascript" asp-append-version="true"></script>
|
||||
<script src="js/respond.min.js" type="text/javascript" asp-append-version="true"></script>
|
||||
|
@ -1,5 +1,6 @@
|
||||
using IgniteUI.Blazor.Controls;
|
||||
using OI.Metrology.View.Models;
|
||||
using MudBlazor.Services;
|
||||
using Serilog;
|
||||
using Serilog.Core;
|
||||
|
||||
@ -23,6 +24,7 @@ internal class Program
|
||||
AppSettings appSettings = View.Models.Binder.AppSettings.Get(builder.Configuration);
|
||||
// Add services to the container.
|
||||
_ = builder.Services.AddRazorPages();
|
||||
_ = builder.Services.AddMudServices();
|
||||
_ = builder.Services.AddIgniteUIBlazor(typeof(IgbIconModule));
|
||||
_ = builder.Services.AddServerSideBlazor();
|
||||
_ = builder.Services.AddHttpContextAccessor();
|
||||
|
@ -8,6 +8,7 @@
|
||||
<SupportedPlatform Include="browser" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MudBlazor" Version="6.1.8" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.2" />
|
||||
<PackageReference Include="IgniteUI.Blazor" Version="22.2.24" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
|
||||
@ -16,7 +17,7 @@
|
||||
<PackageReference Include="Serilog.Sinks.BrowserHttp" Version="1.0.0-dev-00032" />
|
||||
<PackageReference Include="System.Net.Http.Json" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Shared\OI.Metrology.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Shared\OI.Metrology.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,6 +1,6 @@
|
||||
@page "/Export"
|
||||
|
||||
@using IgniteUI.Blazor.Controls
|
||||
@using MudBlazor
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using OI.Metrology.Shared.DataModels
|
||||
|
||||
@ -12,11 +12,6 @@
|
||||
|
||||
<hr />
|
||||
|
||||
<IgbButton>
|
||||
<IgbIcon @ref="IconRef" Size="SizableComponentSize.Small" IconName="build" Collection="material" />
|
||||
Refresh
|
||||
</IgbButton>
|
||||
|
||||
@if (_TimeSpan is null || _DateRange is null || _ToolTypeNameId is null || _ToolTypeNameIdCollection is null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
|
@ -2,6 +2,7 @@ using IgniteUI.Blazor.Controls;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.JSInterop;
|
||||
using MudBlazor;
|
||||
using OI.Metrology.Shared.DataModels;
|
||||
using OI.Metrology.Shared.Models.Stateless;
|
||||
using System.Net;
|
||||
@ -13,11 +14,10 @@ public partial class Export
|
||||
{
|
||||
|
||||
protected TimeSpan? _TimeSpan;
|
||||
protected TimeSpan? _DateRange;
|
||||
protected DateRange? _DateRange;
|
||||
protected ToolTypeNameId? _ToolTypeNameId;
|
||||
protected ToolTypeNameId[]? _ToolTypeNameIdCollection;
|
||||
|
||||
protected IgbIcon? IconRef { get; set; }
|
||||
[Inject] protected HttpClient? HttpClient { get; set; }
|
||||
[Inject] protected IJSRuntime? JSRuntime { get; set; }
|
||||
[Inject] protected Models.AppSettings? AppSettings { get; set; }
|
||||
@ -27,15 +27,6 @@ public partial class Export
|
||||
|
||||
protected override Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender && IconRef is not null)
|
||||
{
|
||||
// _ = IconRef.EnsureReady().ContinueWith(new Action<Task>((e) =>
|
||||
// IconRef.RegisterIconAsync("build", "https://unpkg.com/material-design-icons@3.0.1/action/svg/production/ic_build_24px.svg", "material")));
|
||||
const string buildIcon = "<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path d='M22.7 19l-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z'/></svg>";
|
||||
// const string review = "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' aria-labelledby='crcode-review-desc crcode-review-title'><title id='crcode-review-title'>Code Review Icon</title><desc id='crcode-review-desc'>A picture showing encircled angle brackets with a dot between them.</desc><path d='M12 2a10 10 0 1010 10A10 10 0 0012 2zM9 14.207l-1 1L4.793 12 8 8.793l1 1L6.793 12zM12 14a2 2 0 112-2 2 2 0 01-2 2zm4 1.207l-1-1L17.207 12 15 9.793l1-1L19.207 12z'/></svg>";
|
||||
_ = IconRef.EnsureReady().ContinueWith(new Action<Task>((e) =>
|
||||
IconRef.RegisterIconFromTextAsync("build", buildIcon, "material")));
|
||||
}
|
||||
if (firstRender)
|
||||
{
|
||||
if (JSRuntime is null)
|
||||
@ -51,7 +42,7 @@ public partial class Export
|
||||
{
|
||||
_ToolTypeNameId ??= new();
|
||||
_TimeSpan ??= new TimeSpan(DateTime.Now.Hour, DateTime.Now.Minute, 00);
|
||||
_DateRange ??= new TimeSpan(DateTime.Now.Date.Ticks - DateTime.Now.AddMonths(-1).Date.Ticks);
|
||||
_DateRange ??= new DateRange(DateTime.Now.AddMonths(-1).Date, DateTime.Now.Date);
|
||||
if (Logger is null)
|
||||
throw new NullReferenceException(nameof(Logger));
|
||||
if (HttpClient is null)
|
||||
@ -76,12 +67,11 @@ public partial class Export
|
||||
throw new NullReferenceException(nameof(JSRuntime));
|
||||
if (HttpClient is null)
|
||||
throw new NullReferenceException(nameof(HttpClient));
|
||||
if (_TimeSpan is null || _DateRange is null || _ToolTypeNameId is null || _ToolTypeNameIdCollection is null || _ToolTypeNameId.ToolTypeName is null || _DateRange is null)
|
||||
if (_TimeSpan is null || _DateRange is null || _ToolTypeNameId is null || _ToolTypeNameIdCollection is null || _ToolTypeNameId.ToolTypeName is null || _DateRange.Start is null || _DateRange.End is null)
|
||||
return;
|
||||
TimeSpan timeSpan = new(_TimeSpan.Value.Ticks);
|
||||
string controllerName = IToolTypesController<object>.GetRouteName();
|
||||
string endTime = _DateRange.Value.Add(timeSpan).ToString();
|
||||
string startTime = _DateRange.Value.Add(new TimeSpan(_TimeSpan.Value.Ticks)).ToString();
|
||||
string endTime = _DateRange.End.Value.AddTicks(_TimeSpan.Value.Ticks).ToString();
|
||||
string startTime = _DateRange.Start.Value.AddTicks(_TimeSpan.Value.Ticks).ToString();
|
||||
string fileName = $"Export_{_ToolTypeNameId.ToolTypeName}_{startTime:yyyyMMddHHmm}_to_{endTime:yyyyMMddHHmm}.csv";
|
||||
string query = $"datebegin={startTime:MM/dd/yyyy hh:mm tt}&dateend={endTime:MM/dd/yyyy hh:mm tt}&filename={WebUtility.UrlEncode(fileName)}";
|
||||
await JSRuntime.InvokeVoidAsync("triggerFileDownload", fileName, $"{HttpClient.BaseAddress}api/{controllerName}/{_ToolTypeNameId.ID}/csv?{query}");
|
||||
|
@ -1,5 +1,9 @@
|
||||
@inherits LayoutComponentBase
|
||||
@namespace OI.Metrology.View.Shared
|
||||
@using MudBlazor
|
||||
|
||||
<MudDialogProvider />
|
||||
<MudSnackbarProvider />
|
||||
|
||||
<div class="navbar navbar-fixed-top @(AppSettings is not null && AppSettings.IsDevelopment ? "test-database" : "" )">
|
||||
<div class="container-fluid">
|
||||
|
Loading…
x
Reference in New Issue
Block a user