Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/azure-pipeline-webui-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,57 @@ jobs:
inputs:
command: restore
projects: $(BuildParameters.RestoreBuildProjects)
# Step 1: Get the version tag from the repository
- script: |
echo "Extracting version from Git tag: $(versionTag)"
VERSION=$(echo $(versionTag) | sed 's/^v//')
echo "VERSION=$VERSION" >> $(Build.ArtifactStagingDirectory)/version.txt
displayName: 'Extract version tag'

# Step 2: Update AssemblyVersion in Web UI .csproj
- powershell: |
$versionFile = "$(Build.ArtifactStagingDirectory)/version.txt"
$version = Get-Content $versionFile
$version = $version.Trim()

# Path to your .csproj file (adjust if necessary)
$csprojFile = "$(Build.SourcesDirectory)\LearningHub.Nhs.WebUI\LearningHub.Nhs.WebUI.csproj"

Write-Host "Updating AssemblyVersion and FileVersion and Version in $csprojFile to $version"

# Load the .csproj XML file
[xml]$csprojXml = Get-Content -Path $csprojFile

# Update the AssemblyVersion and FileVersion
$csprojXml.Project.PropertyGroup.AssemblyVersion = $version
$csprojXml.Project.PropertyGroup.FileVersion = $version
$csprojXml.Project.PropertyGroup.Version = $version

# Save the updated .csproj file
$csprojXml.Save($csprojFile)
displayName: 'Update AssemblyVersion in WebUI .csproj'
# Step 2: Update AssemblyVersion in Admin UI .csproj
- powershell: |
$versionFile = "$(Build.ArtifactStagingDirectory)/version.txt"
$version = Get-Content $versionFile
$version = $version.Trim()

# Path to your .csproj file (adjust if necessary)
$csprojFile = "$(Build.SourcesDirectory)\AdminUI\LearningHub.Nhs.AdminUI\LearningHub.Nhs.AdminUI.csproj"

Write-Host "Updating AssemblyVersion and FileVersion and Version in $csprojFile to $version"

# Load the .csproj XML file
[xml]$csprojXml = Get-Content -Path $csprojFile

# Update the AssemblyVersion and FileVersion
$csprojXml.Project.PropertyGroup.AssemblyVersion = $version
$csprojXml.Project.PropertyGroup.FileVersion = $version
$csprojXml.Project.PropertyGroup.Version = $version

