From 03b04484cd1e2fcf5b146bd41a99027ad84ad9cc Mon Sep 17 00:00:00 2001 From: AnjuJose011 <154979799+AnjuJose011@users.noreply.github.com> Date: Fri, 8 Nov 2024 12:45:40 +0000 Subject: [PATCH 1/3] fixes-VersionNumber --- .../LearningHub.Nhs.AdminUI.csproj | 1253 +++++++++-------- .../ServiceCollectionExtension.cs | 1 + .../Services/VersionService.cs | 18 + .../ViewComponents/VersionViewComponent.cs | 34 + .../Views/Shared/_Layout.cshtml | 145 +- .../LearningHub.Nhs.WebUI.csproj | 145 +- .../ServiceCollectionExtension.cs | 2 + .../Services/VersionService.cs | 18 + .../ViewComponents/VersionViewComponent.cs | 34 + .../Shared/Tenant/LearningHub/_Layout.cshtml | 2 + .../LearningHub.Nhs.ReportApi.csproj | 89 +- .../ServiceCollectionExtension.cs | 6 +- .../LearningHub.Nhs.Api.csproj | 125 +- .../ServiceCollectionExtension.cs | 7 +- 14 files changed, 1008 insertions(+), 871 deletions(-) create mode 100644 AdminUI/LearningHub.Nhs.AdminUI/Services/VersionService.cs create mode 100644 AdminUI/LearningHub.Nhs.AdminUI/ViewComponents/VersionViewComponent.cs create mode 100644 LearningHub.Nhs.WebUI/Services/VersionService.cs create mode 100644 LearningHub.Nhs.WebUI/ViewComponents/VersionViewComponent.cs diff --git a/AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj b/AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj index f10d8aaab..b48d2837d 100644 --- a/AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj +++ b/AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj @@ -1,642 +1,649 @@ - - net6.0 - 31abd8b9-4223-4ff3-896b-a46530c9e15c - /subscriptions/57c55d5f-78c1-4373-a021-ff8357548f51/resourceGroups/LearningHubNhsUk-AdminUI-Prod-RG/providers/microsoft.insights/components/LearningHubNhsUk-AdminUI-Prod - true - true - x64 - + + net6.0 + 1.0.0.0 + 1.0.0.0 + 1.0.0 + 31abd8b9-4223-4ff3-896b-a46530c9e15c + /subscriptions/57c55d5f-78c1-4373-a021-ff8357548f51/resourceGroups/LearningHubNhsUk-AdminUI-Prod-RG/providers/microsoft.insights/components/LearningHubNhsUk-AdminUI-Prod + true + true + x64 + - - - - - - + + + + + + - - - - - - - - - - - - - + + + + - - <_ContentIncludedByDefault Remove="bundleconfig.json" /> - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + <_ContentIncludedByDefault Remove="bundleconfig.json" /> + - - - - - - - - - - - - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - Always - - + + + Always + + + + + + + + + - - diff --git a/AdminUI/LearningHub.Nhs.AdminUI/ServiceCollectionExtension.cs b/AdminUI/LearningHub.Nhs.AdminUI/ServiceCollectionExtension.cs index 5517fa636..99e425d86 100644 --- a/AdminUI/LearningHub.Nhs.AdminUI/ServiceCollectionExtension.cs +++ b/AdminUI/LearningHub.Nhs.AdminUI/ServiceCollectionExtension.cs @@ -141,6 +141,7 @@ public static void ConfigureServices(this IServiceCollection services, IConfigur services.AddTransient(); services.AddSingleton(); + services.AddSingleton(); services.AddAuthentication(options => { diff --git a/AdminUI/LearningHub.Nhs.AdminUI/Services/VersionService.cs b/AdminUI/LearningHub.Nhs.AdminUI/Services/VersionService.cs new file mode 100644 index 000000000..45361c052 --- /dev/null +++ b/AdminUI/LearningHub.Nhs.AdminUI/Services/VersionService.cs @@ -0,0 +1,18 @@ +namespace LearningHub.Nhs.AdminUI.Services +{ + /// + /// Defines the . + /// + public class VersionService + { + /// + /// The GetVersion. + /// + /// The . + public string GetVersion() + { + var version = typeof(Program).Assembly.GetName().Version; + return $"{version?.Major}.{version?.Minor}.{version?.Build}"; + } + } +} diff --git a/AdminUI/LearningHub.Nhs.AdminUI/ViewComponents/VersionViewComponent.cs b/AdminUI/LearningHub.Nhs.AdminUI/ViewComponents/VersionViewComponent.cs new file mode 100644 index 000000000..db857b6ce --- /dev/null +++ b/AdminUI/LearningHub.Nhs.AdminUI/ViewComponents/VersionViewComponent.cs @@ -0,0 +1,34 @@ +namespace LearningHub.Nhs.AdminUI.ViewComponents +{ + using LearningHub.Nhs.AdminUI.Services; + using Microsoft.AspNetCore.Html; + using Microsoft.AspNetCore.Mvc; + using Microsoft.AspNetCore.Mvc.ViewComponents; + + /// + /// Initializes a new instance of the class. + /// + public class VersionViewComponent : ViewComponent + { + private readonly VersionService versionService; + + /// + /// Initializes a new instance of the class. + /// + /// . + public VersionViewComponent(VersionService versionService) + { + this.versionService = versionService; + } + + /// + /// The Invoke. + /// + /// A representing the result of the synchronous operation. + public IViewComponentResult Invoke() + { + var version = this.versionService.GetVersion(); + return new HtmlContentViewComponentResult(new HtmlString($"")); + } + } +} diff --git a/AdminUI/LearningHub.Nhs.AdminUI/Views/Shared/_Layout.cshtml b/AdminUI/LearningHub.Nhs.AdminUI/Views/Shared/_Layout.cshtml index 3f972659a..e591bf6b5 100644 --- a/AdminUI/LearningHub.Nhs.AdminUI/Views/Shared/_Layout.cshtml +++ b/AdminUI/LearningHub.Nhs.AdminUI/Views/Shared/_Layout.cshtml @@ -2,83 +2,84 @@ - - - @ViewData["Title"] - Learning Hub Administration - - - + + + @ViewData["Title"] - Learning Hub Administration + + + - + - - - - - - - - - - @RenderSection("Styles", required: false) - @await Html.PartialAsync("_GoogleAnalytics") - + + + + + + + + + + @RenderSection("Styles", required: false) + @await Html.PartialAsync("_GoogleAnalytics") + - - - - - - - @{ - var mainWidth = IsSectionDefined("SideMenu") ? "col-sm-9 col-lg-9 col-xl-10 pageWithMenu" : "col-sm-12"; - } - - @if (IsSectionDefined("SideMenu")) - { - - @RenderSection("SideMenu", required: false) - - } - - @RenderBody() - - - - - + + + + + + + @{ + var mainWidth = IsSectionDefined("SideMenu") ? "col-sm-9 col-lg-9 col-xl-10 pageWithMenu" : "col-sm-12"; + } + + @if (IsSectionDefined("SideMenu")) + { + + @RenderSection("SideMenu", required: false) + + } + + @RenderBody() + + + + + - - - - - - - - - - @**@ - - @**@ - - @RenderSection("Scripts", required: false) + + + + + + + + + + @**@ + + @**@ + + @RenderSection("Scripts", required: false) +@await Component.InvokeAsync("Version") \ No newline at end of file diff --git a/LearningHub.Nhs.WebUI/LearningHub.Nhs.WebUI.csproj b/LearningHub.Nhs.WebUI/LearningHub.Nhs.WebUI.csproj index aff1954b5..6f31cc500 100644 --- a/LearningHub.Nhs.WebUI/LearningHub.Nhs.WebUI.csproj +++ b/LearningHub.Nhs.WebUI/LearningHub.Nhs.WebUI.csproj @@ -2,11 +2,14 @@ net6.0 - InProcess + 1.0.0.0 + 1.0.0.0 + 1.0.0 + InProcess a2ecb5d2-cf13-4551-9cb6-3d86dfbcf8ef true true - x64 + x64 true @@ -104,7 +107,7 @@ - + @@ -175,72 +178,76 @@ - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + - + + + + + diff --git a/LearningHub.Nhs.WebUI/ServiceCollectionExtension.cs b/LearningHub.Nhs.WebUI/ServiceCollectionExtension.cs index dad5f5001..f38503701 100644 --- a/LearningHub.Nhs.WebUI/ServiceCollectionExtension.cs +++ b/LearningHub.Nhs.WebUI/ServiceCollectionExtension.cs @@ -10,6 +10,7 @@ using LearningHub.Nhs.WebUI.Configuration; using LearningHub.Nhs.WebUI.EventSource; using LearningHub.Nhs.WebUI.Handlers; + using LearningHub.Nhs.WebUI.Services; using LearningHub.Nhs.WebUI.Startup; using Microsoft.ApplicationInsights.Extensibility.EventCounterCollector; using Microsoft.AspNetCore.Builder; @@ -88,6 +89,7 @@ public static void ConfigureServices(this IServiceCollection services, IConfigur .Get(); services.AddTransient(); services.AddSingleton(); + services.AddSingleton(); services.ConfigureAuthentication(learningHubAuthSvcConf); diff --git a/LearningHub.Nhs.WebUI/Services/VersionService.cs b/LearningHub.Nhs.WebUI/Services/VersionService.cs new file mode 100644 index 000000000..b7f170a88 --- /dev/null +++ b/LearningHub.Nhs.WebUI/Services/VersionService.cs @@ -0,0 +1,18 @@ +namespace LearningHub.Nhs.WebUI.Services +{ + /// + /// Defines the . + /// + public class VersionService + { + /// + /// The GetVersion. + /// + /// The . + public string GetVersion() + { + var version = typeof(Program).Assembly.GetName().Version; + return $"{version?.Major}.{version?.Minor}.{version?.Build}"; + } + } +} diff --git a/LearningHub.Nhs.WebUI/ViewComponents/VersionViewComponent.cs b/LearningHub.Nhs.WebUI/ViewComponents/VersionViewComponent.cs new file mode 100644 index 000000000..2f119c184 --- /dev/null +++ b/LearningHub.Nhs.WebUI/ViewComponents/VersionViewComponent.cs @@ -0,0 +1,34 @@ +namespace LearningHub.Nhs.WebUI.ViewComponents +{ + using LearningHub.Nhs.WebUI.Services; + using Microsoft.AspNetCore.Html; + using Microsoft.AspNetCore.Mvc; + using Microsoft.AspNetCore.Mvc.ViewComponents; + + /// + /// Initializes a new instance of the class. + /// + public class VersionViewComponent : ViewComponent + { + private readonly VersionService versionService; + + /// + /// Initializes a new instance of the class. + /// + /// . + public VersionViewComponent(VersionService versionService) + { + this.versionService = versionService; + } + + /// + /// The Invoke. + /// + /// A representing the result of the synchronous operation. + public IViewComponentResult Invoke() + { + var version = this.versionService.GetVersion(); + return new HtmlContentViewComponentResult(new HtmlString($"")); + } + } +} \ No newline at end of file diff --git a/LearningHub.Nhs.WebUI/Views/Shared/Tenant/LearningHub/_Layout.cshtml b/LearningHub.Nhs.WebUI/Views/Shared/Tenant/LearningHub/_Layout.cshtml index a0aa46f2a..be91cb3cb 100644 --- a/LearningHub.Nhs.WebUI/Views/Shared/Tenant/LearningHub/_Layout.cshtml +++ b/LearningHub.Nhs.WebUI/Views/Shared/Tenant/LearningHub/_Layout.cshtml @@ -148,10 +148,12 @@ @RenderSection("Scripts", required: false) +