10 Commits

Author SHA1 Message Date
131abcd3cd Need DB III 2023-02-08 10:50:03 -07:00
78567f9e39 Testing II 2023-02-08 10:26:59 -07:00
8c6a2d92db Need DB II 2023-02-08 09:42:52 -07:00
7828493f27 Testing I 2023-02-08 09:33:28 -07:00
65a3c6e7f6 Need DB 2023-02-08 07:16:09 -07:00
90d58e8e9c Style changes 2023-02-04 15:32:20 -07:00
7173c0795a Added Blazor back 2023-02-04 10:37:35 -07:00
2f1353d36c Created View Project 2023-02-04 10:17:21 -07:00
ff64ac6d98 MudBlazor to IgniteUI.Blazor.Controls 2023-02-04 02:04:11 -07:00
dd30123d0f nuget updates 2023-02-02 14:21:41 -07:00
33 changed files with 200 additions and 433 deletions

2
.gitignore vendored

@ -52,7 +52,7 @@ BenchmarkDotNet.Artifacts/
project.lock.json
project.fragment.lock.json
artifacts/
# **/Properties/launchSettings.json
**/Properties/launchSettings.json
# StyleCop
StyleCopReport.xml

5
.vscode/launch.json vendored

@ -66,11 +66,6 @@
"request": "attach",
"preLaunchTask": "watchClientHub",
"processName": "OI.Metrology.ClientHub.exe"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}

2
.vscode/tasks.json vendored

@ -44,7 +44,7 @@
"args": [
"watch",
"--launch-profile",
"http",
"https",
"run",
"--project",
"${workspaceFolder}/Server/OI.Metrology.Server.csproj",

@ -1,25 +0,0 @@
{
"profiles": {
"profileA": {},
"Phares-Development": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7023;http://localhost:5027",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Phares-Production": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7023;http://localhost:5027",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Production"
}
}
}
}

@ -1,22 +0,0 @@
{
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5093",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7135;http://localhost:5093",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Archive", "Archive\OI.Metro
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared", "Shared\OI.Metrology.Shared.csproj", "{A807EAE3-7DCB-4E5E-BE54-0D7410D18B3E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "View", "View\OI.Metrology.View.csproj", "{D7988D0C-FE5D-429B-AA1C-911A1A29A468}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "Server\OI.Metrology.Server.csproj", "{25C86DF8-EC1A-4D4B-AD4E-6561174824B9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\OI.Metrology.Tests.csproj", "{B67FB8C4-402E-4D53-90A6-90F6FDB9D082}"
@ -36,5 +38,9 @@ Global
{B67FB8C4-402E-4D53-90A6-90F6FDB9D082}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B67FB8C4-402E-4D53-90A6-90F6FDB9D082}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B67FB8C4-402E-4D53-90A6-90F6FDB9D082}.Release|Any CPU.Build.0 = Release|Any CPU
{D7988D0C-FE5D-429B-AA1C-911A1A29A468}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D7988D0C-FE5D-429B-AA1C-911A1A29A468}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D7988D0C-FE5D-429B-AA1C-911A1A29A468}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D7988D0C-FE5D-429B-AA1C-911A1A29A468}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

