-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added sighting statistics report to the UI
- Loading branch information
1 parent
e65760e
commit 3715767
Showing
6 changed files
with
118 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/FlightRecorder.Mvc/Controllers/SightingStatisticsController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using FlightRecorder.Mvc.Api; | ||
using FlightRecorder.Mvc.Configuration; | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Extensions.Options; | ||
|
||
namespace FlightRecorder.Mvc.Controllers | ||
{ | ||
[Authorize] | ||
public class SightingStatisticsController : Controller | ||
{ | ||
private readonly ReportsClient _reportsClient; | ||
private readonly IOptions<AppSettings> _settings; | ||
|
||
public SightingStatisticsController( | ||
ReportsClient reportsClient, | ||
IOptions<AppSettings> settings) | ||
{ | ||
_reportsClient = reportsClient; | ||
_settings = settings; | ||
} | ||
|
||
/// <summary> | ||
/// Retrieve and serve the report | ||
/// </summary> | ||
/// <returns></returns> | ||
[HttpGet] | ||
public async Task<IActionResult> Index() | ||
{ | ||
var report = await _reportsClient.SightingStatisticsAsync(); | ||
return View(report); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace FlightRecorder.Mvc.Entities | ||
{ | ||
public record SightingStatistics | ||
( | ||
int Aircraft, | ||
int Manufacturers, | ||
int Models, | ||
int Airlines, | ||
int Flights, | ||
int Sightings, | ||
int Locations | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/FlightRecorder.Mvc/Views/SightingStatistics/Index.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
@model FlightRecorder.Mvc.Entities.SightingStatistics | ||
|
||
@{ | ||
ViewData["Title"] = "Sighting Statistics Report"; | ||
} | ||
|
||
<p class="text-center font-weight-bold"> | ||
<span style="font-size: 1.2rem"> | ||
Sighting Statistics | ||
</span> | ||
<br /> | ||
<small class="text-muted"> | ||
<em> | ||
Produce summary statistics for all sightings | ||
</em> | ||
</small> | ||
</p> | ||
|
||
<div class="container-fluid"> | ||
<table class="table"> | ||
<tr> | ||
<th>Aircraft</th> | ||
<td>@Model.Aircraft</td> | ||
</tr> | ||
<tr> | ||
<th>Models</th> | ||
<td>@Model.Models</td> | ||
</tr> | ||
<tr> | ||
<th>Manufacturers</th> | ||
<td>@Model.Manufacturers</td> | ||
</tr> | ||
<tr> | ||
<th>Airlines</th> | ||
<td>@Model.Airlines</td> | ||
</tr> | ||
<tr> | ||
<th>Flights</th> | ||
<td>@Model.Flights</td> | ||
</tr> | ||
<tr> | ||
<th>Sightings</th> | ||
<td>@Model.Sightings</td> | ||
</tr> | ||
<tr> | ||
<th>Locations</th> | ||
<td>@Model.Locations</td> | ||
</tr> | ||
</table> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters