Skip to content

Commit d088e34

Browse files
authored
Merge pull request #1301 from TechnologyEnhancedLearning/RC
Merge RC changes to CI
2 parents 4d35089 + 61deccd commit d088e34

File tree

279 files changed

+17876
-3933
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

279 files changed

+17876
-3933
lines changed

.github/workflows/continuous-integration-workflow.yml

Lines changed: 19 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -9,99 +9,38 @@ jobs:
99
runs-on: windows-latest
1010
steps:
1111
- uses: actions/checkout@v3
12-
13-
- name: Modify web.config files in all apps
14-
shell: pwsh
15-
run: |
16-
$webConfigPaths = @(
17-
"${{ github.workspace }}\AdminUI\LearningHub.Nhs.AdminUI\web.config",
18-
"${{ github.workspace }}\WebAPI\LearningHub.Nhs.Api\web.config",
19-
"${{ github.workspace }}\LearningHub.Nhs.WebUI\web.config"
20-
)
21-
22-
foreach ($path in $webConfigPaths) {
23-
if (Test-Path $path) {
24-
Write-Host "Modifying $path"
25-
[xml]$config = Get-Content $path
26-
27-
if (-not $config.configuration.'system.webServer') {
28-
$systemWebServer = $config.CreateElement("system.webServer")
29-
$config.configuration.AppendChild($systemWebServer) | Out-Null
30-
} else {
31-
$systemWebServer = $config.configuration.'system.webServer'
32-
}
33-
34-
if (-not $systemWebServer.httpProtocol) {
35-
$httpProtocol = $config.CreateElement("httpProtocol")
36-
$systemWebServer.AppendChild($httpProtocol) | Out-Null
37-
} else {
38-
$httpProtocol = $systemWebServer.httpProtocol
39-
}
40-
41-
if (-not $httpProtocol.customHeaders) {
42-
$customHeaders = $config.CreateElement("customHeaders")
43-
$httpProtocol.AppendChild($customHeaders) | Out-Null
44-
} else {
45-
$customHeaders = $httpProtocol.customHeaders
46-
}
47-
48-
foreach ($name in @("X-Powered-By", "Server")) {
49-
$removeNode = $config.CreateElement("remove")
50-
$removeNode.SetAttribute("name", $name)
51-
$customHeaders.AppendChild($removeNode) | Out-Null
52-
}
53-
54-
if (-not $systemWebServer.security) {
55-
$security = $config.CreateElement("security")
56-
$systemWebServer.AppendChild($security) | Out-Null
57-
} else {
58-
$security = $systemWebServer.security
59-
}
60-
61-
if (-not $security.requestFiltering) {
62-
$requestFiltering = $config.CreateElement("requestFiltering")
63-
$requestFiltering.SetAttribute("removeServerHeader", "true")
64-
$security.AppendChild($requestFiltering) | Out-Null
65-
}
66-
67-
$config.Save($path)
68-
} else {
69-
Write-Host "File not found: $path"
70-
}
71-
}
72-
12+
7313
- name: Setup .NET Core SDK 8.0
7414
uses: actions/setup-dotnet@v3
7515
with:
7616
dotnet-version: 8.0.x
7717

7818
- name: Add Azure artifact
79-
run: dotnet nuget add source 'https://pkgs.dev.azure.com/e-LfH/_packaging/LearningHubFeed/nuget/v3/index.json' --name 'LearningHubFeed' --username 'kevin.whittaker' --password ${{ secrets.AZURE_DEVOPS_PAT }} --store-password-in-clear-text
19+
run: |
20+
dotnet nuget remove source LearningHubFeed || true
21+
dotnet nuget add source 'https://pkgs.dev.azure.com/e-LfH/_packaging/LearningHubFeed/nuget/v3/index.json' --name 'LearningHubFeed' --username 'kevin.whittaker' --password ${{ secrets.AZURE_DEVOPS_PAT }} --store-password-in-clear-text
8022
81-
- name: Use Node 20 with Yarn
23+
- name: Use Node 14
8224
uses: actions/setup-node@v4
8325
with:
84-
node-version: '20'
85-
cache: 'npm'
86-
87-
- name: Upgrade npm to the latest version
88-
run: npm install -g [email protected]
26+
node-version: '14'
27+
cache: 'npm'
8928