# Save the updated .csproj file
$csprojXml.Save($csprojFile)
displayName: 'Update AssemblyVersion in AdminUI .csproj'
- task: DotNetCoreCLI@2
displayName: Build
inputs:
Expand Down
1,253 changes: 630 additions & 623 deletions AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ public static void ConfigureServices(this IServiceCollection services, IConfigur

services.AddTransient<CookieEventHandler>();
services.AddSingleton<LogoutUserManager>();
services.AddSingleton<VersionService>();

services.AddAuthentication(options =>
{
Expand Down
18 changes: 18 additions & 0 deletions AdminUI/LearningHub.Nhs.AdminUI/Services/VersionService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace LearningHub.Nhs.AdminUI.Services
{
/// <summary>
/// Defines the <see cref="VersionService" />.
/// </summary>
public class VersionService
{
/// <summary>
/// The GetVersion.
/// </summary>
/// <returns>The <see cref="string"/>.</returns>
public string GetVersion()
{
var version = typeof(Program).Assembly.GetName().Version;
return $"{version?.Major}.{version?.Minor}.{version?.Build}";
}
}
}
Original file line number Diff line number Diff line change
@@ -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;

/// <summary>
/// Initializes a new instance of the <see cref="VersionViewComponent"/> class.
/// </summary>
public class VersionViewComponent : ViewComponent
{
private readonly VersionService versionService;

/// <summary>
/// Initializes a new instance of the <see cref="VersionViewComponent"/> class.
/// </summary>
/// <param name="versionService">.</param>
public VersionViewComponent(VersionService versionService)
{
this.versionService = versionService;
}

/// <summary>
/// The Invoke.
/// </summary>
/// <returns>A representing the result of the synchronous operation.</returns>
public IViewComponentResult Invoke()
{
var version = this.versionService.GetVersion();
return new HtmlContentViewComponentResult(new HtmlString($"<!-- Version: {version} -->"));
}
}
}
146 changes: 73 additions & 73 deletions AdminUI/LearningHub.Nhs.AdminUI/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,83 +2,83 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - Learning Hub Administration</title>
<link rel="apple-touch-icon" sizes="180x180" href="~/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="~/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="~/favicon-16x16.png">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - Learning Hub Administration</title>
<link rel="apple-touch-icon" sizes="180x180" href="~/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="~/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="~/favicon-16x16.png">

<environment include="Development">
<environment include="Development">

<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="~/lib/fontawesome-free-6.4.2-web/css/all.css"/>
</environment>
<environment exclude="Development">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css"
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute"
crossorigin="anonymous"
integrity="sha256-eSi1q2PG6J7g7ib17yAaWMcrr5GrtohYChqibrV7PBE=" />
<link rel="stylesheet" type="text/css" href="~/lib/fontawesome-free-6.4.2-web/css/all.min.css" />
</environment>
<link rel="stylesheet" type="text/css" href="~/css/site.css" asp-append-version="true"/>
<link rel="stylesheet" type="text/css" href="~/css/nhsuk/common.css"/>
@RenderSection("Styles", required: false)
@await Html.PartialAsync("_GoogleAnalytics")
<partial name="~/Views/Shared/_TimezoneInfoScriptPartial.cshtml" />
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="~/lib/fontawesome-free-6.4.2-web/css/all.css" />
</environment>
<environment exclude="Development">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css"
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute"
crossorigin="anonymous"
integrity="sha256-eSi1q2PG6J7g7ib17yAaWMcrr5GrtohYChqibrV7PBE=" />
<link rel="stylesheet" type="text/css" href="~/lib/fontawesome-free-6.4.2-web/css/all.min.css" />
</environment>
<link rel="stylesheet" type="text/css" href="~/css/site.css" asp-append-version="true" />
<link rel="stylesheet" type="text/css" href="~/css/nhsuk/common.css" />
@RenderSection("Styles", required: false)
@await Html.PartialAsync("_GoogleAnalytics")
<partial name="~/Views/Shared/_TimezoneInfoScriptPartial.cshtml" />
</head>
<body>
<header role="banner" id="header">
<partial name="~/Views/Shared/_NavPartial.cshtml" />
</header>
<div class="container-fluid">
<!--<partial name="_CookieConsentPartial" />-->
<main role="main" id="maincontent" tabindex="-1">
@{
var mainWidth = IsSectionDefined("SideMenu") ? "col-sm-9 col-lg-9 col-xl-10 pageWithMenu" : "col-sm-12";
}
<div class="row">
@if (IsSectionDefined("SideMenu"))
{
<div class="col-sm-3 col-lg-3 col-xl-2 side-menu">
@RenderSection("SideMenu", required: false)
</div>
}
<div class="@mainWidth">
@RenderBody()
</div>
</div>
</main>
</div>
<footer class="border-top footer text-muted">
<partial name="~/Views/Shared/_FooterPartial.cshtml" />
</footer>
<header role="banner" id="header">
<partial name="~/Views/Shared/_NavPartial.cshtml" />
</header>
<div class="container-fluid">
<!--<partial name="_CookieConsentPartial" />-->
<main role="main" id="maincontent" tabindex="-1">
@{
var mainWidth = IsSectionDefined("SideMenu") ? "col-sm-9 col-lg-9 col-xl-10 pageWithMenu" : "col-sm-12";
}
<div class="row">
@if (IsSectionDefined("SideMenu"))
{
<div class="col-sm-3 col-lg-3 col-xl-2 side-menu">
@RenderSection("SideMenu", required: false)
</div>
}
<div class="@mainWidth">
@RenderBody()
</div>
</div>
</main>
</div>
<footer class="border-top footer text-muted">
<partial name="~/Views/Shared/_FooterPartial.cshtml" />
</footer>

<environment include="Development">
<script src="~/lib/jquery/dist/jquery.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.js"></script>
<script src="~/lib/ckeditor/ckeditor.js"></script>
</environment>
<environment exclude="Development">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
asp-fallback-test="window.jQuery"
crossorigin="anonymous"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/js/bootstrap.bundle.min.js"
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
crossorigin="anonymous"
integrity="sha256-E/V4cWE4qvAeO5MOhjtGtqDzPndRO1LBk8lJ/PR7CA4=">
</script>
<script src="~/lib/ckeditor/ckeditor.js"></script>
@*<script type="text/javascript" src="~/js/site.min.js"></script>*@
</environment>
@*<script type="text/javascript" src="~/js/bundle/header.js"></script>*@
<partial name="~/Views/Shared/_ValidationScriptsPartial.cshtml" />
@RenderSection("Scripts", required: false)
<environment include="Development">
<script src="~/lib/jquery/dist/jquery.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.js"></script>
<script src="~/lib/ckeditor/ckeditor.js"></script>
</environment>
<environment exclude="Development">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
asp-fallback-test="window.jQuery"
crossorigin="anonymous"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/js/bootstrap.bundle.min.js"
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
crossorigin="anonymous"
integrity="sha256-E/V4cWE4qvAeO5MOhjtGtqDzPndRO1LBk8lJ/PR7CA4=">
</script>
<script src="~/lib/ckeditor/ckeditor.js"></script>
@*<script type="text/javascript" src="~/js/site.min.js"></script>*@
</environment>
@*<script type="text/javascript" src="~/js/bundle/header.js"></script>*@
<partial name="~/Views/Shared/_ValidationScriptsPartial.cshtml" />
@RenderSection("Scripts", required: false)
</body>
</html>
<!-- Build number: @settings.Value.BuildNumber -->
@await Component.InvokeAsync("Version")
Loading
Loading