Skip to content

Commit 5e74bd4

Browse files
authored
Merge pull request #1181 from TechnologyEnhancedLearning/Develop/Features/TD-3683_implement_central_package_management_webui
Merge CPM into Dependabot branch
2 parents b21334a + 2b43672 commit 5e74bd4

File tree

440 files changed

+45068
-4763
lines changed

Some content is hidden

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

440 files changed

+45068
-4763
lines changed

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

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,75 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v3
1212

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+
1373
- name: Setup .NET Core SDK 8.0
1474
uses: actions/setup-dotnet@v3
1575
with:
1676
dotnet-version: 8.0.x
1777

1878
- name: Add Azure artifact
19-
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
79+
run: |
80+
dotnet nuget remove source LearningHubFeed || true
81+
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
2082
2183
- name: Use Node 20 with Yarn
2284
uses: actions/setup-node@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@ obj
5252
/OpenAPI/LearningHub.Nhs.OpenApi/web.config
5353
/AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj.user
5454
/WebAPI/LearningHub.Nhs.API/LearningHub.Nhs.Api.csproj.user
55+
/ReportAPI/LearningHub.Nhs.ReportApi/web.config

AdminUI/LearningHub.Nhs.AdminUI/Controllers/RoadmapController.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public async Task<IActionResult> AddUpdate(UpdateViewModel update)
9999
RoadmapTypeId = update.RoadmapTypeId,
100100
};
101101
var roadmapId = await this.roadmapService.AddRoadmap(roadmap);
102-
return this.RedirectToAction("EditUpdate", new { id = roadmapId });
102+
return this.RedirectToAction("Details", new { id = roadmapId });
103103
}
104104

105105
/// <summary>
@@ -160,7 +160,7 @@ public async Task<IActionResult> EditUpdate(UpdateViewModel update)
160160
Id = update.Id,
161161
};
162162
await this.roadmapService.UpdateRoadmap(roadmap);
163-
return this.RedirectToAction("EditUpdate", new { roadmap.Id });
163+
return this.RedirectToAction("Details", new { roadmap.Id });
164164
}
165165

166166
/// <summary>
@@ -202,6 +202,18 @@ public async Task<IActionResult> Updates(string searchTerm = null)
202202
return this.View(model);
203203
}
204204

205+
/// <summary>
206+
/// The Details.
207+
/// </summary>
208+
/// <param name="id">The id<see cref="int"/>.</param>
209+
/// <returns>The <see cref="Task{IActionResult}"/>.</returns>
210+
[HttpGet]
211+
public async Task<IActionResult> Details(int id)
212+
{
213+
var roadmap = await this.roadmapService.GetIdAsync(id);
214+
return this.View(roadmap);
215+
}
216+
205217
/// <summary>
206218
/// The UploadFile.
207219
/// </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/Interfaces/IRoadmapService.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Collections.Generic;
44
using System.Threading.Tasks;
55
using LearningHub.Nhs.Models.Entities;
6+
using LearningHub.Nhs.Models.RoadMap;
67

78
/// <summary>
89
/// Defines the <see cref="IRoadmapService" />.
@@ -36,6 +37,13 @@ public interface IRoadmapService
3637
/// <returns>The <see cref="List{Roadmap}"/>.</returns>
3738
Task<List<Roadmap>> GetUpdates();
3839

40+
/// <summary>
41+
/// The GetIdAsync.
42+
/// </summary>
43+
/// <param name="id">The id<see cref="int"/>.</param>
44+
/// <returns>The <see cref="Task{Roadmap}"/>.</returns>
45+
Task<RoadMapViewModel> GetIdAsync(int id);
46+
3947
/// <summary>
4048
/// The UpdateRoadmap.
4149
/// </summary>

0 commit comments

Comments
 (0)