90-
- name: Typescript install WebUI
91-
run: yarn install --network-timeout 600000 --frozen-lockfile
29+
- name: npm install WebUI
30+
run: npm install
9231
working-directory: ./LearningHub.Nhs.WebUI
93-
94-
- name: Typescript build WebUI
95-
run: yarn build:webpack
32+
33+
- name: npm build WebUI
34+
run: npm run build:webpack
9635
working-directory: ./LearningHub.Nhs.WebUI
9736

98-
- name: Typescript install AdminUI
99-
run: yarn install
37+
- name: npm install AdminUI
38+
run: npm install
10039
working-directory: ./AdminUI/LearningHub.Nhs.AdminUI
101-
102-
- name: Typescript build AdminUI
103-
run: yarn build:webpack
104-
working-directory: ./AdminUI/LearningHub.Nhs.AdminUI
40+
41+
- name: npm build AdminUI
42+
run: npm run build:webpack
43+
working-directory: ./AdminUI/LearningHub.Nhs.AdminUI
10544

10645
- name: Setup MSBuild
10746
uses: microsoft/[email protected]
@@ -181,5 +120,4 @@ jobs:
181120
}
182121

183122
# - name: Test
184-
# run: dotnet test ${{ env.BuildParameters.TestProjects }}
185-
123+
# run: dotnet test ${{ env.BuildParameters.TestProjects }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,6 @@ obj
5353
/AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj.user
5454
/WebAPI/LearningHub.Nhs.API/LearningHub.Nhs.Api.csproj.user
5555
/ReportAPI/LearningHub.Nhs.ReportApi/web.config
56+
/AdminUI/LearningHub.Nhs.AdminUI/web.config
57+
/LearningHub.Nhs.WebUI/web.config
58+
/WebAPI/LearningHub.Nhs.API/web.config

AdminUI/LearningHub.Nhs.AdminUI/Configuration/WebSettings.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ public class WebSettings
2727
/// </summary>
2828
public string LearningHubApiUrl { get; set; }
2929

30+
/// <summary>
31+
/// Gets or sets the OpenApiUrl.
32+
/// </summary>
33+
public string OpenApiUrl { get; set; }
34+
3035
/// <summary>
3136
/// Gets or sets the user api url.
3237
/// </summary>

