diff --git a/Barcode-Host.yml b/Barcode-Host.yml index 937f3ce..ee26218 100644 --- a/Barcode-Host.yml +++ b/Barcode-Host.yml @@ -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" diff --git a/Server/Models/AppSettings.cs b/Server/Models/AppSettings.cs index 8a2e808..17046cd 100644 --- a/Server/Models/AppSettings.cs +++ b/Server/Models/AppSettings.cs @@ -18,6 +18,7 @@ public record AppSettings(string BuildNumber, string MonAResource, string MonASite, int NotifyMinimum, + string OpenInsightApplicationProgrammingInterface, string PostTo, int PostToEvery, string RootPassword, diff --git a/Server/Models/Binder/AppSettings.cs b/Server/Models/Binder/AppSettings.cs index 86bafb8..43edf21 100644 --- a/Server/Models/Binder/AppSettings.cs +++ b/Server/Models/Binder/AppSettings.cs @@ -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, diff --git a/Server/Pages/Notification.cshtml b/Server/Pages/Notification.cshtml index ffa9fa3..e4198d2 100644 --- a/Server/Pages/Notification.cshtml +++ b/Server/Pages/Notification.cshtml @@ -50,10 +50,9 @@ \ No newline at end of file diff --git a/Server/Pages/Notification.cshtml.cs b/Server/Pages/Notification.cshtml.cs index 93bd69b..82e8c86 100644 --- a/Server/Pages/Notification.cshtml.cs +++ b/Server/Pages/Notification.cshtml.cs @@ -7,13 +7,9 @@ public class NotificationModel : PageModel { public AppSettings AppSettings { get; } - private readonly ILogger _Logger; - public NotificationModel(ILogger logger, AppSettings appSettings) - { - _Logger = logger; + public NotificationModel(AppSettings appSettings) => AppSettings = appSettings; - } public void OnGet() { diff --git a/Server/appsettings.json b/Server/appsettings.json index 1e8b44e..fd4d2b9 100644 --- a/Server/appsettings.json +++ b/Server/appsettings.json @@ -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", diff --git a/Server/wwwroot/js/notification.js b/Server/wwwroot/js/notification.js index 3d0a085..07e9a50 100644 --- a/Server/wwwroot/js/notification.js +++ b/Server/wwwroot/js/notification.js @@ -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()); });