OpenInsightApplicationProgrammingInterface

This commit is contained in:
Mike Phares 2023-07-27 16:22:23 -07:00
parent 9717fcb3bf
commit f54b93c0d6
7 changed files with 107 additions and 49 deletions

View File

@ -6,43 +6,101 @@ trigger:
include:
- "Server/*"
pool:
name: Mesa-Linux
demands: Barcode-Host
variables:
BuildConfiguration: "Release"
NugetSource: "https://eaf-prod.mes.infineon.com/v3/index.json"
steps:
- script: |
echo $(Build.BuildId)
echo $(Build.Reason)
echo $(Build.Repository.Id)
echo $(Build.Repository.Name)
echo $(Build.SourceVersion)
displayName: "Echo Check"
stages:
- stage: Unity4
displayName: Unity4
pool:
name: Mesa-Linux
demands: Barcode-Host-Unity4
jobs:
- job: Unity4
steps:
- script: |
echo $(Build.BuildId)
echo $(Build.Reason)
echo $(Build.Repository.Id)
echo $(Build.Repository.Name)
echo $(Build.SourceVersion)
displayName: "Echo Check"
- script: "dotnet nuget locals all --clear"
displayName: "Nuget Clear"
enabled: false
- script: "dotnet nuget locals all --clear"
displayName: "Nuget Clear"
enabled: false
- script: |
dotnet user-secrets init
dotnet user-secrets set "BuildNumber" "$(Build.BuildId)"
dotnet user-secrets set "BuildSourceVersion" "$(Build.SourceVersion)"
dotnet user-secrets list
workingDirectory: Server
displayName: "Safe storage of app secrets - Server"
- script: |
dotnet user-secrets init
dotnet user-secrets set "BuildNumber" "$(Build.BuildId)"
dotnet user-secrets set "BuildSourceVersion" "$(Build.SourceVersion)"
dotnet user-secrets list
workingDirectory: Server
displayName: "Safe storage of app secrets - Server"
- script: "dotnet build --configuration Release --source https://eaf-prod.mes.infineon.com/v3/index.json"
workingDirectory: Server
displayName: "Core Build - Server"
- script: "dotnet build --configuration $(BuildConfiguration) --source $(NugetSource)"
workingDirectory: Server
displayName: "Core Build - Server"
- script: "systemctl stop barcode-host.service"
displayName: "stop barcode-host service"
enabled: false
- script: "systemctl stop barcode-host.service"
displayName: "stop barcode-host service"
enabled: false
- script: "dotnet publish --configuration Release --output ~/Barcode-Host-$(Build.SourceVersion)-$(Build.BuildId)-Release --source https://eaf-prod.mes.infineon.com/v3/index.json"
workingDirectory: Server
displayName: "Core Publish - Server"
- script: "dotnet publish --configuration $(BuildConfiguration) --output ~/Barcode-Host-$(Build.SourceVersion)-$(Build.BuildId)-$(BuildConfiguration)/Server --source $(NugetSource)"
workingDirectory: Server
displayName: "Core Publish - Server"
- script: "systemctl start barcode-host.service"
displayName: "start barcode-host service"
enabled: false
- script: "systemctl start barcode-host.service"
displayName: "start barcode-host service"
enabled: false
- script: "echo ln -s /home/$USER/Barcode-Host-$(Build.SourceVersion)-$(Build.BuildId)-$(BuildConfiguration)/Server /var/www/Barcode-Host/Server"
displayName: "Echo Symbolic Link Command"
- stage: Unity5
displayName: Unity5
pool:
name: Mesa-Linux
demands: Barcode-Host-Unity5
jobs:
- job: Unity5
steps:
- script: |
echo $(Build.BuildId)
echo $(Build.Reason)
echo $(Build.Repository.Id)
echo $(Build.Repository.Name)
echo $(Build.SourceVersion)
displayName: "Echo Check"
- script: "dotnet nuget locals all --clear"
displayName: "Nuget Clear"
enabled: false
- script: |
dotnet user-secrets init
dotnet user-secrets set "BuildNumber" "$(Build.BuildId)"
dotnet user-secrets set "BuildSourceVersion" "$(Build.SourceVersion)"
dotnet user-secrets list
workingDirectory: Server
displayName: "Safe storage of app secrets - Server"
- script: "dotnet build --configuration $(BuildConfiguration) --source $(NugetSource)"
workingDirectory: Server
displayName: "Core Build - Server"
- script: "systemctl stop barcode-host.service"
displayName: "stop barcode-host service"
enabled: false
- script: "dotnet publish --configuration $(BuildConfiguration) --output ~/Barcode-Host-$(Build.SourceVersion)-$(Build.BuildId)-$(BuildConfiguration)/Server --source $(NugetSource)"
workingDirectory: Server
displayName: "Core Publish - Server"
- script: "systemctl start barcode-host.service"
displayName: "start barcode-host service"
enabled: false
- script: "echo ln -s /home/$USER/Barcode-Host-$(Build.SourceVersion)-$(Build.BuildId)-$(BuildConfiguration)/Server /var/www/Barcode-Host/Server"
displayName: "Echo Symbolic Link Command"

View File

