feature: job exporting (resolves #155)

This commit is contained in:
Gary Sharp
2024-12-12 16:02:12 +11:00
parent 90c709c4c1
commit a6b9cd1af2
55 changed files with 3197 additions and 412 deletions
+18 -7
View File
@@ -1,5 +1,4 @@
@using Disco.Web.Models.Device;
@using Disco.Models.Services.Devices;
@model ExportModel
@{
Authorization.RequireAny(Claims.Device.Actions.Export);
@@ -13,11 +12,13 @@
<div id="Devices_Export">
@using (Html.BeginForm(MVC.API.Device.Export()))
{
@Html.AntiForgeryToken()
<div id="Devices_Export_Type" class="form" style="width: 570px">
<h2>Export Type</h2>
<table>
<tr>
<th style="width: 150px">Type:
<th style="width: 150px">
Type:
</th>
<td>
@Html.DropDownListFor(m => m.Options.ExportType, Enum.GetNames(typeof(Disco.Models.Services.Devices.Exporting.DeviceExportTypes)).Select(t => new SelectListItem() { Text = t, Value = t }))
@@ -64,7 +65,8 @@
@foreach (var optionItem in optionFields.Take(itemsPerColumn))
{
<li title="@optionItem.Description">
<input type="checkbox" id="Options_@optionItem.PropertyName" name="Options.@optionItem.PropertyName" value="true" @(((bool)optionItem.Model) ? "checked " : null)/><label for="Options_@optionItem.PropertyName">@optionItem.DisplayName</label></li>
<input type="checkbox" id="Options_@optionItem.PropertyName" name="Options.@optionItem.PropertyName" value="true" @(((bool)optionItem.Model) ? "checked " : null) /><label for="Options_@optionItem.PropertyName">@optionItem.DisplayName</label>
</li>
}
</ul>
</td>
@@ -73,7 +75,8 @@
@foreach (var optionItem in optionFields.Skip(itemsPerColumn))
{
<li title="@optionItem.Description">
<input type="checkbox" id="Options_@optionItem.PropertyName" name="Options.@optionItem.PropertyName" value="true" @(((bool)optionItem.Model) ? "checked " : null)/><label for="Options_@optionItem.PropertyName">@optionItem.DisplayName</label></li>
<input type="checkbox" id="Options_@optionItem.PropertyName" name="Options.@optionItem.PropertyName" value="true" @(((bool)optionItem.Model) ? "checked " : null) /><label for="Options_@optionItem.PropertyName">@optionItem.DisplayName</label>
</li>
}
</ul>
</td>
@@ -81,7 +84,8 @@
</table>
</div>
</td>
</tr>
</tr>
}
</table>
</div>
@@ -174,8 +178,15 @@
@if (Model.ExportSessionId != null)
{
<div id="Devices_Export_Download_Dialog" class="dialog" title="Export Devices">
<h4>@Model.ExportSessionResult.RecordCount record@(Model.ExportSessionResult.RecordCount != 1 ? "s" : null) were successfully exported.</h4>
<a href="@Url.Action(MVC.API.Device.ExportRetrieve(Model.ExportSessionId))" class="button"><i class="fa fa-download fa-lg"></i>Download Device Export</a>
@if (Model.ExportSessionResult.RecordCount == 0)
{
<h4>No records matched the filter criteria</h4>
}
else
{
<h4>@Model.ExportSessionResult.RecordCount record@(Model.ExportSessionResult.RecordCount != 1 ? "s" : null) were successfully exported.</h4>
<a href="@Url.Action(MVC.API.Device.ExportRetrieve(Model.ExportSessionId))" class="button"><i class="fa fa-download fa-lg"></i>Download Device Export</a>
}
</div>
<script>
$(function () {