8 Commits

Author SHA1 Message Date
b7447b207f Test Dev Pipeline 2023-02-16 15:12:33 -07:00
1e1d4803b2 Ready to demo 2023-02-16 14:28:03 -07:00
1e7f70c6c4 launchSettings 2023-02-16 10:11:41 -07:00
2e416ce8ab Test on ec server 2023-02-16 10:01:48 -07:00
45ea70212e rowData isn't HeaderCommon 2023-02-10 10:25:38 -07:00
2481c2b3ff Removed HttpContext.Session 2023-02-09 22:58:49 -07:00
4514678556 Test Pinned via API || 2023-02-08 13:11:11 -07:00
8e471e278e Test Pinned via API 2023-02-08 10:53:51 -07:00
33 changed files with 431 additions and 198 deletions

2
.gitignore vendored
View File

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

5
.vscode/launch.json vendored
View File

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

2
.vscode/tasks.json vendored
View File

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

View File

@ -0,0 +1,25 @@
{
"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"
}
}
}
}

View File

@ -0,0 +1,22 @@
{
"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"
}
}
}
}

View File

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

0
Server/.vscode/settings.json vendored Normal file
View File

View File

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

View File

@ -9,36 +9,25 @@ using System.Text.Json;
public class PinController : Controller, IPinController<IActionResult> public class PinController : Controller, IPinController<IActionResult>
{ {
private readonly ILogger _Logger;
private readonly IPinRepository _PinRepository; private readonly IPinRepository _PinRepository;
private readonly IMetrologyRepository _MetrologyRepository; private readonly IMetrologyRepository _MetrologyRepository;
public PinController(ILogger<InboundController> logger, IMetrologyRepository metrologyRepository, IPinRepository pinRepository) public PinController(ILogger<InboundController> logger, IMetrologyRepository metrologyRepository, IPinRepository pinRepository)
{ {
_Logger = logger;
_MetrologyRepository = metrologyRepository; _MetrologyRepository = metrologyRepository;
_PinRepository = pinRepository; _PinRepository = pinRepository;
} }
[HttpPost("/api/pin/markAsPinned")] [HttpPost("{toolTypeId}/markAsPinned")]
public IActionResult MarkAsPinned(Shared.DataModels.HeaderCommon headerCommon) public IActionResult MarkAsPinned(Shared.DataModels.HeaderCommon headerCommon)
{ {
string toolTypeId = headerCommon.ToolTypeID.ToString(); _PinRepository.SetPinnedTable(headerCommon);
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(); return Ok();
} }
[HttpGet] [HttpGet]
[Route("{id}/pinned")] [Route("{toolTypeId}/pinned")]
public IActionResult GetPinnedTable(int id) 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 });
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 });
}
} }

View File

