Skip to content

Commit

Permalink
- Added export buttons to management interface
Browse files Browse the repository at this point in the history
- Some small fixes
  • Loading branch information
MarcusWichelmann committed Dec 9, 2019
1 parent ce39b11 commit ae2a4c8
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ COPY . /src
WORKDIR /src/Nesteo.Server

# Restore packages
RUN npm install --with-dev
RUN npm install

# Run build task
RUN npx grunt default
Expand Down
2 changes: 1 addition & 1 deletion Nesteo.Server/Controllers/Api/NestingBoxesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public IAsyncEnumerable<InspectionPreview> GetInspectionPreviewsByNestingBoxIdAs
/// </summary>
[HttpGet("csv")]
[ProducesResponseType(StatusCodes.Status200OK)]
public Task<IActionResult> ExportNestingBoxAsync()
public Task<IActionResult> ExportNestingBoxesAsync()
{
string fileDownloadName = $"nesting-boxes-export-{DateTime.Now}.csv";
IAsyncEnumerable<string> records = _nestingBoxService.ExportAllRowsAsync();
Expand Down
11 changes: 11 additions & 0 deletions Nesteo.Server/Pages/Management/Data.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@page "/data"
@model DataModel
@{
ViewData["Title"] = "Data";
}

<p>Use the buttons below to download all nesting boxes or inspections as CSV file for use with other tools.</p>

<a class="btn btn-primary" asp-controller="NestingBoxes" asp-action="ExportNestingBoxesAsync">Download nesting boxes</a>
<a class="btn btn-primary" asp-controller="Inspections" asp-action="ExportInspectionsAsync">Download inspections</a>

6 changes: 6 additions & 0 deletions Nesteo.Server/Pages/Management/Data.cshtml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace Nesteo.Server.Pages.Management
{
public class DataModel : PageModel { }
}
2 changes: 1 addition & 1 deletion Nesteo.Server/Pages/Management/Profile/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
}

<div class="row">
<div class="col-md-3">
<div class="col-md-3 mb-4">
<partial name="_ProfileNav"/>
</div>
<div class="col-md-9">
Expand Down
14 changes: 8 additions & 6 deletions Nesteo.Server/Pages/Management/Users.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@
@foreach (UserEntity user in Model.Users)
{
<tr>
<th scope="row">@user.UserName</th>
<td>@user.FirstName</td>
<td>@user.LastName</td>
<td>@(user.Email ?? "-")</td>
<td>@(user.PhoneNumber ?? "-")</td>
<td>ACTIONS</td>
<th class="align-middle" scope="row">@user.UserName</th>
<td class="align-middle">@user.FirstName</td>
<td class="align-middle">@user.LastName</td>
<td class="align-middle">@(user.Email ?? "-")</td>
<td class="align-middle">@(user.PhoneNumber ?? "-")</td>
<td class="align-middle">
<a class="btn btn-primary btn-sm" asp-page="/Management/EditUser" asp-route-userName="@user.UserName">Edit</a>
</td>
</tr>
}
<tr>
Expand Down
2 changes: 1 addition & 1 deletion Nesteo.Server/Pages/Management/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<a class="nav-link" asp-page="/Management/Users">Users</a>
</li>
<li class="nav-item">
<a class="nav-link" asp-page="">Data</a>
<a class="nav-link" asp-page="/Management/Data">Data</a>
</li>
</ul>
<ul class="navbar-nav">
Expand Down

0 comments on commit ae2a4c8

Please sign in to comment.