Skip to content

Commit 88ba1a5

Browse files
authored
Merge pull request #399 from TechnologyEnhancedLearning/RC
Merge Pheonix release to master
2 parents a686ba9 + f8ff710 commit 88ba1a5

File tree

149 files changed

+5093
-631
lines changed

Some content is hidden

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

149 files changed

+5093
-631
lines changed

.github/azure-pipeline-database-ci.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
trigger:
22
branches:
3-
include:
4-
- CI
3+
exclude:
4+
- '*'
5+
6+
pr:
7+
branches:
8+
exclude:
9+
- '*'
10+
511
resources:
612
repositories:
713
- repository: self
@@ -12,6 +18,7 @@ jobs:
1218
displayName: Agent job
1319
pool:
1420
vmImage: windows-2019
21+
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/CI'))
1522
steps:
1623
- checkout: self
1724
clean: true

.github/azure-pipeline-openapi-reportapi-ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ trigger:
88
branches:
99
include:
1010
- CI
11+
exclude:
12+
- '*'
1113
name: $(date:yyyyMMdd)$(rev:.r)
1214
resources:
1315
repositories:
1416
- repository: self
1517
type: git
16-
ref: refs/heads/RC
18+
ref: refs/heads/CI
1719
jobs:
1820
- job: Job_1
1921
displayName: Agent job

.github/azure-pipeline-webui-ci.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ variables:
44
value: '**/*.csproj'
55
- name: BuildParameters.TestProjects
66
value: '**/*[Tt]ests/*.csproj'
7-
trigger:
8-
branches:
9-
include:
10-
- CI
7+
# Triggered Via Azure pipeline
118
name: $(date:yyyyMMdd)$(rev:.r)
129
resources:
1310
repositories:

AdminUI/LearningHub.Nhs.AdminUI/Controllers/ResourceController.cs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Threading.Tasks;
77
using LearningHub.Nhs.AdminUI.Configuration;
88
using LearningHub.Nhs.AdminUI.Extensions;
9+
using LearningHub.Nhs.AdminUI.Helpers;
910
using LearningHub.Nhs.AdminUI.Interfaces;
1011
using LearningHub.Nhs.AdminUI.Models;
1112
using LearningHub.Nhs.Models.Common;
@@ -16,6 +17,7 @@
1617
using Microsoft.AspNetCore.Mvc;
1718
using Microsoft.Extensions.Logging;
1819
using Microsoft.Extensions.Options;
20+
using Microsoft.FeatureManagement;
1921

2022
/// <summary>
2123
/// Defines the <see cref="ResourceController" />.
@@ -32,6 +34,11 @@ public class ResourceController : BaseController
3234
/// </summary>
3335
private readonly IOptions<WebSettings> websettings;
3436

37+
/// <summary>
38+
/// Defines the featureManager.
39+
/// </summary>
40+
private readonly IFeatureManager featureManager;
41+
3542
/// <summary>
3643
/// Defines the _logger.
3744
/// </summary>
@@ -55,18 +62,21 @@ public class ResourceController : BaseController
5562
/// <param name="logger">The logger<see cref="ILogger{HomeController}"/>.</param>
5663
/// <param name="resourceService">The resourceService<see cref="IResourceService"/>.</param>
5764
/// /// <param name="websettings">The websettings<see cref="IOptions{WebSettings}"/>.</param>
65+
/// <param name="featureManager">The featureManager<see cref="IFeatureManager"/>.</param>
5866
public ResourceController(
5967
IWebHostEnvironment hostingEnvironment,
6068
IOptions<WebSettings> config,
6169
ILogger<HomeController> logger,
6270
IResourceService resourceService,
63-
IOptions<WebSettings> websettings)
71+
IOptions<WebSettings> websettings,
72+
IFeatureManager featureManager)
6473
: base(hostingEnvironment)
6574
{
6675
this.logger = logger;
6776
this.websettings = websettings;
6877
this.config = config.Value;
6978
this.resourceService = resourceService;
79+
this.featureManager = featureManager;
7080
}
7181