@ -11,6 +11,8 @@ namespace OI.Metrology.Server.Controllers;
public class ExportController : Controller public class ExportController : Controller
{ {
private readonly string _ApiUrl;
private readonly ILogger _Logger; private readonly ILogger _Logger;
private readonly bool _IsTestDatabase; private readonly bool _IsTestDatabase;
private readonly AppSettings _AppSettings; private readonly AppSettings _AppSettings;
@ -22,6 +24,7 @@ public class ExportController : Controller
_AppSettings = appSettings; _AppSettings = appSettings;
_MetrologyRepository = metrologyRepository; _MetrologyRepository = metrologyRepository;
_IsTestDatabase = appSettings.ConnectionString.Contains("test", StringComparison.InvariantCultureIgnoreCase); _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) public override void OnActionExecuted(ActionExecutedContext context)
@ -41,6 +44,7 @@ public class ExportController : Controller
}; };
MonIn monIn = MonIn.GetInstance(); MonIn monIn = MonIn.GetInstance();
_ = monIn.SendStatus(_AppSettings.MonASite, _AppSettings.MonAResource, "Heartbeat", State.Up); _ = monIn.SendStatus(_AppSettings.MonASite, _AppSettings.MonAResource, "Heartbeat", State.Up);
ViewBag.ApiUrl = _ApiUrl;
return View(model); return View(model);
} }
@ -81,6 +85,7 @@ public class ExportController : Controller
_ = monIn.SendStatus(_AppSettings.MonASite, _AppSettings.MonAResource, "Heartbeat", State.Warning); _ = monIn.SendStatus(_AppSettings.MonASite, _AppSettings.MonAResource, "Heartbeat", State.Warning);
} }
} }
ViewBag.ApiUrl = _ApiUrl;
return View("Index", model); return View("Index", model);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,31 @@
{
"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"
}
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,10 @@
{ {
"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;", "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, "IsDevelopment": true,
"xMockRoot": "/Data/Tests", "xMockRoot": "/Data/Tests",
"MockRoot": "", "MockRoot": "",

View File

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

View File

@ -121,9 +121,19 @@ function ConstructMessageDialog() {
' </div> ' + ' </div> ' +
' <div class="modal-body"> ' + ' <div class="modal-body"> ' +
' <span id="spanMessageText"></span> ' + ' <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> ' +
' <div class="modal-footer"> ' + ' <div class="modal-footer"> ' +
' <button type="button" data-dismiss="modal">OK</button> ' + ' <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> ' +
' </div> ' + ' </div> ' +
' </div> ' + ' </div> ' +
'</div>'; '</div>';

View File

@ -1,8 +1,10 @@
var _CdeId = null;
var _apiUrl = null; var _apiUrl = null;
var _initialHeaderAttachmentId = null; var _BioRadId = null;
var _initialHeaderId = null;
var _toolType = null; var _toolType = null;
var _initialHeaderId = null;
var _toolTypeMetaData = null; var _toolTypeMetaData = null;
var _initialHeaderAttachmentId = null;
$(document).ready(function () { $(document).ready(function () {
if (location.pathname == "/") { if (location.pathname == "/") {
@ -67,13 +69,15 @@ function initExport(apiUrl, startTimeValue, endTimeValue) {
_apiUrl = apiUrl; _apiUrl = apiUrl;
var endTime = new Date(endTimeValue); var endTime = new Date(endTimeValue);
var startTime = new Date(startTimeValue); var startTime = new Date(startTimeValue);
$("#ToolType").igCombo({ $.getJSON(_apiUrl + '/tooltypes', function (data) {
dataSource: _apiUrl + '/tooltypes', $("#ToolType").igCombo({
responseDataKey: "Results", dataSource: data,
textKey: "ToolTypeName", responseDataKey: "Results",
valueKey: "ID", textKey: "ToolTypeName",
mode: "dropdown", valueKey: "ID",
width: 150 mode: "dropdown",
width: 150
});
}); });
$("#StartDateControl").igDatePicker({ $("#StartDateControl").igDatePicker({
dateInputFormat: "date", dateInputFormat: "date",
@ -174,19 +178,6 @@ function loadRunInfoRunHeaders() {
function initRunHeaders(apiUrl) { function initRunHeaders(apiUrl) {
_apiUrl = 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(); loadHeaderGridRunHeaders();
$("#RefreshButton").click(function () { $("#RefreshButton").click(function () {
$("#HeaderGrid").igGrid("dataBind"); $("#HeaderGrid").igGrid("dataBind");
@ -221,31 +212,6 @@ function loadHeaderGridRunInfo() {
DisplayWSMessage("error", "There was an error getting tooltype info.", e); 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() { function disableHeaderButtonsRunInfo() {
@ -494,17 +460,67 @@ function reviewButtonRunInfo() {
} }
function pinButtonRunInfo() { function pinButtonRunInfo() {
var toolTypeId = $("#ToolTypeID").text();
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow(); var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
if (selectedRow !== null) { if (selectedRow !== null) {
$("#PinButton").prop("disabled", true); $("#PinButton").prop("disabled", true);
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index]; 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({ $.ajax({
type: "POST", type: "POST",
url: _apiUrl + "/pin/markAsPinned", url: _apiUrl + '/pin/' + toolTypeId + "/markAsPinned",
data: rowData, data: jsonObject,
success: function (e) { success: function (e) {
DisplayWSMessage("info", "Marked as pinned", e); DisplayWSMessage("info", "Marked as pinned", e);
// DisplayWSMessage("info", stringified, e);
$("#PinButton").prop("disabled", false); $("#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) { error: function (e, ajaxOptions, ex) {
DisplayWSMessage("error", "There was an error marking header as pinned.", e, ex); DisplayWSMessage("error", "There was an error marking header as pinned.", e, ex);
@ -560,18 +576,28 @@ function initRunInfo(apiUrl, initialToolTypeID, initialHeaderId, initialHeaderAt
_apiUrl = apiUrl; _apiUrl = apiUrl;
_initialHeaderId = initialHeaderId; _initialHeaderId = initialHeaderId;
_initialHeaderAttachmentId = initialHeaderAttachmentId; _initialHeaderAttachmentId = initialHeaderAttachmentId;
$("#ToolType").igCombo({ $.getJSON(_apiUrl + '/tooltypes', function (data) {
dataSource: _apiUrl + '/tooltypes', for (var i = 0; i < data.Results.length; i++) {
responseDataKey: "Results", if (data.Results[i].ToolTypeName === "CDE") {
textKey: "ToolTypeName", _CdeId = data.Results[i].ID;
valueKey: "ID", }
mode: "dropdown", else if (data.Results[i].ToolTypeName === "BioRad") {
width: 150, _BioRadId = data.Results[i].ID;
itemsRendered: function (evt, ui) { }
loadHeaderGridRunInfo(); }
}, $("#ToolType").igCombo({
selectionChanged: loadHeaderGridRunInfo, dataSource: data,
initialSelectedItems: [{ value: initialToolTypeID }] responseDataKey: "Results",
textKey: "ToolTypeName",
valueKey: "ID",
mode: "dropdown",
width: 150,
itemsRendered: function (evt, ui) {
loadHeaderGridRunInfo();
},
selectionChanged: loadHeaderGridRunInfo,
initialSelectedItems: [{ value: initialToolTypeID }]
});
}); });
setInitialDateTimesRunInfo(); setInitialDateTimesRunInfo();
$("#HeaderGrid").on("dblclick", "tr", loadDetailsRunInfo); $("#HeaderGrid").on("dblclick", "tr", loadDetailsRunInfo);
@ -598,3 +624,14 @@ function triggerFileDownload(fileName, url) {
function initIndex() { 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);
}

View File

@ -104,3 +104,31 @@ div.modal-content-warning {
.icon-bar { .icon-bar {
background-color: black; 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);
}
}

View File

@ -2,15 +2,31 @@
public class HeaderCommon public class HeaderCommon
{ {
public long ID { get; set; } public long ID { get; set; }
public DateTime InsertDate { get; set; } public DateTime InsertDate { get; set; }
public Guid AttachmentID { get; set; } public Guid AttachmentID { get; set; }
public string? Title { get; set; } public string? Title { get; set; }
public string? Recipe { get; set; }
public DateTime Date { get; set; } public DateTime Date { get; set; }
public long ToolTypeID { get; set; } public long ToolTypeID { get; set; }
public string? ToolTypeName { get; set; } public string? ToolTypeName { get; set; }
public string? Reactor { get; set; }
public string? RDS { 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? PSN { get; set; }
public string? RDS { get; set; }
public string? Reactor { get; set; }
public string? Recipe { get; set; }
public string? Zone { get; set; }
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -77,10 +77,14 @@ steps:
workingDirectory: Server workingDirectory: Server
displayName: "Core Build - 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)" - script: "dotnet test --configuration $(Configuration)"
workingDirectory: Tests workingDirectory: Tests
displayName: "Core Test" displayName: "Core Test"
enabled: false # enabled: false
- script: '"C:\program files\dotnet\dotnet.exe" tool restore' - script: '"C:\program files\dotnet\dotnet.exe" tool restore'
workingDirectory: Server workingDirectory: Server
@ -92,6 +96,22 @@ steps:
displayName: "Report Generator" displayName: "Report Generator"
enabled: false 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)' - script: '"C:\program files\dotnet\dotnet.exe" publish --configuration $(Configuration) --runtime win-x64 --self-contained -o $(Build.ArtifactStagingDirectory)\Server --source $(NugetSource)'
workingDirectory: Server workingDirectory: Server
displayName: "Core Publish" displayName: "Core Publish"