AdminUI/LearningHub.Nhs.AdminUI/Controllers/UserGroupController.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,15 @@ public async Task<IActionResult> Details(UserGroupAdminDetailViewModel userGroup
197197
if (userGroup.IsNew())
198198
{
199199
validationResult = await this.userGroupService.CreateUserGroup(userGroup);
200-
userGroup = await this.userGroupService.GetUserGroupAdminDetailbyIdAsync(validationResult.CreatedId.Value);
200+
if (validationResult.IsValid)
201+
{
202+
userGroup = await this.userGroupService.GetUserGroupAdminDetailbyIdAsync(validationResult.CreatedId.Value);
203+
}
204+
else
205+
{
206+
this.ViewBag.ErrorMessage = $"Update failed: {string.Join(Environment.NewLine, validationResult.Details)}";
207+
return this.View("Details", userGroup);
208+
}
201209
}
202210
else
203211
{

AdminUI/LearningHub.Nhs.AdminUI/Controllers/api/UserController.cs

Lines changed: 0 additions & 60 deletions
This file was deleted.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
namespace LearningHub.Nhs.AdminUI.Helpers
2+
{
3+
using System.Threading.Tasks;
4+
using LearningHub.Nhs.Models.Common;
5+
6+
/// <summary>
7+
/// Defines the <see cref="IOpenApiFacade" />.
8+
/// </summary>
9+
public interface IOpenApiFacade
10+
{
11+
/// <summary>
12+
/// The GetAsync.
13+
/// </summary>
14+
/// <typeparam name="T">The type.</typeparam>
15+
/// <param name="url">The url.</param>
16+
/// <returns>The <see cref="Task{T}"/>.</returns>
17+
Task<T> GetAsync<T>(string url)
18+
where T : class, new();
19+
20+
/// <summary>
21+
/// The PostAsync.
22+
/// </summary>
23+
/// <typeparam name="T">The type.</typeparam>
24+
/// <param name="url">The url.</param>
25+
/// <param name="body">The body.</param>
26+
/// <returns>The <see cref="Task"/>.</returns>
27+
Task PostAsync<T>(string url, T body)
28+
where T : class, new();
29+
30+
/// <summary>
31+
/// The PostAsync.
32+
/// </summary>
33+
/// <typeparam name="T">The type.</typeparam>
34+
/// <typeparam name="TBody">.</typeparam>
35+
/// <param name="url">The url.</param>
36+
/// <param name="body">The body.</param>
37+
/// <returns>The <see cref="Task{T}"/>.</returns>
38+
Task<ApiResponse> PostAsync<T, TBody>(string url, TBody body)
39+
where T : class, new()
40+
where TBody : class, new();
41+
42+
/// <summary>
43+
/// The PutAsync.
44+
/// </summary>
45+
/// <param name="url">The url.</param>
46+
/// <returns>The <see cref="Task"/>.</returns>
47+
Task<ApiResponse> PutAsync(string url);
48+
49+
/// <summary>
50+
/// The PutAsync.
51+
/// </summary>
52+
/// <typeparam name="T">.</typeparam>
53+
/// <param name="url">The url.</param>
54+
/// <param name="body">The body.</param>
55+
/// <returns>The <see cref="Task"/>.</returns>
56+
Task<ApiResponse> PutAsync<T>(string url, T body)
57+
where T : class, new();
58+
}
59+
}

AdminUI/LearningHub.Nhs.AdminUI/Helpers/LearningActivityHelper.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,15 @@ public static string GetResourceTypeVerb(this MyLearningDetailedItemViewModel my
8585
case ResourceTypeEnum.Article:
8686
return "Read";
8787
case ResourceTypeEnum.Audio:
88-
return "Played " + GetDurationText(myLearningDetailedItemViewModel.ActivityDurationSeconds * 1000);
88+
if ((myLearningDetailedItemViewModel.ActivityDurationSeconds * 1000) > myLearningDetailedItemViewModel.ResourceDurationMilliseconds)
89+
{
90+
return "Played " + GetDurationText(myLearningDetailedItemViewModel.ResourceDurationMilliseconds);
91+
}
92+
else
93+
{
94+
return "Played " + GetDurationText(myLearningDetailedItemViewModel.ActivityDurationSeconds * 1000);
95+
}
96+
8997
case ResourceTypeEnum.Embedded:
9098
return string.Empty;
9199
case ResourceTypeEnum.Equipment:
@@ -113,7 +121,15 @@ public static string GetResourceTypeVerb(this MyLearningDetailedItemViewModel my
113121
}
114122

115123
case ResourceTypeEnum.Video:
116-
return "Played " + GetDurationText(myLearningDetailedItemViewModel.ActivityDurationSeconds * 1000);
124+
if ((myLearningDetailedItemViewModel.ActivityDurationSeconds * 1000) > myLearningDetailedItemViewModel.ResourceDurationMilliseconds)
125+
{
126+
return "Played " + GetDurationText(myLearningDetailedItemViewModel.ResourceDurationMilliseconds);
127+
}
128+
else
129+
{
130+
return "Played " + GetDurationText(myLearningDetailedItemViewModel.ActivityDurationSeconds * 1000);
131+
}
132+
117133
case ResourceTypeEnum.WebLink:
118134
return "Visited";
119135
case ResourceTypeEnum.Html:

0 commit comments

Comments
 (0)