7282
/// <summary>
@@ -309,6 +319,33 @@ public async Task<IActionResult> Unpublish(int resourceVersionId, string details
309319
}
310320
}
311321

322+
/// <summary>
323+
/// The GetAVUnavailableView.
324+
/// </summary>
325+
/// <returns> partial view. </returns>
326+
[Route("Resource/GetAVUnavailableView")]
327+
[HttpGet("GetAVUnavailableView")]
328+
public IActionResult GetAVUnavailableView()
329+
{
330+
return this.PartialView("_AudioVideoUnavailable");
331+
}
332+
333+
/// <summary>
334+
/// The GetAddAVFlag.
335+
/// </summary>
336+
/// <returns> Return AV Flag.</returns>
337+
[Route("Resource/GetAddAVFlag")]
338+
[HttpGet("GetAddAVFlag")]
339+
public bool GetAddAVFlag() => this.featureManager.IsEnabledAsync(FeatureFlags.AddAudioVideo).Result;
340+
341+
/// <summary>
342+
/// The GetDisplayAVFlag.
343+
/// </summary>
344+
/// <returns> Return display AV flag.</returns>
345+
[Route("Resource/GetDisplayAVFlag")]
346+
[HttpGet("GetDisplayAVFlag")]
347+
public bool GetDisplayAVFlag() => this.featureManager.IsEnabledAsync(FeatureFlags.DisplayAudioVideo).Result;
348+
312349
private static List<PagingOptionPair> FilterOptions()
313350
{
314351
List<PagingOptionPair> options = new List<PagingOptionPair>();
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace LearningHub.Nhs.AdminUI.Helpers
2+
{
3+
/// <summary>
4+
/// <see cref="FeatureFlags"/>.
5+
/// </summary>
6+
public static class FeatureFlags
7+
{
8+
/// <summary>
9+
/// The AddAudioVideo.
10+
/// </summary>
11+
public const string AddAudioVideo = "AddAudioVideo";
12+
13+
/// <summary>
14+
/// The DisplayAudioVideo.
15+
/// </summary>
16+
public const string DisplayAudioVideo = "DisplayAudioVideo";
17+
}
18+
}

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

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public static string GetResourceTypeVerb(this MyLearningDetailedItemViewModel my
128128
/// <returns>The .</returns>
129129
public static string GetActivityStatusDisplayText(this MyLearningDetailedItemViewModel myLearningDetailedItemViewModel)
130130
{
131-
if (myLearningDetailedItemViewModel.ActivityStatus == ActivityStatusEnum.Launched
131+
if (myLearningDetailedItemViewModel.ActivityStatus == ActivityStatusEnum.Completed
132132
&& (myLearningDetailedItemViewModel.ResourceType == ResourceTypeEnum.Article
133133
|| myLearningDetailedItemViewModel.ResourceType == ResourceTypeEnum.WebLink
134134
|| myLearningDetailedItemViewModel.ResourceType == ResourceTypeEnum.Image
@@ -137,7 +137,7 @@ public static string GetActivityStatusDisplayText(this MyLearningDetailedItemVie
137137
{
138138
return "Completed";
139139
}
140-
else if (myLearningDetailedItemViewModel.ActivityStatus == ActivityStatusEnum.Launched
140+
else if (myLearningDetailedItemViewModel.ActivityStatus == ActivityStatusEnum.Completed
141141
&& (myLearningDetailedItemViewModel.ResourceType == ResourceTypeEnum.GenericFile))
142142
{
143143
return "Downloaded";
@@ -164,36 +164,33 @@ public static string GetActivityStatusDisplayText(this MyLearningDetailedItemVie
164164
/// </summary>
165165
/// <param name="myLearningDetailedItemViewModel">The myLearningDetailedItemViewModel.</param>
166166
/// <returns>The <see cref="ActivityStatusEnum"/>.</returns>
167-
public static ActivityStatusEnum GetActivityStatus(this MyLearningDetailedItemViewModel myLearningDetailedItemViewModel)
167+
public static string GetActivityStatus(this MyLearningDetailedItemViewModel myLearningDetailedItemViewModel)
168168
{
169-
if (myLearningDetailedItemViewModel.ActivityStatus == ActivityStatusEnum.Launched
169+
if (myLearningDetailedItemViewModel.ActivityStatus == ActivityStatusEnum.Completed
170170
&& (myLearningDetailedItemViewModel.ResourceType == ResourceTypeEnum.Article
171-
|| myLearningDetailedItemViewModel.ResourceType == ResourceTypeEnum.WebLink
172171
|| myLearningDetailedItemViewModel.ResourceType == ResourceTypeEnum.Image
173172
|| myLearningDetailedItemViewModel.ResourceType == ResourceTypeEnum.Html
174173
|| myLearningDetailedItemViewModel.ResourceType == ResourceTypeEnum.Case))
175174
{
176-
return ActivityStatusEnum.Completed;
175+
return "Viewed";
177176
}
178-
else if (myLearningDetailedItemViewModel.ActivityStatus == ActivityStatusEnum.Launched
179-
&& (myLearningDetailedItemViewModel.ResourceType == ResourceTypeEnum.GenericFile))
177+
else if (myLearningDetailedItemViewModel.ActivityStatus == ActivityStatusEnum.Completed
178+
&& (myLearningDetailedItemViewModel.ResourceType == ResourceTypeEnum.WebLink))
180179
{
181-
return ActivityStatusEnum.Downloaded;
180+
return "Launched";
182181
}
183-
else if (myLearningDetailedItemViewModel.ResourceType == ResourceTypeEnum.Assessment)
182+
else if (myLearningDetailedItemViewModel.ActivityStatus == ActivityStatusEnum.Completed
183+
&& (myLearningDetailedItemViewModel.ResourceType == ResourceTypeEnum.GenericFile))
184184
{
185-
if (myLearningDetailedItemViewModel.Complete)
186-
{
187-
return myLearningDetailedItemViewModel.ScorePercentage >= myLearningDetailedItemViewModel.AssessmentDetails.PassMark ? ActivityStatusEnum.Passed : ActivityStatusEnum.Failed;
188-
}
189-
else
190-
{
191-
return myLearningDetailedItemViewModel.ScorePercentage >= myLearningDetailedItemViewModel.AssessmentDetails.PassMark ? ActivityStatusEnum.Passed : ActivityStatusEnum.InProgress;
192-
}
185+
return ActivityStatusEnum.Downloaded.ToString();
186+
}
187+
else if (myLearningDetailedItemViewModel.ActivityStatus == ActivityStatusEnum.Incomplete)
188+
{
189+
return ActivityStatusEnum.InProgress.ToString();
193190
}
194191
else
195192
{
196-
return myLearningDetailedItemViewModel.ActivityStatus;
193+
return myLearningDetailedItemViewModel.ActivityStatus.ToString();
197194
}
198195
}
199196

AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,13 @@
8989
<PackageReference Include="HtmlSanitizer" Version="6.0.453" />
9090
<PackageReference Include="IdentityModel" Version="4.4.0" />
9191
<PackageReference Include="LearningHub.Nhs.Caching" Version="2.0.2" />
92-
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.29" />
92+
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.31" />
9393
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.19.0" />
9494
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.0" />
9595
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.0" />
9696
<PackageReference Include="Microsoft.Azure.Management.Media" Version="5.0.0" />
97+
<PackageReference Include="Microsoft.FeatureManagement" Version="3.2.0" />
98+
<PackageReference Include="Microsoft.FeatureManagement.AspNetCore" Version="3.2.0" />
9799
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="5.2.9" />
98100
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="6.14.1" />
99101
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="6.14.1" />

AdminUI/LearningHub.Nhs.AdminUI/Scripts/vuesrc/content/cmsPageRow.vue

Lines changed: 56 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<div v-html="getDescription" />
1919
</div>
2020
<div class="information-page__asset-container">
21-
<div id="mediaContainer" :class="[`${disableVideoControl ? 'videoControlDisabled' : ''}`]" v-show="sectionTemplateType === SectionTemplateType.Video" class="w-100">
21+
<div id="mediaContainer" :class="[`${disableVideoControl ? 'videoControlDisabled' : ''}`]" v-show="sectionTemplateType === SectionTemplateType.Video && displayAVFlag" class="w-100">
2222
<video controls v-show="section.id" :id="[`azureMediaPlayer${section.id}`]"
2323
data-setup='{"logo": { "enabled": false }, "techOrder": ["azureHtml5JS", "flashSS", "silverlightSS", "html5"], "nativeControlsForTouch": false, "fluid": true}'
2424
class="azuremediaplayer amp-default-skin amp-big-play-centered" style="height:250px;">
@@ -33,6 +33,9 @@
3333
</div>
3434
</div>
3535
</div>
36+
<div v-if="!displayAVFlag">
37+
<div v-html="audioVideoUnavailableView"></div>
38+
</div>
3639
</div>
3740
<div v-if="sectionTemplateType === SectionTemplateType.Image && section.imageAsset" class="nhsuk-grid-column-full">
3841
<div :class="[`information-page__container ${section.sectionLayoutType == SectionLayoutType.Left ? 'information-page__container--reverse-child-order' : '' } ${section.hasBorder ? 'information-page__container--border' : '' }`]">
@@ -78,10 +81,14 @@
7881
SectionTemplateType: SectionTemplateType,
7982
pageSectionDetail: null as PageSectionDetailModel,
8083
disableVideoControl: false,
84+
displayAVFlag: false,
85+
audioVideoUnavailableView : '' as string,
8186
};
8287
},
8388
created() {
8489
this.load();
90+
this.getDisplayAVFlag();
91+
this.getAudioVideoUnavailableView();
8592
},
8693
computed: {
8794
getStyle() {
@@ -125,7 +132,7 @@
125132
returnClass = "information-page__text-container--no-padding-right";
126133
}
127134
}
128-
return returnClass;
135+
return returnClass;
129136
},
130137
getDescription() {
131138
if (this.section.description) {
@@ -138,50 +145,60 @@
138145
},
139146
isRightSectionLayout() {
140147
return this.section.sectionLayoutType == SectionLayoutType.Right;
141-
}
148+
},
142149
},
143150
methods: {
151+
getDisplayAVFlag() {
152+
contentData.getDisplayAVFlag().then(response => {
153+
this.displayAVFlag = response;
154+
});
155+
},
156+
getAudioVideoUnavailableView() {
157+
contentData.getAVUnavailableView().then(response => {
158+
this.audioVideoUnavailableView = response;
159+
});
160+
},
144161
load() {
145162
if (this.sectionTemplateType === SectionTemplateType.Video) {
146-
contentData.getPageSectionDetailVideo(this.section.id).then(response => {
147-
this.pageSectionDetail = response;
163+
contentData.getPageSectionDetailVideo(this.section.id).then(response => {
164+
this.pageSectionDetail = response;
148165
149-
if (!this.pageSectionDetail.videoAsset)
150-
return;
166+
if (!this.pageSectionDetail.videoAsset)
167+
return;
151168
152-
const id = 'azureMediaPlayer' + this.pageSectionDetail.id;
153-
let azureMediaPlayer = amp(id);
169+
const id = 'azureMediaPlayer' + this.pageSectionDetail.id;
170+
let azureMediaPlayer = amp(id);
154171
155-
if (this.pageSectionDetail.videoAsset.azureMediaAsset) {
156-
$(`#${id}`).css({ 'height': '', 'border': '1px solid #768692' });
157-
this.disableVideoControl = false;
158-
} else {
159-
this.disableVideoControl = true;
160-
}
172+
if (this.pageSectionDetail.videoAsset.azureMediaAsset) {
173+
$(`#${id}`).css({ 'height': '', 'border': '1px solid #768692' });
174+
this.disableVideoControl = false;
175+
} else {
176+
this.disableVideoControl = true;
177+
}
161178
162-
if (this.pageSectionDetail.videoAsset.thumbnailImageFile) {
163-
azureMediaPlayer.poster(`/file/download/${this.pageSectionDetail.videoAsset.thumbnailImageFile.filePath}/${this.pageSectionDetail.videoAsset.thumbnailImageFile.fileName}`);
164-
}
165-
if (this.pageSectionDetail.videoAsset.azureMediaAsset && this.pageSectionDetail.videoAsset.closedCaptionsFile) {
166-
azureMediaPlayer.src([{
167-
type: "application/vnd.ms-sstr+xml",
168-
src: this.pageSectionDetail.videoAsset.azureMediaAsset.locatorUri,
169-
protectionInfo: [{ type: 'AES', authenticationToken: `Bearer=${this.pageSectionDetail.videoAsset.azureMediaAsset.authenticationToken}` }]
170-
}],
171-
[{ kind: "captions", src: `/file/download/${this.pageSectionDetail.videoAsset.closedCaptionsFile.filePath}/${this.pageSectionDetail.videoAsset.closedCaptionsFile.fileName}`, srclang: "en", label: "english" }]);
172-
}
173-
else if (this.pageSectionDetail.videoAsset.azureMediaAsset && !this.pageSectionDetail.videoAsset.closedCaptionsFile) {
174-
azureMediaPlayer.src([{
175-
type: "application/vnd.ms-sstr+xml",
176-
src: this.pageSectionDetail.videoAsset.azureMediaAsset.locatorUri,
177-
protectionInfo: [{ type: 'AES', authenticationToken: `Bearer=${this.pageSectionDetail.videoAsset.azureMediaAsset.authenticationToken}` }]
178-
}]);
179-
}
180-
});
181-
} else {
182-
contentData.getPageSectionDetail(this.section.id).then(x => this.pageSectionDetail = x);
183-
}
184-
},
179+
if (this.pageSectionDetail.videoAsset.thumbnailImageFile) {
180+
azureMediaPlayer.poster(`/file/download/${this.pageSectionDetail.videoAsset.thumbnailImageFile.filePath}/${this.pageSectionDetail.videoAsset.thumbnailImageFile.fileName}`);
181+
}
182+
if (this.pageSectionDetail.videoAsset.azureMediaAsset && this.pageSectionDetail.videoAsset.closedCaptionsFile) {
183+
azureMediaPlayer.src([{
184+
type: "application/vnd.ms-sstr+xml",
185+
src: this.pageSectionDetail.videoAsset.azureMediaAsset.locatorUri,
186+
protectionInfo: [{ type: 'AES', authenticationToken: `Bearer=${this.pageSectionDetail.videoAsset.azureMediaAsset.authenticationToken}` }]
187+
}],
188+
[{ kind: "captions", src: `/file/download/${this.pageSectionDetail.videoAsset.closedCaptionsFile.filePath}/${this.pageSectionDetail.videoAsset.closedCaptionsFile.fileName}`, srclang: "en", label: "english" }]);
189+
}
190+
else if (this.pageSectionDetail.videoAsset.azureMediaAsset && !this.pageSectionDetail.videoAsset.closedCaptionsFile) {
191+
azureMediaPlayer.src([{
192+
type: "application/vnd.ms-sstr+xml",
193+
src: this.pageSectionDetail.videoAsset.azureMediaAsset.locatorUri,
194+
protectionInfo: [{ type: 'AES', authenticationToken: `Bearer=${this.pageSectionDetail.videoAsset.azureMediaAsset.authenticationToken}` }]
195+
}]);
196+
}
197+
});
198+
} else {
199+
contentData.getPageSectionDetail(this.section.id).then(x => this.pageSectionDetail = x);
200+
}
201+
},
185202
getAESProtection(token: string): string {
186203
var aesProtectionInfo = '{"protectionInfo": [{"type": "AES", "authenticationToken":"Bearer=' + token + '"}], "streamingFormats":["SMOOTH","DASH"]}';
187204
return aesProtectionInfo;
@@ -198,7 +215,7 @@
198215
},
199216
watch: {
200217
section() {
201-
this.load();
218+
this.load();
202219
}
203220
}
204221
})

0 commit comments

Comments
 (0)