Skip to content

Commit b805ae6

Browse files
authored
Merge pull request #3336 from TechnologyEnhancedLearning/DLS-Release-v1.2.1-Hotfix
Dls release v1.2.1 hotfix-3.0
2 parents 6e73fc2 + 3ea181e commit b805ae6

File tree

6 files changed

+57
-33
lines changed

6 files changed

+57
-33
lines changed

DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
namespace DigitalLearningSolutions.Web.Controllers.TrackingSystem.Centre.SelfAssessmentReports
22
{
3+
using DigitalLearningSolutions.Data.Enums;
4+
using DigitalLearningSolutions.Data.Extensions;
35
using DigitalLearningSolutions.Data.Services;
4-
using DigitalLearningSolutions.Web.Helpers;
5-
using Microsoft.AspNetCore.Authorization;
6-
using Microsoft.AspNetCore.Mvc;
7-
using Microsoft.FeatureManagement.Mvc;
6+
using DigitalLearningSolutions.Data.Utilities;
87
using DigitalLearningSolutions.Web.Attributes;
8+
using DigitalLearningSolutions.Web.Helpers;
9+
using DigitalLearningSolutions.Web.Helpers.ExternalApis;
910
using DigitalLearningSolutions.Web.Models.Enums;
10-
using DigitalLearningSolutions.Data.Enums;
11-
using DigitalLearningSolutions.Data.Utilities;
11+
using DigitalLearningSolutions.Web.Services;
1212
using DigitalLearningSolutions.Web.ViewModels.TrackingSystem.Centre.Reports;
13-
using DigitalLearningSolutions.Web.Helpers.ExternalApis;
13+
using Microsoft.AspNetCore.Authorization;
14+
using Microsoft.AspNetCore.Mvc;
1415
using Microsoft.Extensions.Configuration;
15-
using DigitalLearningSolutions.Data.Extensions;
16-
using DigitalLearningSolutions.Web.Services;
16+
using Microsoft.FeatureManagement;
17+
using Microsoft.FeatureManagement.Mvc;
18+
using System;
19+
using System.Threading.Tasks;
1720

1821
[FeatureGate(FeatureFlags.RefactoredTrackingSystem)]
1922
[Authorize(Policy = CustomPolicies.UserCentreAdmin)]
@@ -30,12 +33,14 @@ public class SelfAssessmentReportsController : Controller
3033
private readonly string workbookName;
3134
private readonly string viewName;
3235
private readonly ISelfAssessmentService selfAssessmentService;
36+
private readonly IFeatureManager featureManager;
3337
public SelfAssessmentReportsController(
3438
ISelfAssessmentReportService selfAssessmentReportService,
3539
ITableauConnectionHelperService tableauConnectionHelper,
3640
IClockUtility clockUtility,
3741
IConfiguration config,
38-
ISelfAssessmentService selfAssessmentService
42+
ISelfAssessmentService selfAssessmentService,
43+
IFeatureManager featureManager
3944
)
4045
{
4146
this.selfAssessmentReportService = selfAssessmentReportService;
@@ -46,13 +51,17 @@ ISelfAssessmentService selfAssessmentService
4651
workbookName = config.GetTableauWorkbookName();
4752
viewName = config.GetTableauViewName();
4853
this.selfAssessmentService = selfAssessmentService;
54+
this.featureManager = featureManager;
4955
}
50-
public IActionResult Index()
56+
public async Task<IActionResult> IndexAsync()
5157
{
5258
var centreId = User.GetCentreId();
5359
var adminCategoryId = User.GetAdminCategoryId();
5460
var categoryId = this.selfAssessmentService.GetSelfAssessmentCategoryId(1);
55-
var model = new SelfAssessmentReportsViewModel(selfAssessmentReportService.GetSelfAssessmentsForReportList((int)centreId, adminCategoryId), adminCategoryId, categoryId);
61+
var tableauFlag = await featureManager.IsEnabledAsync(FeatureFlags.TableauSelfAssessmentDashboards);
62+
var tableauQueryOverride = string.Equals(Request.Query["tableaulink"], "true", StringComparison.OrdinalIgnoreCase);
63+
var showTableauLink = tableauFlag || tableauQueryOverride;
64+
var model = new SelfAssessmentReportsViewModel(selfAssessmentReportService.GetSelfAssessmentsForReportList((int)centreId, adminCategoryId), adminCategoryId, categoryId, showTableauLink);
5665
return View(model);
5766
}
5867
[HttpGet]
@@ -84,19 +93,22 @@ public IActionResult DownloadSelfAssessmentReport(int selfAssessmentId)
8493
}
8594
[HttpGet]
8695
[Route("TableauCompetencyDashboard")]
87-
public IActionResult TableauCompetencyDashboard()
96+
public async Task<IActionResult> TableauCompetencyDashboardAsync()
8897
{
8998
var userEmail = User.GetUserPrimaryEmail();
9099
var adminId = User.GetAdminId();
91100
var jwt = tableauConnectionHelper.GetTableauJwt();
101+
var tableauFlag = await featureManager.IsEnabledAsync(FeatureFlags.TableauSelfAssessmentDashboards);
102+
var tableauQueryOverride = string.Equals(Request.Query["tableaulink"], "true", StringComparison.OrdinalIgnoreCase);
103+
var showTableauLink = tableauFlag || tableauQueryOverride;
92104
ViewBag.Email = userEmail;
93105
ViewBag.AdminId = adminId;
94106
ViewBag.SiteName = tableauSiteName;
95107
ViewBag.TableauServerUrl = tableauUrl;
96108
ViewBag.WorkbookName = workbookName;
97109
ViewBag.ViewName = viewName;
98110
ViewBag.JwtToken = jwt;
99-
111+
ViewBag.ShowTableauLink = showTableauLink;
100112
return View();
101113
}
102114
}

DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Centre/Reports/SelfAssessmentReportsViewModel.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@
66
public class SelfAssessmentReportsViewModel
77
{
88
public SelfAssessmentReportsViewModel(
9-
IEnumerable<SelfAssessmentSelect> selfAssessmentSelects, int? adminCategoryId, int categoryId
9+
IEnumerable<SelfAssessmentSelect> selfAssessmentSelects, int? adminCategoryId, int categoryId, bool showTableauLink
1010
)
1111
{
1212
SelfAssessmentSelects = selfAssessmentSelects;
1313
AdminCategoryId = adminCategoryId;
1414
CategoryId = categoryId;
15+
ShowTableauLink = showTableauLink;
1516
}
1617
public IEnumerable<SelfAssessmentSelect> SelfAssessmentSelects { get; set; }
1718
public int? AdminCategoryId { get; set; }
1819
public int CategoryId { get; set; }
20+
public bool ShowTableauLink { get; set; } = false;
1921
}
2022
}

DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/Index.cshtml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
@model SelfAssessmentReportsViewModel
55
@{
66
ViewData["Title"] = "Self assessment reports";
7+
var routeData = new Dictionary<string, string>();
8+
9+
if (string.Equals(Context.Request.Query["tableaulink"], "true", StringComparison.OrdinalIgnoreCase))
10+
{
11+
routeData["tableaulink"] = "true";
12+
}
713
}
814
<div class="nhsuk-grid-row">
915
<div class="nhsuk-grid-column-one-quarter">
@@ -19,22 +25,21 @@
1925
<span class="nhsuk-u-visually-hidden"> - </span>
2026
</span>@ViewData["Title"]
2127
</h1>
22-
<feature name="@(FeatureFlags.TableauSelfAssessmentDashboards)">
23-
@if (Model.SelfAssessmentSelects.Any())
24-
{
25-
<vc:action-link asp-controller="SelfAssessmentReports" asp-action="TableauCompetencyDashboard" asp-all-route-data="@new Dictionary<string, string>();" link-text="View Tableau supervised self assessments dashboard" />
26-
}
27-
</feature>
28+
@if (Model.ShowTableauLink && Model.SelfAssessmentSelects.Any())
29+
{
30+
<vc:action-link asp-controller="SelfAssessmentReports"
31+
asp-all-route-data="routeData" asp-action="TableauCompetencyDashboard" link-text="View Tableau supervised self assessments dashboard" />
32+
}
2833
<h2>Excel learner activity reports</h2>
2934
<p class="nhsuk-lede-text">Download Excel competency self assessments activity reports for your centre.</p>
3035
<ul>
31-
@if((Model.AdminCategoryId == null) || (Model.AdminCategoryId == Model.CategoryId))
32-
{
33-
<li>
34-
<a asp-controller="SelfAssessmentReports" asp-action="DownloadDigitalCapabilityToExcel">Digital Skills Assessment Tool - Download report</a>
36+
@if ((Model.AdminCategoryId == null) || (Model.AdminCategoryId == Model.CategoryId))
37+
{
38+
<li>
39+
<a asp-controller="SelfAssessmentReports" asp-action="DownloadDigitalCapabilityToExcel">Digital Skills Assessment Tool - Download report</a>
3540

36-
</li>
37-
}
41+
</li>
42+
}
3843
@if (Model.SelfAssessmentSelects.Any())
3944
{
4045
@foreach (var report in Model.SelfAssessmentSelects)

DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/TableauCompetencyDashboard.cshtml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
</div>
2121
<h1>@ViewData["Title"]</h1>
2222
<vc:inset-text css-class="" text="Use the full screen button below the Tableau dashboard (next to 'Share') for the best experience." />
23-
<feature name="@(FeatureFlags.TableauSelfAssessmentDashboards)">
23+
@if (ViewBag.ShowTableauLink)
24+
{
2425
<tableau-viz id='tableau-viz'
2526
src='@srcUrl' token='@jwtToken' toolbar='bottom'>
2627
If the dashboard doesn't appear after a few seconds, <a href="#">reload the page</a>
@@ -32,8 +33,10 @@
3233
<script type="module" src="@tableauServerUrl/javascripts/api/tableau.embedding.3.latest.min.js"></script>
3334
<script src="@Url.Content("~/js/trackingSystem/tableaureports.js")" asp-append-version="true"></script>
3435
}
35-
</feature>
36-
<feature name="@(FeatureFlags.TableauSelfAssessmentDashboards)" negate="true">
36+
}
37+
else
38+
{
3739
<h2>Oops! We are still working on this area of the site</h2>
3840
<p class="nhsuk-lede-text">This feature is under development and should be available soon.</p>
39-
</feature>
41+
}
42+

DigitalLearningSolutions.Web/appSettings.UAT.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"UserFeedbackBar": true,
2323
"ExportQueryRowLimit": 250,
2424
"MaxBulkUploadRows": 200,
25-
"LoginWithLearningHub": true
25+
"LoginWithLearningHub": true,
26+
"TableauSelfAssessmentDashboards": false
2627
},
2728
"LearningHubOpenAPIBaseUrl": "https://uks-learninghubnhsuk-openapi-test.azurewebsites.net",
2829
"FreshdeskAPIConfig": {

DigitalLearningSolutions.Web/appsettings.Development.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"UserFeedbackBar": true,
2323
"ExportQueryRowLimit": 250,
2424
"MaxBulkUploadRows": 200,
25-
"LoginWithLearningHub": true
25+
"LoginWithLearningHub": true,
26+
"TableauSelfAssessmentDashboards": false
2627
},
2728
"LearningHubOpenAPIBaseUrl": "https://uks-learninghubnhsuk-openapi-test.azurewebsites.net",
2829
"LearningHubReportAPIConfig": {

0 commit comments

Comments
 (0)