@ -18,6 +18,7 @@ public record AppSettings(string BuildNumber,
string MonAResource,
string MonASite,
int NotifyMinimum,
string OpenInsightApplicationProgrammingInterface,
string PostTo,
int PostToEvery,
string RootPassword,

View File

@ -24,6 +24,7 @@ public class AppSettings
[Display(Name = "MonA Resource"), Required] public string MonAResource { get; set; }
[Display(Name = "MonA Site"), Required] public string MonASite { get; set; }
[Display(Name = "Notify Minimum"), Required] public int? NotifyMinimum { get; set; }
[Display(Name = "OpenInsight Application Programming Interface"), Required] public string OpenInsightApplicationProgrammingInterface { get; set; }
[Display(Name = "PostTo"), Required] public string PostTo { get; set; }
[Display(Name = "Post to Every"), Required] public int? PostToEvery { get; set; }
[Display(Name = "RootPassword"), Required] public string RootPassword { get; set; }
@ -48,6 +49,8 @@ public class AppSettings
throw new NullReferenceException(nameof(appSettings));
if (appSettings.BuildNumber is null)
throw new NullReferenceException(nameof(BuildNumber));
if (appSettings.BuildSourceVersion is null)
throw new NullReferenceException(nameof(BuildSourceVersion));
if (appSettings.ClearLastScanServiceAfter is null)
throw new NullReferenceException(nameof(ClearLastScanServiceAfter));
if (appSettings.Company is null)
@ -62,8 +65,6 @@ public class AppSettings
throw new NullReferenceException(nameof(ExpectedScanLengthB));
if (appSettings.FileShare is null)
throw new NullReferenceException(nameof(FileShare));
if (appSettings.BuildSourceVersion is null)
throw new NullReferenceException(nameof(BuildSourceVersion));
if (appSettings.IsDevelopment is null)
throw new NullReferenceException(nameof(IsDevelopment));
if (appSettings.IsStaging is null)
@ -78,6 +79,8 @@ public class AppSettings
throw new NullReferenceException(nameof(MonASite));
if (appSettings.NotifyMinimum is null)
throw new NullReferenceException(nameof(NotifyMinimum));
if (appSettings.OpenInsightApplicationProgrammingInterface is null)
throw new NullReferenceException(nameof(OpenInsightApplicationProgrammingInterface));
if (appSettings.PostTo is null)
throw new NullReferenceException(nameof(PostTo));
if (appSettings.PostToEvery is null)
@ -111,6 +114,7 @@ public class AppSettings
appSettings.MonAResource,
appSettings.MonASite,
appSettings.NotifyMinimum.Value,
appSettings.OpenInsightApplicationProgrammingInterface,
appSettings.PostTo,
appSettings.PostToEvery.Value,
appSettings.RootPassword,

View File

@ -50,10 +50,9 @@
</div>
</div>
<script>
var appSettings = JSON.parse('@(System.Text.Json.JsonSerializer.Serialize(this.Model.AppSettings))');
var appSettings = JSON.parse('@(Html.Raw(System.Text.Json.JsonSerializer.Serialize(this.Model.AppSettings)))');
console.log(appSettings.BuildSourceVersion);
console.log(appSettings.BuildNumber);
console.log(appSettings);
</script>
<script src="~/js/signalr/dist/browser/signalr.js?dateTime=2023-07-26---12-08-00"></script>
<script src="~/js/notification.js?dateTime=2023-07-26---12-08-00"></script>

View File

@ -7,13 +7,9 @@ public class NotificationModel : PageModel
{
public AppSettings AppSettings { get; }
private readonly ILogger<NotificationModel> _Logger;
public NotificationModel(ILogger<NotificationModel> logger, AppSettings appSettings)
{
_Logger = logger;
public NotificationModel(AppSettings appSettings) =>
AppSettings = appSettings;
}
public void OnGet()
{

View File

@ -1,5 +1,6 @@
{
"BuildNumber": "1",
"BuildSourceVersion": "1234567",
"Company": "Infineon Technologies Americas Corp.",
"ClearLastScanServiceAfter": 250,
"DeviceNameEndsWith": "Symbol Bar Code Scanner",
@ -8,7 +9,6 @@
"ExpectedScanLengthB": 14,
"ExpectedScanLengthBExample": "1TO172125.1.11",
"FileShare": "",
"GitCommitSeven": "1234567",
"LinuxDevicePath": "/proc/bus/input/devices",
"Logging": {
"LogLevel": {
@ -24,6 +24,7 @@
"MockRoot": "",
"MonAResource": "OI_Metrology_Viewer_EC",
"MonASite": "auc",
"OpenInsightApplicationProgrammingInterface": "https://oi-prod-ec-api.mes.infineon.com/api/oiWizard",
"PostTo": "",
"PostToEvery": 1000,
"SerialPortName": "/dev/ttyUSB0",

View File

@ -1,5 +1,7 @@
"use strict";
console.log(appSettings.OpenInsightApplicationProgrammingInterface);
var connection = new signalR.HubConnectionBuilder()
.withUrl("/NotificationHub")
.build();
@ -35,12 +37,9 @@ connection.on("NotifyAll", function (data) {
if (postResult.Recipe != "Recipe") {
document.getElementById("recipe").innerText = postResult.Recipe;
} else {
$.getJSON(
"https://oi-prod-ec-api.mes.infineon.com/api/oiWizard/materials/rds/" +
postResult.LotName,
$.getJSON(appSettings.OpenInsightApplicationProgrammingInterface + "/materials/rds/" + postResult.LotName,
function (data) {
document.getElementById("recipe").innerText =
data.rds.rdsLayers.length;
document.getElementById("recipe").innerText = data.rds.rdsLayers.length;
},
);
}
@ -50,7 +49,7 @@ connection.on("NotifyAll", function (data) {
connection
.start()
.then(function () {})
.then(function () { })
.catch(function (err) {
return console.error(err.toString());
});