Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
Expand All @@ -73,6 +75,7 @@ public void Setup()
candidateAssessmentDownloadFileService = A.Fake<ICandidateAssessmentDownloadFileService>();
pdfService = A.Fake<IPdfService>();
courseCategoriesService = A.Fake<ICourseCategoriesService>();
featureManager = A.Fake<IFeatureManager>();
A.CallTo(() => candidateAssessmentDownloadFileService.GetCandidateAssessmentDownloadFileForCentre(A<int>._, A<int>._, A<bool>._))
.Returns(new byte[] { });

Expand Down Expand Up @@ -108,7 +111,8 @@ public void Setup()
candidateAssessmentDownloadFileService,
clockUtility,
pdfService,
courseCategoriesService
courseCategoriesService,
featureManager
);
controller.ControllerContext = new ControllerContext
{ HttpContext = new DefaultHttpContext { User = user } };
Expand Down Expand Up @@ -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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,23 @@

public partial class SupervisorController
{
public IActionResult Index()
public async Task<IActionResult> IndexAsync()
{
var adminId = GetAdminId();
var dashboardData = supervisorService.GetDashboardDataForAdminId(adminId);
var signOffRequests = supervisorService.GetSupervisorDashboardToDoItemsForRequestedSignOffs(adminId);
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -49,7 +50,8 @@ public SupervisorController(
ICandidateAssessmentDownloadFileService candidateAssessmentDownloadFileService,
IClockUtility clockUtility,
IPdfService pdfService,
ICourseCategoriesService courseCategoriesService
ICourseCategoriesService courseCategoriesService,
IFeatureManager featureManager
)
{
this.supervisorService = supervisorService;
Expand All @@ -68,6 +70,7 @@ ICourseCategoriesService courseCategoriesService
this.clockUtility = clockUtility;
this.pdfService = pdfService;
this.courseCategoriesService = courseCategoriesService;
this.featureManager = featureManager;
}

private int GetCentreId()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ IFeatureManager featureManager
this.selfAssessmentService = selfAssessmentService;
this.featureManager = featureManager;
}
[Route("/TrackingSystem/Centre/Reports/SelfAssessments")]
public async Task<IActionResult> IndexAsync()
{
var centreId = User.GetCentreId();
Expand All @@ -65,7 +66,7 @@ public async Task<IActionResult> IndexAsync()
return View(model);
}
[HttpGet]
[Route("DownloadDcsa")]
[Route("/TrackingSystem/Centre/Reports/DownloadDcsa")]
public IActionResult DownloadDigitalCapabilityToExcel()
{
var centreId = User.GetCentreIdKnownNotNull();
Expand All @@ -78,7 +79,7 @@ public IActionResult DownloadDigitalCapabilityToExcel()
);
}
[HttpGet]
[Route("DownloadReport")]
[Route("/TrackingSystem/Centre/Reports/DownloadReport")]
public IActionResult DownloadSelfAssessmentReport(int selfAssessmentId)
{
var centreId = User.GetCentreId();
Expand All @@ -92,15 +93,16 @@ public IActionResult DownloadSelfAssessmentReport(int selfAssessmentId)
);
}
[HttpGet]
[Route("TableauCompetencyDashboard")]
public async Task<IActionResult> TableauCompetencyDashboardAsync()
[Route("/{source}/Reports/TableauCompetencyDashboard")]
public async Task<IActionResult> TableauCompetencyDashboardAsync(string source = "TrackingSystem")
{
var userEmail = User.GetUserPrimaryEmail();
var adminId = User.GetAdminId();
var jwt = tableauConnectionHelper.GetTableauJwt();
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ public class SupervisorDashboardViewModel
public string? BannerText;
public DashboardData DashboardData { get; set; }
public IEnumerable<SupervisorDashboardToDoItem> SupervisorDashboardToDoItems { get; set; }
public bool ShowTableauLink { get; set; } = false;
}
}
13 changes: 13 additions & 0 deletions DigitalLearningSolutions.Web/Views/Supervisor/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
ViewData["Title"] = "Dashboard";
ViewData["Application"] = "Supervisor";
ViewData["HeaderPathName"] = "Supervisor";
var routeData = (new Dictionary<string, string>() { { "source", "Supervisor" } });

if (string.Equals(Context.Request.Query["tableaulink"], "true", StringComparison.OrdinalIgnoreCase))
{
routeData["tableaulink"] = "true";
}
}
<link rel="stylesheet" href="@Url.Content("~/css/frameworks/frameworksShared.css")" asp-append-version="true">
@section NavMenuItems {
Expand Down Expand Up @@ -96,3 +102,10 @@ else
</li>
</feature>
</ul>

@if (Model.ShowTableauLink)
{
<h2>Progress reports</h2>
<vc:action-link asp-controller="SelfAssessmentReports"
asp-all-route-data="routeData" asp-action="TableauCompetencyDashboard" link-text="View supervised self assessments dashboard" />
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@model SelfAssessmentReportsViewModel
@{
ViewData["Title"] = "Self assessment reports";
var routeData = new Dictionary<string, string>();
var routeData = (new Dictionary<string, string>() { { "source", "TrackingSystem" } });

if (string.Equals(Context.Request.Query["tableaulink"], "true", StringComparison.OrdinalIgnoreCase))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
ViewData["Title"] = "Supervised self assessments dashboard";
}
<div class="nhsuk-back-link">
<a class="nhsuk-back-link__link" role="button" asp-action="Index">
<a class="nhsuk-back-link__link" role="button" asp-controller="@(ViewBag.Source == "Supervisor" ? "Supervisor" : "SelfAssessmentReports")" asp-action="Index">
<svg class="nhsuk-icon nhsuk-icon__chevron-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" height="24" width="24">
<path d="M8.5 12c0-.3.1-.5.3-.7l5-5c.4-.4 1-.4 1.4 0s.4 1 0 1.4L10.9 12l4.3 4.3c.4.4.4 1 0 1.4s-1 .4-1.4 0l-5-5c-.2-.2-.3-.4-.3-.7z"></path>
</svg>
Expand Down
Loading