@ -44,7 +44,7 @@
"args": [
"watch",
"--launch-profile",
"http",
"https",
"run",
"--project",
"${workspaceFolder}/OI.Metrology.Server.csproj",

@ -9,25 +9,36 @@ using System.Text.Json;
public class PinController : Controller, IPinController<IActionResult>
{
private readonly ILogger _Logger;
private readonly IPinRepository _PinRepository;
private readonly IMetrologyRepository _MetrologyRepository;
public PinController(ILogger<InboundController> logger, IMetrologyRepository metrologyRepository, IPinRepository pinRepository)
{
_Logger = logger;
_MetrologyRepository = metrologyRepository;
_PinRepository = pinRepository;
}
[HttpPost("{toolTypeId}/markAsPinned")]
[HttpPost("/api/pin/markAsPinned")]
public IActionResult MarkAsPinned(Shared.DataModels.HeaderCommon headerCommon)
{
_PinRepository.SetPinnedTable(headerCommon);
string toolTypeId = headerCommon.ToolTypeID.ToString();
string json = JsonSerializer.Serialize(headerCommon, new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
string? was = HttpContext.Session.GetString(toolTypeId);
if (was is not null)
_Logger.LogDebug($"{toolTypeId} was: {was}");
HttpContext.Session.SetString(toolTypeId, json);
return Ok();
}
[HttpGet]
[Route("{toolTypeId}/pinned")]
public IActionResult GetPinnedTable(int toolTypeId, string? biorad_id = null, string? cde_id = null, string? rds = null) =>
Json(_PinRepository.GetPinnedTable(_MetrologyRepository, toolTypeId, biorad_id, cde_id, rds), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
[Route("{id}/pinned")]
public IActionResult GetPinnedTable(int id)
{
string? cde = HttpContext.Session.GetString(((int)IPinRepository.ToolId.CDE).ToString());
string? bioRad = HttpContext.Session.GetString(((int)IPinRepository.ToolId.BioRad).ToString());
return Json(_PinRepository.GetPinnedTable(_MetrologyRepository, id, bioRad, cde), new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
}
}

@ -11,8 +11,6 @@ namespace OI.Metrology.Server.Controllers;
public class ExportController : Controller
{
private readonly string _ApiUrl;
private readonly ILogger _Logger;
private readonly bool _IsTestDatabase;
private readonly AppSettings _AppSettings;
@ -24,7 +22,6 @@ public class ExportController : Controller
_AppSettings = appSettings;
_MetrologyRepository = metrologyRepository;
_IsTestDatabase = appSettings.ConnectionString.Contains("test", StringComparison.InvariantCultureIgnoreCase);
_ApiUrl = string.IsNullOrEmpty(appSettings.ApiUrl) ? Url.Content("~/") : appSettings.ApiUrl[0] == '~' ? Url.Content(appSettings.ApiUrl) : appSettings.ApiUrl;
}
public override void OnActionExecuted(ActionExecutedContext context)
@ -32,7 +29,7 @@ public class ExportController : Controller
base.OnActionExecuted(context);
ViewBag.IsTestDatabase = _IsTestDatabase;
}
[HttpGet]
[Route("/Export")]
public ActionResult Index()
@ -44,7 +41,6 @@ public class ExportController : Controller
};
MonIn monIn = MonIn.GetInstance();
_ = monIn.SendStatus(_AppSettings.MonASite, _AppSettings.MonAResource, "Heartbeat", State.Up);
ViewBag.ApiUrl = _ApiUrl;
return View(model);
}
@ -85,7 +81,6 @@ public class ExportController : Controller
_ = monIn.SendStatus(_AppSettings.MonASite, _AppSettings.MonAResource, "Heartbeat", State.Warning);
}
}
ViewBag.ApiUrl = _ApiUrl;
return View("Index", model);
}

@ -8,8 +8,6 @@ namespace OI.Metrology.Server.Controllers;
public class PagesController : Controller
{
private readonly string _ApiUrl;
private readonly bool _IsTestDatabase;
private readonly IMetrologyRepository _MetrologyRepository;
@ -17,7 +15,6 @@ public class PagesController : Controller
{
_MetrologyRepository = metrologyRepository;
_IsTestDatabase = appSettings.ConnectionString.Contains("test", StringComparison.InvariantCultureIgnoreCase);
_ApiUrl = string.IsNullOrEmpty(appSettings.ApiUrl) ? Url.Content("~/") : appSettings.ApiUrl[0] == '~' ? Url.Content(appSettings.ApiUrl) : appSettings.ApiUrl;
}
public override void OnActionExecuted(ActionExecutedContext context)
@ -28,20 +25,14 @@ public class PagesController : Controller
[HttpGet]
[Route("/")]
public IActionResult Index()
{
ViewBag.ApiUrl = _ApiUrl;
return View("AwaitingDispo");
}
public IActionResult Index() =>
View("AwaitingDispo");
[HttpGet]
[Route("/AwaitingDispo")]
[Route("/Metrology/AwaitingDispo")]
public IActionResult AwaitingDispo()
{
ViewBag.ApiUrl = _ApiUrl;
return View();
}
public IActionResult AwaitingDispo() =>
View();
[HttpGet]
[Route("/RunInfo")]
@ -58,18 +49,14 @@ public class PagesController : Controller
{
m.HeaderAttachmentID = _MetrologyRepository.GetHeaderAttachmentID(tooltypeid, headerid);
}
ViewBag.ApiUrl = _ApiUrl;
return View(m);
}
[HttpGet]
[Route("/RunHeaders")]
[Route("/Metrology/RunHeaders")]
public IActionResult RunHeaders()
{
ViewBag.ApiUrl = _ApiUrl;
return View();
}
public IActionResult RunHeaders() =>
View();
[HttpGet]
[Route("/Crash")]

@ -1,6 +0,0 @@
{
{
"Results": [],
"TotalRows": 0
}
}

