diff --git a/DigitalLearningSolutions.Web.Tests/Controllers/SupervisorController/SupervisorControllerTests.cs b/DigitalLearningSolutions.Web.Tests/Controllers/SupervisorController/SupervisorControllerTests.cs index 7330042c4e..7dddbd0e55 100644 --- a/DigitalLearningSolutions.Web.Tests/Controllers/SupervisorController/SupervisorControllerTests.cs +++ b/DigitalLearningSolutions.Web.Tests/Controllers/SupervisorController/SupervisorControllerTests.cs @@ -16,6 +16,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; + using Microsoft.FeatureManagement; using NUnit.Framework; using System.Collections.Generic; using System.Linq; @@ -49,6 +50,7 @@ public class SupervisorControllerTests private IPdfService pdfService = null!; private SupervisorController controller = null!; private ICourseCategoriesService courseCategoriesService = null!; + private IFeatureManager featureManager = null!; [SetUp] public void Setup() @@ -73,6 +75,7 @@ public void Setup() candidateAssessmentDownloadFileService = A.Fake(); pdfService = A.Fake(); courseCategoriesService = A.Fake(); + featureManager = A.Fake(); A.CallTo(() => candidateAssessmentDownloadFileService.GetCandidateAssessmentDownloadFileForCentre(A._, A._, A._)) .Returns(new byte[] { }); @@ -108,7 +111,8 @@ public void Setup() candidateAssessmentDownloadFileService, clockUtility, pdfService, - courseCategoriesService + courseCategoriesService, + featureManager ); controller.ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext { User = user } }; @@ -140,7 +144,8 @@ public void ExportCandidateAssessment_should_return_file_object_with_file_name_i candidateAssessmentDownloadFileService, clockUtility, pdfService, - courseCategoriesService + courseCategoriesService, + featureManager ); string expectedFileName = $"{((selfAssessmentName.Length > 30) ? selfAssessmentName.Substring(0, 30) : selfAssessmentName)} - {delegateName} - {clockUtility.UtcNow:yyyy-MM-dd}.xlsx"; diff --git a/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs b/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs index 3d22fb71fb..4fac46e109 100644 --- a/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs +++ b/DigitalLearningSolutions.Web/Controllers/SupervisorController/Supervisor.cs @@ -27,7 +27,7 @@ public partial class SupervisorController { - public IActionResult Index() + public async Task IndexAsync() { var adminId = GetAdminId(); var dashboardData = supervisorService.GetDashboardDataForAdminId(adminId); @@ -35,11 +35,15 @@ public IActionResult Index() var reviewRequests = supervisorService.GetSupervisorDashboardToDoItemsForRequestedReviews(adminId); var supervisorDashboardToDoItems = Enumerable.Concat(signOffRequests, reviewRequests); var bannerText = GetBannerText(); + var tableauFlag = await featureManager.IsEnabledAsync(FeatureFlags.TableauSelfAssessmentDashboards); + var tableauQueryOverride = string.Equals(Request.Query["tableaulink"], "true", StringComparison.OrdinalIgnoreCase); + var showTableauLink = tableauFlag || tableauQueryOverride; var model = new SupervisorDashboardViewModel() { DashboardData = dashboardData, SupervisorDashboardToDoItems = supervisorDashboardToDoItems, - BannerText = bannerText + BannerText = bannerText, + ShowTableauLink = showTableauLink }; return View(model); } diff --git a/DigitalLearningSolutions.Web/Controllers/SupervisorController/SupervisorController.cs b/DigitalLearningSolutions.Web/Controllers/SupervisorController/SupervisorController.cs index 476000816f..e61cae3b7b 100644 --- a/DigitalLearningSolutions.Web/Controllers/SupervisorController/SupervisorController.cs +++ b/DigitalLearningSolutions.Web/Controllers/SupervisorController/SupervisorController.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; + using Microsoft.FeatureManagement; [Authorize(Policy = CustomPolicies.UserSupervisor)] public partial class SupervisorController : Controller @@ -28,7 +29,7 @@ public partial class SupervisorController : Controller private readonly IClockUtility clockUtility; private readonly IPdfService pdfService; private readonly ICourseCategoriesService courseCategoriesService; - + private readonly IFeatureManager featureManager; public SupervisorController( ISupervisorService supervisorService, ICommonService commonService, @@ -49,7 +50,8 @@ public SupervisorController( ICandidateAssessmentDownloadFileService candidateAssessmentDownloadFileService, IClockUtility clockUtility, IPdfService pdfService, - ICourseCategoriesService courseCategoriesService + ICourseCategoriesService courseCategoriesService, + IFeatureManager featureManager ) { this.supervisorService = supervisorService; @@ -68,6 +70,7 @@ ICourseCategoriesService courseCategoriesService this.clockUtility = clockUtility; this.pdfService = pdfService; this.courseCategoriesService = courseCategoriesService; + this.featureManager = featureManager; } private int GetCentreId() diff --git a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs index 2d4abaf2a7..5a59a12086 100644 --- a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs +++ b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs @@ -53,6 +53,7 @@ IFeatureManager featureManager this.selfAssessmentService = selfAssessmentService; this.featureManager = featureManager; } + [Route("/TrackingSystem/Centre/Reports/SelfAssessments")] public async Task IndexAsync() { var centreId = User.GetCentreId(); @@ -65,7 +66,7 @@ public async Task IndexAsync() return View(model); } [HttpGet] - [Route("DownloadDcsa")] + [Route("/TrackingSystem/Centre/Reports/DownloadDcsa")] public IActionResult DownloadDigitalCapabilityToExcel() { var centreId = User.GetCentreIdKnownNotNull(); @@ -78,7 +79,7 @@ public IActionResult DownloadDigitalCapabilityToExcel() ); } [HttpGet] - [Route("DownloadReport")] + [Route("/TrackingSystem/Centre/Reports/DownloadReport")] public IActionResult DownloadSelfAssessmentReport(int selfAssessmentId) { var centreId = User.GetCentreId(); @@ -92,8 +93,8 @@ public IActionResult DownloadSelfAssessmentReport(int selfAssessmentId) ); } [HttpGet] - [Route("TableauCompetencyDashboard")] - public async Task TableauCompetencyDashboardAsync() + [Route("/{source}/Reports/TableauCompetencyDashboard")] + public async Task TableauCompetencyDashboardAsync(string source = "TrackingSystem") { var userEmail = User.GetUserPrimaryEmail(); var adminId = User.GetAdminId(); @@ -101,6 +102,7 @@ public async Task TableauCompetencyDashboardAsync() var tableauFlag = await featureManager.IsEnabledAsync(FeatureFlags.TableauSelfAssessmentDashboards); var tableauQueryOverride = string.Equals(Request.Query["tableaulink"], "true", StringComparison.OrdinalIgnoreCase); var showTableauLink = tableauFlag || tableauQueryOverride; + ViewBag.Source = source; ViewBag.Email = userEmail; ViewBag.AdminId = adminId; ViewBag.SiteName = tableauSiteName; diff --git a/DigitalLearningSolutions.Web/ViewModels/Supervisor/SupervisorDashboardViewModel.cs b/DigitalLearningSolutions.Web/ViewModels/Supervisor/SupervisorDashboardViewModel.cs index 301e96fe77..067803fd78 100644 --- a/DigitalLearningSolutions.Web/ViewModels/Supervisor/SupervisorDashboardViewModel.cs +++ b/DigitalLearningSolutions.Web/ViewModels/Supervisor/SupervisorDashboardViewModel.cs @@ -8,5 +8,6 @@ public class SupervisorDashboardViewModel public string? BannerText; public DashboardData DashboardData { get; set; } public IEnumerable SupervisorDashboardToDoItems { get; set; } + public bool ShowTableauLink { get; set; } = false; } } diff --git a/DigitalLearningSolutions.Web/Views/Supervisor/Index.cshtml b/DigitalLearningSolutions.Web/Views/Supervisor/Index.cshtml index 1242abf69b..de1ff2bffc 100644 --- a/DigitalLearningSolutions.Web/Views/Supervisor/Index.cshtml +++ b/DigitalLearningSolutions.Web/Views/Supervisor/Index.cshtml @@ -6,6 +6,12 @@ ViewData["Title"] = "Dashboard"; ViewData["Application"] = "Supervisor"; ViewData["HeaderPathName"] = "Supervisor"; + var routeData = (new Dictionary() { { "source", "Supervisor" } }); + + if (string.Equals(Context.Request.Query["tableaulink"], "true", StringComparison.OrdinalIgnoreCase)) + { + routeData["tableaulink"] = "true"; + } } @section NavMenuItems { @@ -96,3 +102,10 @@ else + +@if (Model.ShowTableauLink) +{ +

Progress reports

+ +} diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/Index.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/Index.cshtml index 67792bf87d..fa25c11a8a 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/Index.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/Index.cshtml @@ -4,7 +4,7 @@ @model SelfAssessmentReportsViewModel @{ ViewData["Title"] = "Self assessment reports"; - var routeData = new Dictionary(); + var routeData = (new Dictionary() { { "source", "TrackingSystem" } }); if (string.Equals(Context.Request.Query["tableaulink"], "true", StringComparison.OrdinalIgnoreCase)) { diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/TableauCompetencyDashboard.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/TableauCompetencyDashboard.cshtml index a5743efeea..97fd535837 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/TableauCompetencyDashboard.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/TableauCompetencyDashboard.cshtml @@ -11,7 +11,7 @@ ViewData["Title"] = "Supervised self assessments dashboard"; }