Created View Project
This commit is contained in:
26
View/Pages/AwaitingDisposition.razor
Normal file
26
View/Pages/AwaitingDisposition.razor
Normal file
@ -0,0 +1,26 @@
|
||||
@page "/"
|
||||
@page "/AwaitingDisposition"
|
||||
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
|
||||
@namespace OI.Metrology.View
|
||||
|
||||
<PageTitle>Awaiting Disposition</PageTitle>
|
||||
<h4>Awaiting Disposition</h4>
|
||||
|
||||
<div style="height: 450px;">
|
||||
<table id="grid"></table>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-top: 10px; margin-bottom: 20px;">
|
||||
<div class="col-xs-1">
|
||||
<input type="button" class="btn" id="OpenButton" value="Open" />
|
||||
</div>
|
||||
<div class="col-xs-1">
|
||||
<input type="button" class="btn" id="RefreshButton" value="Refresh" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script suppress-error="BL9992">
|
||||
setInterval(function () { $("#RefreshButton").click(); }, 60000);
|
||||
</script>
|
29
View/Pages/AwaitingDisposition.razor.cs
Normal file
29
View/Pages/AwaitingDisposition.razor.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.JSInterop;
|
||||
using OI.Metrology.View.Models;
|
||||
|
||||
namespace OI.Metrology.View;
|
||||
|
||||
public partial class AwaitingDisposition
|
||||
{
|
||||
|
||||
[Inject] protected IJSRuntime? JSRuntime { get; set; }
|
||||
[Inject] protected HttpClient? HttpClient { get; set; }
|
||||
[Inject] protected AppSettings? AppSettings { get; set; }
|
||||
[Inject] protected ILogger<AwaitingDisposition>? Logger { get; set; }
|
||||
|
||||
protected override Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
if (JSRuntime is null)
|
||||
throw new NullReferenceException(nameof(JSRuntime));
|
||||
if (AppSettings is null)
|
||||
throw new NullReferenceException(nameof(AppSettings));
|
||||
return JSRuntime.InvokeVoidAsync("initAwaitingDisposition", AppSettings.ApiUrl).AsTask();
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
}
|
1
View/Pages/AwaitingDisposition.razor.css
Normal file
1
View/Pages/AwaitingDisposition.razor.css
Normal file
@ -0,0 +1 @@
|
||||
|
13
View/Pages/Counter.razor
Normal file
13
View/Pages/Counter.razor
Normal file
@ -0,0 +1,13 @@
|
||||
@page "/counter"
|
||||
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
|
||||
@namespace OI.Metrology.View.Pages
|
||||
|
||||
<PageTitle>Counter</PageTitle>
|
||||
|
||||
<h1>Counter - Bye</h1>
|
||||
|
||||
<p role="status">Current count: @_CurrentCount</p>
|
||||
|
||||
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
|
21
View/Pages/Counter.razor.cs
Normal file
21
View/Pages/Counter.razor.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace OI.Metrology.View.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++;
|
||||
}
|
||||
|
||||
}
|
47
View/Pages/Export.razor
Normal file
47
View/Pages/Export.razor
Normal file
@ -0,0 +1,47 @@
|
||||
@page "/Export"
|
||||
|
||||
@using IgniteUI.Blazor.Controls
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using OI.Metrology.Shared.DataModels
|
||||
|
||||
@namespace OI.Metrology.View
|
||||
|
||||
<PageTitle>Export Data</PageTitle>
|
||||
|
||||
<h3>Export Data</h3>
|
||||
|
||||
<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>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table id="ExportData">
|
||||
<tr>
|
||||
<td>
|
||||
<MudSelect @bind-Value="_ToolTypeNameId" ToStringFunc="@_ConvertFunc" Label="Tool Type" Placeholder="Please Select" AdornmentColor="Color.Primary">
|
||||
@foreach (ToolTypeNameId toolTypeNameId in _ToolTypeNameIdCollection)
|
||||
{
|
||||
<MudSelectItem Value="@toolTypeNameId" />
|
||||
}
|
||||
</MudSelect>
|
||||
</td>
|
||||
<td>
|
||||
<MudDateRangePicker Label="Date Range" @bind-DateRange="_DateRange" />
|
||||
</td>
|
||||
<td>
|
||||
<MudTimePicker Label="Start and End Time" AmPm="true" @bind-Time="_TimeSpan" />
|
||||
</td>
|
||||
<td>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Info" OnClick="DownloadAsync">Download</MudButton>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
}
|
90
View/Pages/Export.razor.cs
Normal file
90
View/Pages/Export.razor.cs
Normal file
@ -0,0 +1,90 @@
|
||||
using IgniteUI.Blazor.Controls;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.JSInterop;
|
||||
using OI.Metrology.Shared.DataModels;
|
||||
using OI.Metrology.Shared.Models.Stateless;
|
||||
using System.Net;
|
||||
using System.Net.Http.Json;
|
||||
|
||||
namespace OI.Metrology.View;
|
||||
|
||||
public partial class Export
|
||||
{
|
||||
|
||||
protected TimeSpan? _TimeSpan;
|
||||
protected TimeSpan? _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; }
|
||||
[Inject] protected ILogger<AwaitingDisposition>? Logger { get; set; }
|
||||
|
||||
protected Func<ToolTypeNameId, string> _ConvertFunc = toolTypeNameId => string.Concat(toolTypeNameId?.ToolTypeName);
|
||||
|
||||
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)
|
||||
throw new NullReferenceException(nameof(JSRuntime));
|
||||
if (AppSettings is null)
|
||||
throw new NullReferenceException(nameof(AppSettings));
|
||||
return JSRuntime.InvokeVoidAsync("initExport", AppSettings.ApiUrl, DateTime.Now.AddMonths(-1), DateTime.Now).AsTask();
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
_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);
|
||||
if (Logger is null)
|
||||
throw new NullReferenceException(nameof(Logger));
|
||||
if (HttpClient is null)
|
||||
throw new NullReferenceException(nameof(HttpClient));
|
||||
string controllerName = IToolTypesController<object>.GetRouteName();
|
||||
try
|
||||
{
|
||||
Result<ToolTypeNameId[]>? result = await HttpClient.GetFromJsonAsync<Result<ToolTypeNameId[]>>($"api/{controllerName}");
|
||||
if (result is not null)
|
||||
_ToolTypeNameIdCollection = result.Results;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
string json = await HttpClient.GetStringAsync($"api/{controllerName}");
|
||||
Logger.LogInformation(message: json);
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task DownloadAsync()
|
||||
{
|
||||
if (JSRuntime is null)
|
||||
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)
|
||||
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 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}");
|
||||
}
|
||||
|
||||
}
|
4
View/Pages/Export.razor.css
Normal file
4
View/Pages/Export.razor.css
Normal file
@ -0,0 +1,4 @@
|
||||
td {
|
||||
padding-bottom: 2em;
|
||||
padding-right: 1em;
|
||||
}
|
7
View/Pages/Index.razor
Normal file
7
View/Pages/Index.razor
Normal file
@ -0,0 +1,7 @@
|
||||
@page "/index"
|
||||
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
|
||||
@namespace OI.Metrology.View
|
||||
|
||||
<PageTitle>Index</PageTitle>
|
4
View/Pages/Index.razor.cs
Normal file
4
View/Pages/Index.razor.cs
Normal file
@ -0,0 +1,4 @@
|
||||
namespace OI.Metrology.View;
|
||||
|
||||
public partial class Index
|
||||
{ }
|
40
View/Pages/RunHeaders.razor
Normal file
40
View/Pages/RunHeaders.razor
Normal file
@ -0,0 +1,40 @@
|
||||
@page "/RunHeaders"
|
||||
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
|
||||
@namespace OI.Metrology.View
|
||||
|
||||
<PageTitle>Run Headers</PageTitle>
|
||||
|
||||
<h4>Run Headers</h4>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="ToolType">Tool Type:</label>
|
||||
</td>
|
||||
<td>
|
||||
<div id="ToolType"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table width="100%" height="80%" style="min-height:480px;">
|
||||
<tr>
|
||||
<td width="50%">
|
||||
<table id="HeaderGrid"></table>
|
||||
</td>
|
||||
<td width="50%">
|
||||
<table id="FieldsGrid"></table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="row" style="margin-top: 10px; margin-bottom: 20px;">
|
||||
<div class="col-xs-1">
|
||||
<input type="button" class="btn" id="OpenButton" value="Open" />
|
||||
</div>
|
||||
<div class="col-xs-1">
|
||||
<input type="button" class="btn" id="RefreshButton" value="Refresh" />
|
||||
</div>
|
||||
</div>
|
25
View/Pages/RunHeaders.razor.cs
Normal file
25
View/Pages/RunHeaders.razor.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
namespace OI.Metrology.View;
|
||||
|
||||
public partial class RunHeaders
|
||||
{
|
||||
|
||||
[Inject] protected IJSRuntime? JSRuntime { get; set; }
|
||||
[Inject] protected Models.AppSettings? AppSettings { get; set; }
|
||||
|
||||
protected override Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
if (JSRuntime is null)
|
||||
throw new NullReferenceException(nameof(JSRuntime));
|
||||
if (AppSettings is null)
|
||||
throw new NullReferenceException(nameof(AppSettings));
|
||||
return JSRuntime.InvokeVoidAsync("initRunHeaders", AppSettings.ApiUrl).AsTask();
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
}
|
17
View/Pages/RunHeaders.razor.css
Normal file
17
View/Pages/RunHeaders.razor.css
Normal file
@ -0,0 +1,17 @@
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
div.container-fluid {
|
||||
height: 90%;
|
||||
}
|
||||
|
||||
#HeaderGrid,
|
||||
#FieldsGrid {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.FieldTitle {
|
||||
font-weight: bold;
|
||||
}
|
69
View/Pages/RunInfo.razor
Normal file
69
View/Pages/RunInfo.razor
Normal file
@ -0,0 +1,69 @@
|
||||
@page "/RunInfo/{ToolTypeId:int?}/{HeaderId:int?}"
|
||||
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
|
||||
@namespace OI.Metrology.View
|
||||
|
||||
<PageTitle>Run Info</PageTitle>
|
||||
|
||||
<h4>Run Information</h4>
|
||||
|
||||
<form class="form-inline mb-4">
|
||||
<div class="form-group">
|
||||
<label for="ToolType">Tool Type</label>
|
||||
<div class="form-control" id="ToolType"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="StartDate">Start Time</label>
|
||||
<div class="form-control mb-2 mr-sm-2" id="StartDate"></div>
|
||||
<div class="form-control mb-2 mr-sm-2" id="StartTime"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="EndDate">End Time</label>
|
||||
<div class="form-control mb-2 mr-sm-2" id="EndDate"></div>
|
||||
<div class="form-control mb-2 mr-sm-2" id="EndTime"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input class="btn btn-primary" type="button" value="Load Headers" id="LoadHeadersButton" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-check-label" for="chkAutoRefresh">
|
||||
Auto-Refresh
|
||||
</label>
|
||||
<input class="form-check-input" type="checkbox" id="chkAutoRefresh">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div style="height: 300px;" id="HeaderGridDiv">
|
||||
<span id="ToolTypeID" hidden></span>
|
||||
<table id="HeaderGrid"></table>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-top: 10px; margin-bottom: 20px;">
|
||||
<div class="col-xs-1">
|
||||
<input type="button" class="btn" id="GetDataButton" value="Get Data" disabled />
|
||||
</div>
|
||||
<div class="col-xs-1">
|
||||
<input type="button" class="btn" id="ReviewButton" value="Review" disabled />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="DetailsDiv" hidden>
|
||||
|
||||
<span id="HeaderId" hidden></span>
|
||||
<span id="HeaderAttachmentId" hidden></span>
|
||||
<div style="padding-bottom: 20px;" id="DetailsGridDiv">
|
||||
<table id="DetailsGrid"></table>
|
||||
</div>
|
||||
|
||||
<div id="ExportDiv" style="margin-top: 10px;" hidden>
|
||||
<input type="button" class="btn" value="Send to OpenInsight" id="OIExportButton" />
|
||||
<span id="OIExportResult" style="margin-left: 10px; font-weight: bold; color: #366b02;"></span>
|
||||
</div>
|
||||
|
||||
<p style="text-align: center; margin-top: 20px;">
|
||||
<iframe id="DataAttachmentFrame" style="height:900px; border-width:thin; margin-right: 10px;" hidden></iframe>
|
||||
<iframe id="HeaderAttachmentFrame" style="height:900px; border-width:thin;" hidden></iframe>
|
||||
</p>
|
||||
|
||||
</div>
|
32
View/Pages/RunInfo.razor.cs
Normal file
32
View/Pages/RunInfo.razor.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
namespace OI.Metrology.View;
|
||||
|
||||
public partial class RunInfo
|
||||
{
|
||||
|
||||
[Parameter] public int? HeaderId { get; set; }
|
||||
[Parameter] public int? ToolTypeId { get; set; }
|
||||
|
||||
[Inject] protected IJSRuntime? JSRuntime { get; set; }
|
||||
[Inject] protected Models.AppSettings? AppSettings { get; set; }
|
||||
|
||||
protected override Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
if (JSRuntime is null)
|
||||
throw new NullReferenceException(nameof(JSRuntime));
|
||||
if (AppSettings is null)
|
||||
throw new NullReferenceException(nameof(AppSettings));
|
||||
Metrology.Shared.ViewModels.RunInfo? model = null;
|
||||
int initialHeaderId = model is not null ? model.HeaderID : HeaderId is not null ? HeaderId.Value : 0;
|
||||
string initialHeaderAttachmentId = model is not null ? model.HeaderAttachmentID.ToString() : string.Empty;
|
||||
int initialToolTypeID = model is not null ? model.ToolTypeID : ToolTypeId is not null ? ToolTypeId.Value : 1;
|
||||
return JSRuntime.InvokeVoidAsync("initRunInfo", AppSettings.ApiUrl, initialToolTypeID, initialHeaderId, initialHeaderAttachmentId).AsTask();
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
}
|
8
View/Pages/RunInfo.razor.css
Normal file
8
View/Pages/RunInfo.razor.css
Normal file
@ -0,0 +1,8 @@
|
||||
#HeaderGridDiv,
|
||||
#DetailsGridDiv {
|
||||
font-size: 12px;
|
||||
}
|
||||
p {
|
||||
color: red;
|
||||
background-color: aqua;
|
||||
}
|
Reference in New Issue
Block a user