@ -5,7 +5,6 @@ namespace OI.Metrology.Server.Models;
public record AppSettings(string ApiLoggingContentTypes,
string ApiLoggingPathPrefixes,
string ApiLogPath,
string ApiUrl,
string AttachmentPath,
string BuildNumber,
string Company,

@ -11,7 +11,6 @@ public class AppSettings
[Display(Name = "Api Logging Content Types"), Required] public string ApiLoggingContentTypes { get; set; }
[Display(Name = "Api Logging Path Prefixes"), Required] public string ApiLoggingPathPrefixes { get; set; }
[Display(Name = "Api Log Path"), Required] public string ApiLogPath { get; set; }
[Display(Name = "Api URL"), Required] public string ApiUrl { get; set; }
[Display(Name = "Attachment Path"), Required] public string AttachmentPath { get; set; }
[Display(Name = "Build Number"), Required] public string BuildNumber { get; set; }
[Display(Name = "Company"), Required] public string Company { get; set; }
@ -47,8 +46,6 @@ public class AppSettings
throw new NullReferenceException(nameof(ApiLoggingPathPrefixes));
if (appSettings.ApiLogPath is null)
throw new NullReferenceException(nameof(ApiLogPath));
if (appSettings.ApiUrl is null)
throw new NullReferenceException(nameof(ApiUrl));
if (appSettings.AttachmentPath is null)
throw new NullReferenceException(nameof(AttachmentPath));
if (appSettings.BuildNumber is null)
@ -83,7 +80,6 @@ public class AppSettings
appSettings.ApiLoggingContentTypes,
appSettings.ApiLoggingPathPrefixes,
appSettings.ApiLogPath,
appSettings.ApiUrl,
appSettings.AttachmentPath,
appSettings.BuildNumber,
appSettings.Company,

@ -97,9 +97,6 @@
<None Include="Data\Tests\GetIpAddressApi.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Data\Tests\GetPinnedTableApi.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Data\Tests\GetToolTypeMetadataApi.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>

@ -102,7 +102,6 @@ public class Program
if (!webApplicationBuilder.Environment.IsDevelopment())
{
_ = webApplication.UseExceptionHandler("/Error");
_ = webApplication.UseHttpsRedirection();
_ = webApplication.UseHsts();
}
else
@ -121,6 +120,7 @@ public class Program
_ = webApplication.UseFileServer(enableDirectoryBrowsing: true);
_ = webApplication.UseStaticFiles();
_ = webApplication.UseSession();
_ = webApplication.UseHttpsRedirection();
_ = webApplication.UseMiddleware<ApiLoggingMiddleware>();
_ = webApplication.MapControllers();
log.Information("Starting Web Application");

@ -1,31 +0,0 @@
{
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "http://localhost:5126",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "https://localhost:7130;http://localhost:5126",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https-prod": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "https://localhost:7130;http://localhost:5126",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Production"
}
}
}
}

