Skip to content

Commit 801ea9b

Browse files
committed
Starts to add view and controller code
1 parent 3a0b5de commit 801ea9b

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using System;
1212
using DigitalLearningSolutions.Data.Utilities;
1313
using DigitalLearningSolutions.Web.ViewModels.TrackingSystem.Centre.Reports;
14+
using DigitalLearningSolutions.Web.Helpers.ExternalApis;
1415

1516
[FeatureGate(FeatureFlags.RefactoredTrackingSystem)]
1617
[Authorize(Policy = CustomPolicies.UserCentreAdmin)]
@@ -20,14 +21,17 @@
2021
public class SelfAssessmentReportsController : Controller
2122
{
2223
private readonly ISelfAssessmentReportService selfAssessmentReportService;
24+
private readonly ITableauConnectionHelperService tableauConnectionHelper;
2325
private readonly IClockUtility clockUtility;
2426

2527
public SelfAssessmentReportsController(
2628
ISelfAssessmentReportService selfAssessmentReportService,
29+
ITableauConnectionHelperService tableauConnectionHelper,
2730
IClockUtility clockUtility
2831
)
2932
{
3033
this.selfAssessmentReportService = selfAssessmentReportService;
34+
this.tableauConnectionHelper = tableauConnectionHelper;
3135
this.clockUtility = clockUtility;
3236
}
3337
public IActionResult Index()
@@ -63,5 +67,13 @@ public IActionResult DownloadSelfAssessmentReport(int selfAssessmentId)
6367
fileName
6468
);
6569
}
70+
[HttpGet]
71+
[Route("LaunchTableauDashboards")]
72+
public IActionResult LaunchTableauDashboards()
73+
{
74+
var userEmail = User.GetUserPrimaryEmail();
75+
var jwt = tableauConnectionHelper.GetTableauJwt(userEmail);
76+
return RedirectToAction("Index");
77+
}
6678
}
6779
}

DigitalLearningSolutions.Web/Helpers/ExternalApis/TableauConnectionHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
public interface ITableauConnectionHelperService
1313
{
14-
string GetToken(string email);
14+
string GetTableauJwt(string email);
1515
}
1616
public class TableauConnectionHelper : ITableauConnectionHelperService
1717
{
@@ -26,7 +26,7 @@ public TableauConnectionHelper(IConfiguration config)
2626
connectedAppSecretKey = config.GetTableauClientSecret();
2727
user = config.GetTableauUser();
2828
}
29-
public string GetToken(string email)
29+
public string GetTableauJwt(string email)
3030
{
3131
var tokenHandler = new JwtSecurityTokenHandler();
3232
var key = Encoding.ASCII.GetBytes(connectedAppSecretKey);

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,10 @@
4141
}
4242
}
4343
</ul>
44+
@if (Model.SelfAssessmentSelects.Any())
45+
{
46+
<a asp-controller="SelfAssessmentReports" asp-action="LaunchTableau">@($"View Tableau Competency Dashboards")</a>
47+
}
48+
4449
</div>
4550
</div>

0 commit comments

Comments
 (0)