@ -9,103 +9,76 @@ public class PinRepository : IPinRepository
private readonly string _MockRoot;
private readonly Serilog.ILogger _Log;
private readonly Dictionary<string, Dictionary<long, HeaderCommon>> _RdsToHeaderCommonCollection;
public PinRepository(string mockRoot)
{
_MockRoot = mockRoot;
_RdsToHeaderCommonCollection = new();
_Log = Serilog.Log.ForContext<PinRepository>();
}
void IPinRepository.SetPinnedTable(HeaderCommon headerCommon)
{
Dictionary<long, HeaderCommon>? toolIdToHeader;
if (!string.IsNullOrEmpty(headerCommon.RDS))
{
if (!_RdsToHeaderCommonCollection.TryGetValue(headerCommon.RDS, out toolIdToHeader))
{
_RdsToHeaderCommonCollection.Add(headerCommon.RDS, new());
if (!_RdsToHeaderCommonCollection.TryGetValue(headerCommon.RDS, out toolIdToHeader))
throw new Exception();
}
if (toolIdToHeader.ContainsKey(headerCommon.ToolTypeID))
toolIdToHeader[headerCommon.ToolTypeID] = headerCommon;
else
toolIdToHeader.Add(headerCommon.ToolTypeID, headerCommon);
}
}
private (HeaderCommon?, HeaderCommon?) GetBoth(string rds, long bioRadId, long cdeId)
{
Dictionary<long, HeaderCommon>? toolIdToHeader;
if (!_RdsToHeaderCommonCollection.TryGetValue(rds, out toolIdToHeader))
{
_RdsToHeaderCommonCollection.Add(rds, new());
if (!_RdsToHeaderCommonCollection.TryGetValue(rds, out toolIdToHeader))
throw new Exception();
}
_ = toolIdToHeader.TryGetValue(cdeId, out HeaderCommon? cdeHeader);
_ = toolIdToHeader.TryGetValue(bioRadId, out HeaderCommon? bioRadHeader);
return new(bioRadHeader, cdeHeader);
}
private static Pinned? GetPinned(IMetrologyRepository metrologyRepository, HeaderCommon headerCommon, int points, int column)
{
Pinned? result;
List<string> values;
System.Data.DataTable dataTable = metrologyRepository.GetData((int)headerCommon.ToolTypeID, headerCommon.ID);
if (dataTable.Rows.Count <= points || dataTable.Columns.Count <= column)
result = null;
else
{
values = new();
for (int i = 0; i < dataTable.Rows.Count - 1; i++)
{
if (dataTable.Rows[i]?.ItemArray[column] is null)
break;
values.Add(string.Concat(dataTable.Rows[i].ItemArray[column]));
}
if (values.Count <= points)
result = null;
else
result = new(headerCommon, values);
}
return result;
}
Result<Pinned[]> IPinRepository.GetPinnedTable(IMetrologyRepository metrologyRepository, int id, string? biorad_id, string? cde_id, string? rds)
Result<Pinned[]> IPinRepository.GetPinnedTable(IMetrologyRepository metrologyRepository, int id, string? bioRad, string? cde)
{
Result<Pinned[]>? r;
if (!string.IsNullOrEmpty(_MockRoot))
{
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), "GetPinnedTableApi.json"));
r = JsonSerializer.Deserialize<Result<Pinned[]>>(json);
if (r is null)
throw new NullReferenceException(nameof(r));
}
HeaderCommon? cdeHeader = cde is null ? null : JsonSerializer.Deserialize<HeaderCommon>(cde);
long cdeId = cdeHeader is null ? (long)IPinRepository.ToolId.CDE : cdeHeader.ToolTypeID;
HeaderCommon? bioRadHeader = bioRad is null ? null : JsonSerializer.Deserialize<HeaderCommon>(bioRad);
long bioRadId = bioRadHeader is null ? (long)IPinRepository.ToolId.BioRad : bioRadHeader.ToolTypeID;
if (cdeId != id && bioRadId != id)
r = new() { Results = Array.Empty<Pinned>(), TotalRows = 0 };
else
{
if (string.IsNullOrEmpty(rds) || !long.TryParse(biorad_id, out long bioRadId) || !long.TryParse(cde_id, out long cdeId))
r = new() { Results = Array.Empty<Pinned>(), TotalRows = 0 };
if (!string.IsNullOrEmpty(_MockRoot))
{
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), "GetPinnedTableApi.json"));
r = JsonSerializer.Deserialize<Result<Pinned[]>>(json);
if (r is null)
throw new NullReferenceException(nameof(r));
}
else
{
List<string> values;
const int points = 9;
Pinned headerCommond;
List<Pinned> results = new();
(HeaderCommon? bioRadHeader, HeaderCommon? cdeHeader) = GetBoth(rds, bioRadId, cdeId);
if (bioRadHeader is not null)
{
const int thickness = 5;
Pinned? pinned = GetPinned(metrologyRepository, bioRadHeader, points, column: thickness);
if (pinned is not null)
results.Add(pinned);
System.Data.DataTable dataTable = metrologyRepository.GetData((int)bioRadHeader.ToolTypeID, bioRadHeader.ID);
if (dataTable.Rows.Count > points && dataTable.Columns.Count > thickness)
{
values = new();
for (int i = 0; i < dataTable.Rows.Count - 1; i++)
{
if (dataTable.Rows[i]?.ItemArray[thickness] is null)
break;
values.Add(string.Concat(dataTable.Rows[i].ItemArray[thickness]));
}
if (values.Count > points)
{
headerCommond = new(bioRadHeader, values);
results.Add(headerCommond);
}
}
}
if (cdeHeader is not null)
{
const int rs = 6;
Pinned? pinned = GetPinned(metrologyRepository, cdeHeader, points, column: rs);
if (pinned is not null)
results.Add(pinned);
System.Data.DataTable dataTable = metrologyRepository.GetData((int)cdeHeader.ToolTypeID, cdeHeader.ID);
if (dataTable.Rows.Count > points && dataTable.Columns.Count > rs)
{
values = new();
for (int i = 0; i < dataTable.Rows.Count - 1; i++)
{
if (dataTable.Rows[i]?.ItemArray[rs] is null)
break;
values.Add(string.Concat(dataTable.Rows[i].ItemArray[rs]));
}
if (values.Count > points)
{
headerCommond = new(cdeHeader, values);
results.Add(headerCommond);
}
}
}
r = new()
{

@ -47,11 +47,9 @@
<script>
$(document).ready(function () {
var apiUrl = "@ViewBag.ApiUrl";
$("#ToolType").igCombo({
dataSource: apiUrl + '/tooltypes',
dataSource: '@Url.Content("~/api/tooltypes")',
responseDataKey: "Results",
textKey: "ToolTypeName",
valueKey: "ID",

@ -21,7 +21,7 @@
$(document).ready(function () {
initAwaitingDisposition("@ViewBag.ApiUrl");
initAwaitingDisposition("@Url.Content("~/api")");
});

@ -50,7 +50,7 @@
$(document).ready(function () {
initRunHeaders("@ViewBag.ApiUrl");
initRunHeaders("@Url.Content("~/api")");
});

@ -74,11 +74,17 @@
</div>
<div id="PinnedDiv">
<div style="padding-bottom: 20px;" id="PinnedGridDiv">
<table id="PinnedGrid"></table>
</div>
</div>
<script>
$(document).ready(function () {
initRunInfo("@ViewBag.ApiUrl", "@Model.ToolTypeID", "@Model.HeaderID", "@Model.HeaderAttachmentID");
initRunInfo("@Url.Content("~/api")", "@Model.ToolTypeID", "@Model.HeaderID", "@Model.HeaderAttachmentID");
});

@ -1,10 +1,5 @@
{
"xApiUrl": "http://messa010ec.ec.local:50301/api",
"ApiUrl": "http://localhost:5126/api",
"xxxApiUrl": "http://localhost:50301/api",
"xxxxApiUrl": "http://messa010ec.ec.local:50301/api",
"ConnectionString": "Data Source=MESSAD1001\\TEST1,59583;Integrated Security=True;Initial Catalog=Metrology;",
"xConnectionString": "Data Source=messv01ec.ec.local\\PROD1,53959;Integrated Security=True;Initial Catalog=Metrology;",
"IsDevelopment": true,
"xMockRoot": "/Data/Tests",
"MockRoot": "",

@ -2,7 +2,6 @@
"AllowedHosts": "*",
"ApiLoggingContentTypes": "application/json",
"ApiLoggingPathPrefixes": "/api/inbound",
"ApiUrl": "~/api",
"ApiLogPath": "D:\\Metrology\\MetrologyAPILogs",
"AttachmentPath": "\\\\messv02ecc1.ec.local\\EC_Metrology_Si\\MetrologyAttachments",
"BuildNumber": "1",

@ -121,19 +121,9 @@ function ConstructMessageDialog() {
' </div> ' +
' <div class="modal-body"> ' +
' <span id="spanMessageText"></span> ' +
' <table id="ModalHeaderGrid"></table> ' +
' <table id="ModalBodyGrid"></table> ' +
' <textarea type="text" value="Hello World" id="textareaClipboard" style="display:none"></textarea> ' +
' </div> ' +
' <div class="modal-footer"> ' +
' <div class="row" style="margin-top: 10px; margin-bottom: 20px;"> ' +
' <div class="col-xs-1"> ' +
' <button type="button" data-dismiss="modal" onclick="copy()">Copy</button> ' +
' </div> ' +
' <div class="col-xs-1"> ' +
' <button type="button" data-dismiss="modal">OK</button> ' +
' </div> ' +
' </div> ' +
' <button type="button" data-dismiss="modal">OK</button> ' +
' </div> ' +
' </div> ' +
'</div>';

@ -1,10 +1,8 @@
var _CdeId = null;
var _apiUrl = null;
var _BioRadId = null;
var _toolType = null;
var _initialHeaderId = null;
var _toolTypeMetaData = null;
var _initialHeaderAttachmentId = null;
var _initialHeaderId = null;
var _toolType = null;
var _toolTypeMetaData = null;
$(document).ready(function () {
if (location.pathname == "/") {
@ -69,15 +67,13 @@ function initExport(apiUrl, startTimeValue, endTimeValue) {
_apiUrl = apiUrl;
var endTime = new Date(endTimeValue);
var startTime = new Date(startTimeValue);
$.getJSON(_apiUrl + '/tooltypes', function (data) {
$("#ToolType").igCombo({
dataSource: data,
responseDataKey: "Results",
textKey: "ToolTypeName",
valueKey: "ID",
mode: "dropdown",
width: 150
});
$("#ToolType").igCombo({
dataSource: _apiUrl + '/tooltypes',
responseDataKey: "Results",
textKey: "ToolTypeName",
valueKey: "ID",
mode: "dropdown",
width: 150
});
$("#StartDateControl").igDatePicker({
dateInputFormat: "date",
@ -178,6 +174,19 @@ function loadRunInfoRunHeaders() {
function initRunHeaders(apiUrl) {
_apiUrl = apiUrl;
// $("#ToolType").igCombo({
// dataSource: _apiUrl + '/tooltypes',
// responseDataKey: "Results",
// textKey: "ToolTypeName",
// valueKey: "ID",
// mode: "dropdown",
// width: 150,
// dataBound: function (evt, ui) {
// $("#ToolType").igCombo("index", 0);
// loadHeaderGridRunHeaders();
// },
// selectionChanged: loadHeaderGridRunHeaders,
// });
loadHeaderGridRunHeaders();
$("#RefreshButton").click(function () {
$("#HeaderGrid").igGrid("dataBind");
@ -212,6 +221,31 @@ function loadHeaderGridRunInfo() {
DisplayWSMessage("error", "There was an error getting tooltype info.", e);
}
});
// $.ajax({
// type: "GET",
// url: _apiUrl + "/pin/" + toolTypeID + "/pinned",
// success: function (r) {
// if ((r.Results == null) || (r.Results.HeaderId == null))
// DisplayWSMessage("error", "B) There was an error getting pinned info.");
// else
// DisplayWSMessage("info", r.Results.HeaderId);
// },
// error: function (e) {
// DisplayWSMessage("error", "There was an error getting pinned info.", e);
// }
// });
$("#PinnedGrid").igGrid({
width: "70%",
height: "100%",
dataSource: _apiUrl + "/pin/" + toolTypeID + "/pinned",
responseDataKey: "Results",
tabIndex: 1,
features: [
{ name: "Selection", mode: "row", multipleSelection: false },
{ name: "Filtering", type: "local" },
{ name: "Sorting", type: "local" },
]
});
}
function disableHeaderButtonsRunInfo() {
@ -460,67 +494,17 @@ function reviewButtonRunInfo() {
}
function pinButtonRunInfo() {
var toolTypeId = $("#ToolTypeID").text();
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
if (selectedRow !== null) {
$("#PinButton").prop("disabled", true);
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
var stringified = JSON.stringify(rowData);
stringified = stringified.replace(/"Tool":/gm, '"MesEntity":');
stringified = stringified.replace(/"Equipment ID":/gm, '"MesEntity":');
var jsonObject = JSON.parse(stringified);
$.ajax({
type: "POST",
url: _apiUrl + '/pin/' + toolTypeId + "/markAsPinned",
data: jsonObject,
url: _apiUrl + "/pin/markAsPinned",
data: rowData,
success: function (e) {
DisplayWSMessage("info", "Marked as pinned", e);
// DisplayWSMessage("info", stringified, e);
$("#PinButton").prop("disabled", false);
$.getJSON(_apiUrl + '/pin/' + toolTypeId + "/pinned?biorad_id=" + _BioRadId + "&cde_id=" + _CdeId + "&rds=" + rowData.RDS, function (data) {
$("#ModalHeaderGrid").igGrid({
dataSource: data,
features: [
{ name: 'Resizing' }
],
columns: [
{ key: "ID", dataType: "number", hidden: true, },
{ key: "ToolTypeID", dataType: "number", hidden: true, },
{ headerText: "Tool", key: "MesEntity", dataType: "string", width: "10%" },
{ key: "Reactor", dataType: "string", width: "10%" },
{ key: "RDS", dataType: "string", width: "10%" },
{ key: "PSN", dataType: "string", width: "10%" },
{ key: "Layer", dataType: "string", width: "10%" },
{ key: "Zone", dataType: "string", width: "10%" }
],
responseDataKey: "Results",
});
var text = "";
for (var i = 0; i < data.Results.length; i++) {
text = text + data.Results[i].Point1 + "\t" + data.Results[i].Point2 + "\t" + data.Results[i].Point3 + "\t" + data.Results[i].Point4 + "\t" + data.Results[i].Point5 + "\t" + data.Results[i].Point6 + "\t" + data.Results[i].Point7 + "\t" + data.Results[i].Point8 + "\t" + data.Results[i].Point9 + "\r";
}
$("#textareaClipboard").val(text);
$("#ModalBodyGrid").igGrid({
dataSource: data,
features: [
{ name: 'Resizing' }
],
columns: [
{ key: "ID", dataType: "number", hidden: true, },
{ key: "ToolTypeID", dataType: "number", hidden: true, },
{ headerText: "Point 1", key: "Point1", dataType: "number", width: "10%" },
{ headerText: "Point 2", key: "Point2", dataType: "number", width: "10%" },
{ headerText: "Point 3", key: "Point3", dataType: "number", width: "10%" },
{ headerText: "Point 4", key: "Point4", dataType: "number", width: "10%" },
{ headerText: "Point 5", key: "Point5", dataType: "number", width: "10%" },
{ headerText: "Point 6", key: "Point6", dataType: "number", width: "10%" },
{ headerText: "Point 7", key: "Point7", dataType: "number", width: "10%" },
{ headerText: "Point 8", key: "Point8", dataType: "number", width: "10%" },
{ headerText: "Point 9", key: "Point9", dataType: "number", width: "10%" },
],
responseDataKey: "Results",
});
});
},
error: function (e, ajaxOptions, ex) {
DisplayWSMessage("error", "There was an error marking header as pinned.", e, ex);
@ -576,28 +560,18 @@ function initRunInfo(apiUrl, initialToolTypeID, initialHeaderId, initialHeaderAt
_apiUrl = apiUrl;
_initialHeaderId = initialHeaderId;
_initialHeaderAttachmentId = initialHeaderAttachmentId;
$.getJSON(_apiUrl + '/tooltypes', function (data) {
for (var i = 0; i < data.Results.length; i++) {
if (data.Results[i].ToolTypeName === "CDE") {
_CdeId = data.Results[i].ID;
}
else if (data.Results[i].ToolTypeName === "BioRad") {
_BioRadId = data.Results[i].ID;
}
}
$("#ToolType").igCombo({
dataSource: data,
responseDataKey: "Results",
textKey: "ToolTypeName",
valueKey: "ID",
mode: "dropdown",
width: 150,
itemsRendered: function (evt, ui) {
loadHeaderGridRunInfo();
},
selectionChanged: loadHeaderGridRunInfo,
initialSelectedItems: [{ value: initialToolTypeID }]
});
$("#ToolType").igCombo({
dataSource: _apiUrl + '/tooltypes',
responseDataKey: "Results",
textKey: "ToolTypeName",
valueKey: "ID",
mode: "dropdown",
width: 150,
itemsRendered: function (evt, ui) {
loadHeaderGridRunInfo();
},
selectionChanged: loadHeaderGridRunInfo,
initialSelectedItems: [{ value: initialToolTypeID }]
});
setInitialDateTimesRunInfo();
$("#HeaderGrid").on("dblclick", "tr", loadDetailsRunInfo);
@ -623,15 +597,4 @@ function triggerFileDownload(fileName, url) {
}
function initIndex() {
}
function copy() {
var copyText = document.getElementById("textareaClipboard");
// Select the text field
copyText.select();
copyText.setSelectionRange(0, 99999); // For mobile devices
// Copy the text inside the text field
navigator.clipboard.writeText(copyText.value);
}

@ -104,31 +104,3 @@ div.modal-content-warning {
.icon-bar {
background-color: black;
}
@media screen and (min-width: 1024px) {
.modal-dialog {
right: auto;
left: 50%;
width: 768px;
padding-top: 30px;
padding-bottom: 30px;
}
.modal-content {
-webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}
}
@media screen and (min-width: 1368px) {
.modal-dialog {
right: auto;
left: 50%;
width: 1280px;
padding-top: 30px;
padding-bottom: 30px;
}
.modal-content {
-webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}
}

@ -2,31 +2,15 @@
public class HeaderCommon
{
public long ID { get; set; }
public DateTime InsertDate { get; set; }
public Guid AttachmentID { get; set; }
public string? Title { get; set; }
public string? Recipe { get; set; }
public DateTime Date { get; set; }
public long ToolTypeID { get; set; }
public string? ToolTypeName { get; set; }
// [Newtonsoft.Json.JsonProperty("Tool")]
// [System.Text.Json.Serialization.JsonPropertyName("Tool")]
// public string? Tool { get; set; }
// [Newtonsoft.Json.JsonProperty("Equipment ID")]
// [System.Text.Json.Serialization.JsonPropertyName("Equipment ID")]
// public string? Equipment_ID { get; set; }
public string? MesEntity { get; set; }
public string? Employee { get; set; }
public string? Layer { get; set; }
public string? PSN { get; set; }
public string? RDS { get; set; }
public string? Reactor { get; set; }
public string? Recipe { get; set; }
public string? Zone { get; set; }
public string? RDS { get; set; }
public string? PSN { get; set; }
}

@ -3,15 +3,15 @@
public class Pinned : HeaderCommon
{
public string Point1 { get; set; }
public string Point2 { get; set; }
public string Point3 { get; set; }
public string Point4 { get; set; }
public string Point5 { get; set; }
public string Point6 { get; set; }
public string Point7 { get; set; }
public string Point8 { get; set; }
public string Point9 { get; set; }
public string PointA { get; set; }
public string PointB { get; set; }
public string PointC { get; set; }
public string PointD { get; set; }
public string PointE { get; set; }
public string PointF { get; set; }
public string PointG { get; set; }
public string PointH { get; set; }
public string PointI { get; set; }
public Pinned(HeaderCommon headerCommon, List<string> values)
{
@ -19,29 +19,22 @@ public class Pinned : HeaderCommon
InsertDate = headerCommon.InsertDate;
AttachmentID = headerCommon.AttachmentID;
Title = headerCommon.Title;
Recipe = headerCommon.Recipe;
Date = headerCommon.Date;
ToolTypeID = headerCommon.ToolTypeID;
ToolTypeName = headerCommon.ToolTypeName;
MesEntity = headerCommon.MesEntity;
Employee = headerCommon.Employee;
Layer = headerCommon.Layer;
PSN = headerCommon.PSN;
RDS = headerCommon.RDS;
Reactor = headerCommon.Reactor;
Recipe = headerCommon.Recipe;
Zone = headerCommon.Zone;
Point1 = values[0];
Point2 = values[1];
Point3 = values[2];
Point4 = values[3];
Point5 = values[4];
Point6 = values[5];
Point7 = values[6];
Point8 = values[7];
Point9 = values[8];
RDS = headerCommon.RDS;
PSN = headerCommon.PSN;
PointA = values[0];
PointB = values[1];
PointC = values[2];
PointD = values[3];
PointE = values[4];
PointF = values[5];
PointG = values[6];
PointH = values[7];
PointI = values[8];
}
}

@ -11,6 +11,5 @@ public interface IPinController<T>
static string GetRouteName() => nameof(IPinController<T>)[1..^10];
T MarkAsPinned(DataModels.HeaderCommon headerCommon);
T GetPinnedTable(int toolTypeId, string? biorad_id = null, string? cde_id = null, string? rds = null);
}

@ -5,7 +5,16 @@ namespace OI.Metrology.Shared.Models.Stateless;
public interface IPinRepository
{
Result<Pinned[]> GetPinnedTable(IMetrologyRepository metrologyRepository, int id, string? biorad_id, string? cde_id, string? rds);
void SetPinnedTable(HeaderCommon headerCommon);
enum ToolId
{
BioRad = 1,
CDE = 2,
Tencor = 3,
HgCV = 4,
Stratus = 5,
SP1 = 6,
}
Result<Pinned[]> GetPinnedTable(IMetrologyRepository metrologyRepository, int id, string? bioRad, string? cde);
}

@ -37,26 +37,30 @@ public class UnitTestPinController
}
[TestMethod]
public void GetPinnedTable()
public void GetHeaderTitles()
{
_Logger.Information("Starting Web Application");
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
IMetrologyRepository metrologyRepository = serviceProvider.GetRequiredService<IMetrologyRepository>();
IPinRepository pinRepository = serviceProvider.GetRequiredService<IPinRepository>();
Result<Pinned[]> result = pinRepository.GetPinnedTable(metrologyRepository, id: 1, cde_id: null, biorad_id: null, rds: null);
string? cde = System.Text.Json.JsonSerializer.Serialize(new HeaderCommon { ID = 196984, ToolTypeID = 2 });
string? bioRad = System.Text.Json.JsonSerializer.Serialize(new HeaderCommon { ID = 321568, ToolTypeID = 1 });
Result<Pinned[]> result = pinRepository.GetPinnedTable(metrologyRepository, id: 1, bioRad, cde);
Assert.IsNotNull(result?.Results);
Assert.IsTrue(result.Results.Any());
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public async Task GetPinnedTableApi()
public async Task GetHeaderTitlesApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/-1/pinned");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetPinnedTableApi)}.json"), json);
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/-1/headertitles");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetHeaderTitlesApi)}.json"), json);
Result<Pinned[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<Pinned[]>>(json);
Assert.IsNotNull(result?.Results);
Assert.IsTrue(result.Results.Any());
_Logger.Information($"{_TestContext?.TestName} completed");
}

@ -76,15 +76,11 @@ steps:
- script: '"C:\program files\dotnet\dotnet.exe" build --configuration $(Configuration) --source $(NugetSource)'
workingDirectory: Server
displayName: "Core Build - Server"
- powershell: Get-ChildItem .\ -include TestResults -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }
workingDirectory: "$(System.DefaultWorkingDirectory)/.vscode"
displayName: 'PowerShell Script'
- script: "dotnet test --configuration $(Configuration)"
workingDirectory: Tests
displayName: "Core Test"
# enabled: false
enabled: false
- script: '"C:\program files\dotnet\dotnet.exe" tool restore'
workingDirectory: Server
@ -96,22 +92,6 @@ steps:
displayName: "Report Generator"
enabled: false
- task: PublishTestResults@2
displayName: "Publish Test Results **/*.trx"
inputs:
testResultsFormat: VSTest
testResultsFiles: "**/*.trx"
searchFolder: "$(System.DefaultWorkingDirectory)/.vscode"
- task: mspremier.CreateWorkItem.CreateWorkItem-task.CreateWorkItem@1
displayName: "Create work item"
inputs:
teamProject: "Mesa_FI"
workItemType: Bug
title: $(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)
assignedTo: "$(Build.RequestedForId)"
enabled: false
- script: '"C:\program files\dotnet\dotnet.exe" publish --configuration $(Configuration) --runtime win-x64 --self-contained -o $(Build.ArtifactStagingDirectory)\Server --source $(NugetSource)'
workingDirectory: Server
displayName: "Core Publish"