#34 Update: Additional Validation & UI Changes

Ensure at least one field is selected, and UI improvements.
This commit is contained in:
Gary Sharp
2014-05-22 12:11:26 +10:00
parent 3fdb4f1053
commit f70261aa25
15 changed files with 352 additions and 213 deletions
+5 -2
View File
@@ -102,6 +102,7 @@
<Compile Include="Repository\User\UserDetail.cs" />
<Compile Include="Repository\User\AuthorizationRole.cs" />
<Compile Include="Services\Devices\Exporting\DeviceExportRecord.cs" />
<Compile Include="Services\Devices\Exporting\DeviceExportResult.cs" />
<Compile Include="Services\Devices\Exporting\DeviceExportTypes.cs" />
<Compile Include="Services\Devices\Exporting\DeviceExportOptions.cs" />
<Compile Include="Services\Jobs\JobLists\JobLocationReference.cs" />
@@ -165,11 +166,13 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Folder Include="Services\Devices\Importing\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_StartDate="2011/7/1" BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildAction="Both" />
<UserProperties BuildVersion_BuildAction="Both" BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="False" BuildVersion_StartDate="2011/7/1" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" />
</VisualStudio>
</ProjectExtensions>
<PropertyGroup>
@@ -0,0 +1,10 @@
using System.IO;
namespace Disco.Models.Services.Devices.Exporting
{
public class DeviceExportResult
{
public MemoryStream CsvResult { get; set; }
public int RecordCount { get; set; }
}
}
+2 -1
View File
@@ -7,7 +7,8 @@ namespace Disco.Models.UI.Device
{
DeviceExportOptions Options { get; set; }
string DownloadExportSessionId { get; set; }
string ExportSessionId { get; set; }
DeviceExportResult ExportSessionResult { get; set; }
IEnumerable<KeyValuePair<int, string>> DeviceBatches { get; set; }
IEnumerable<KeyValuePair<int, string>> DeviceModels { get; set; }
@@ -11,12 +11,12 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Disco.Services.Devices.Export
namespace Disco.Services.Devices.Exporting
{
public static class DeviceExport
{
public static MemoryStream GenerateExport(DiscoDataContext Database, IQueryable<Device> Devices, DeviceExportOptions Options, IScheduledTaskBasicStatus TaskStatus)
public static DeviceExportResult GenerateExport(DiscoDataContext Database, IQueryable<Device> Devices, DeviceExportOptions Options, IScheduledTaskBasicStatus TaskStatus)
{
TaskStatus.UpdateStatus(15, "Building metadata and database query");
var metadata = Options.BuildMetadata();
@@ -70,14 +70,18 @@ namespace Disco.Services.Devices.Export
}
stream.Position = 0;
return stream;
return new DeviceExportResult()
{
CsvResult = stream,
RecordCount = records.Count
};
}
public static MemoryStream GenerateExport(DiscoDataContext Database, IQueryable<Device> Devices, DeviceExportOptions Options)
public static DeviceExportResult GenerateExport(DiscoDataContext Database, IQueryable<Device> Devices, DeviceExportOptions Options)
{
return GenerateExport(Database, Devices, Options, ScheduledTaskMockStatus.Create());
}
public static MemoryStream GenerateExport(DiscoDataContext Database, DeviceExportOptions Options, IScheduledTaskBasicStatus TaskStatus)
public static DeviceExportResult GenerateExport(DiscoDataContext Database, DeviceExportOptions Options, IScheduledTaskBasicStatus TaskStatus)
{
switch (Options.ExportType)
{
@@ -93,7 +97,7 @@ namespace Disco.Services.Devices.Export
throw new ArgumentException(string.Format("Unknown Device Export Type", Options.ExportType.ToString()), "Options");
}
}
public static MemoryStream GenerateExport(DiscoDataContext Database, DeviceExportOptions Options)
public static DeviceExportResult GenerateExport(DiscoDataContext Database, DeviceExportOptions Options)
{
return GenerateExport(Database, Options, ScheduledTaskMockStatus.Create());
}
@@ -7,7 +7,7 @@ using System.IO;
using System.Linq;
using Disco.Data.Repository;
namespace Disco.Services.Devices.Export
namespace Disco.Services.Devices.Exporting
{
public class DeviceExportTask : ScheduledTask
{
@@ -40,7 +40,7 @@ namespace Disco.Services.Devices.Export
using (DiscoDataContext Database = new DiscoDataContext())
{
context.CsvResult = DeviceExport.GenerateExport(Database, context.Options, this.Status);
context.Result = DeviceExport.GenerateExport(Database, context.Options, this.Status);
}
}
}
@@ -2,7 +2,7 @@
using Disco.Services.Tasks;
using System.IO;
namespace Disco.Services.Devices.Export
namespace Disco.Services.Devices.Exporting
{
public class DeviceExportTaskContext
{
@@ -10,7 +10,7 @@ namespace Disco.Services.Devices.Export
public ScheduledTaskStatus TaskStatus { get; set; }
public MemoryStream CsvResult { get; set; }
public DeviceExportResult Result { get; set; }
public DeviceExportTaskContext(DeviceExportOptions Options)
{
+7 -5
View File
@@ -172,9 +172,9 @@
<Compile Include="Authorization\Roles\RoleCache.cs" />
<Compile Include="Authorization\Roles\RoleClaims.cs" />
<Compile Include="Authorization\Roles\RoleToken.cs" />
<Compile Include="Devices\Export\DeviceExport.cs" />
<Compile Include="Devices\Export\DeviceExportTask.cs" />
<Compile Include="Devices\Export\DeviceExportTaskContext.cs" />
<Compile Include="Devices\Exporting\DeviceExport.cs" />
<Compile Include="Devices\Exporting\DeviceExportTask.cs" />
<Compile Include="Devices\Exporting\DeviceExportTaskContext.cs" />
<Compile Include="Extensions\DateTimeExtensions.cs" />
<Compile Include="Extensions\StringExtensions.cs" />
<Compile Include="Interop\ActiveDirectory\ActiveDirectory.cs" />
@@ -298,11 +298,13 @@
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Folder Include="Devices\Importing\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="False" BuildVersion_BuildAction="Both" BuildVersion_StartDate="2011/7/1" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" />
<UserProperties BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_StartDate="2011/7/1" BuildVersion_BuildAction="Both" BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="False" />
</VisualStudio>
</ProjectExtensions>
<PropertyGroup>
@@ -1,6 +1,6 @@
using Disco.BI.Extensions;
using Disco.Services.Authorization;
using Disco.Services.Devices.Export;
using Disco.Services.Devices.Exporting;
using Disco.Services.Interop.ActiveDirectory;
using Disco.Services.Users;
using Disco.Services.Web;
@@ -564,7 +564,7 @@ namespace Disco.Web.Areas.API.Controllers
#endregion
#region Exporting
private const string ExportSessionCacheKey = "DeviceExportContext_{0}";
internal const string ExportSessionCacheKey = "DeviceExportContext_{0}";
[DiscoAuthorize(Claims.Device.Actions.Export)]
public virtual ActionResult Export(ExportModel Model)
@@ -588,7 +588,7 @@ namespace Disco.Web.Areas.API.Controllers
exportContext.TaskStatus.SetFinishedUrl(Url.Action(finishedActionResult));
// Try waiting for completion
if (exportContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(1.5)))
if (exportContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(2)))
return RedirectToAction(finishedActionResult);
else
return RedirectToAction(MVC.Config.Logging.TaskStatus(exportContext.TaskStatus.SessionId));
@@ -605,12 +605,12 @@ namespace Disco.Web.Areas.API.Controllers
if (context == null)
throw new ArgumentException("The Id specified is invalid, or the export data expired (60 minutes)", "Id");
if (context.CsvResult == null)
if (context.Result == null || context.Result.CsvResult == null)
throw new ArgumentException("The export session is still running, or failed to complete successfully", "Id");
var filename = string.Format("DiscoDeviceExport-{0:yyyyMMdd-HHmmss}.csv", context.TaskStatus.StartedTimestamp.Value);
return File(context.CsvResult.ToArray(), "text/csv", filename);
return File(context.Result.CsvResult.ToArray(), "text/csv", filename);
}
#endregion
+8
View File
@@ -365,6 +365,14 @@
#Devices_Export_Download_Dialog a {
margin-bottom: 20px;
}
#Devices_Export_Exporting {
padding-top: 50px;
text-align: center;
}
#Devices_Export_Exporting i {
margin-right: 10px;
color: #1e6dab;
}
#deviceImport #ImportFile {
width: 100%;
}
+10
View File
@@ -347,6 +347,16 @@
}
}
#Devices_Export_Exporting {
padding-top: 50px;
text-align: center;
i {
margin-right: 10px;
color: @StatusInformation;
}
}
#deviceImport {
#ImportFile {
width: 100%;
File diff suppressed because one or more lines are too long
+12 -2
View File
@@ -5,14 +5,15 @@ using Disco.Models.Services.Jobs.JobLists;
using Disco.Models.UI.Device;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Devices.Exporting;
using Disco.Services.Plugins;
using Disco.Services.Plugins.Features.UIExtension;
using Disco.Services.Users;
using Disco.Services.Web;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.Mvc;
@@ -98,7 +99,16 @@ namespace Disco.Web.Controllers
};
if (!string.IsNullOrWhiteSpace(DownloadId))
m.DownloadExportSessionId = DownloadId;
{
string key = string.Format(Areas.API.Controllers.DeviceController.ExportSessionCacheKey, DownloadId);
var context = HttpRuntime.Cache.Get(key) as DeviceExportTaskContext;
if (context != null)
{
m.ExportSessionResult = context.Result;
m.ExportSessionId = DownloadId;
}
}
if (ExportType.HasValue && ExportTypeTargetId.HasValue)
{
+2 -1
View File
@@ -8,7 +8,8 @@ namespace Disco.Web.Models.Device
{
public DeviceExportOptions Options { get; set; }
public string DownloadExportSessionId { get; set; }
public string ExportSessionId { get; set; }
public DeviceExportResult ExportSessionResult { get; set; }
public IEnumerable<KeyValuePair<int, string>> DeviceBatches { get; set; }
public IEnumerable<KeyValuePair<int, string>> DeviceModels { get; set; }
+67 -26
View File
@@ -11,24 +11,6 @@
.GroupBy(m => m.ShortDisplayName);
}
<div id="Devices_Export">
@if (!string.IsNullOrEmpty(Model.DownloadExportSessionId))
{
<div id="Devices_Export_Download_Dialog" class="dialog" title="Export Devices">
<h4>The Device Export was completed successfully.</h4>
<a href="@Url.Action(MVC.API.Device.ExportRetrieve(Model.DownloadExportSessionId))" class="button"><i class="fa fa-download fa-lg"></i>Download Device Export</a>
</div>
<script>
$(function () {
$('#Devices_Export_Download_Dialog')
.dialog({
width: 400,
resizable: false,
modal: true,
autoOpen: true
});
});
</script>
}
@using (Html.BeginForm(MVC.API.Device.Export()))
{
<div id="Devices_Export_Type" class="form" style="width: 530px">
@@ -99,10 +81,12 @@
</div>
<script>
$(function () {
exportDefaultFields = ['DeviceSerialNumber', 'ModelId', 'ProfileId', 'BatchId', 'AssignedUserId', 'DeviceLocation', 'DeviceAssetNumber'];
$exportFields = $('#Devices_Export_Fields');
$exportType = $('#Options_ExportType');
$exportTypeTargetContainers = $('#Devices_Export_Type').find('.Devices_Export_Type_Target');
var exportDefaultFields = ['DeviceSerialNumber', 'ModelId', 'ProfileId', 'BatchId', 'AssignedUserId', 'DeviceLocation', 'DeviceAssetNumber'];
var $exportFields = $('#Devices_Export_Fields');
var $exportType = $('#Options_ExportType');
var $exportTypeTargetContainers = $('#Devices_Export_Type').find('.Devices_Export_Type_Target');
var $form = $exportType.closest('form');
var $exportingDialog = null;
function exportTypeChange() {
$exportTypeTargetContainers.hide();
@@ -124,7 +108,7 @@
exportTypeChange();
$exportFields.on('click', 'a.selectAll,a.selectNone', function () {
$this = $(this);
var $this = $(this);
$this.closest('tr').find('input').prop('checked', $this.is('.selectAll'));
@@ -141,10 +125,67 @@
return false;
});
// Submit Validation
function submitHandler() {
var exportFieldCount = $exportFields.find('input:checked').length;
if (exportFieldCount > 0) {
if ($exportingDialog == null) {
$exportingDialog = $('#Devices_Export_Exporting').dialog({
width: 400,
height: 160,
resizable: false,
modal: true,
autoOpen: false
});
}
$exportingDialog.dialog('open');
$form[0].submit();
}
else
alert('Select at least one field to export.');
}
$.validator.unobtrusive.parse($form);
$form.data("validator").settings.submitHandler = submitHandler;
$('#Devices_Export_Download_Dialog').dialog({
width: 400,
resizable: false,
modal: true,
autoOpen: true
});
$('#Devices_Export_Button').click(function () {
$form.submit();
});
});
</script>
<div class="actionBar">
<input type="submit" class="button" value="Export Devices" />
</div>
}
</div>
@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>
</div>
<script>
$(function () {
$('#Devices_Export_Download_Dialog')
.dialog({
width: 400,
height: 160,
resizable: false,
modal: true,
autoOpen: true
});
});
</script>
}
<div id="Devices_Export_Exporting" class="dialog" title="Exporting Devices...">
<h4><i class="fa fa-lg fa-cog fa-spin" title="Please Wait"></i>Device Exporting devices...</h4>
</div>
<div class="actionBar">
<a id="Devices_Export_Button" href="#" class="button">Export Devices</a>
</div>
+209 -160
View File
@@ -84,65 +84,6 @@ WriteLiteral(">\r\n");
#line hidden
#line 14 "..\..\Views\Device\Export.cshtml"
if (!string.IsNullOrEmpty(Model.DownloadExportSessionId))
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"Devices_Export_Download_Dialog\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Export Devices\"");
WriteLiteral(">\r\n <h4>The Device Export was completed successfully.</h4>\r\n " +
" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 776), Tuple.Create("\"", 856)
#line 18 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 783), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.ExportRetrieve(Model.DownloadExportSessionId))
#line default
#line hidden
, 783), false)
);
WriteLiteral(" class=\"button\"");
WriteLiteral("><i");
WriteLiteral(" class=\"fa fa-download fa-lg\"");
WriteLiteral("></i>Download Device Export</a>\r\n </div>\r\n");
WriteLiteral(@" <script>
$(function () {
$('#Devices_Export_Download_Dialog')
.dialog({
width: 400,
resizable: false,
modal: true,
autoOpen: true
});
});
</script>
");
#line 31 "..\..\Views\Device\Export.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 32 "..\..\Views\Device\Export.cshtml"
using (Html.BeginForm(MVC.API.Device.Export()))
{
@@ -167,7 +108,7 @@ WriteLiteral(">Type:\r\n </th>\r\n <td>\r\
WriteLiteral(" ");
#line 41 "..\..\Views\Device\Export.cshtml"
#line 23 "..\..\Views\Device\Export.cshtml"
Write(Html.DropDownListFor(m => m.Options.ExportType, Enum.GetNames(typeof(Disco.Models.Services.Devices.Exporting.DeviceExportTypes)).Select(t => new SelectListItem() { Text = t, Value = t })));
@@ -184,7 +125,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 43 "..\..\Views\Device\Export.cshtml"
#line 25 "..\..\Views\Device\Export.cshtml"
Write(Html.DropDownListFor(m => m.Options.ExportTypeTargetId, Model.DeviceBatches.Select(i => new SelectListItem() { Value = i.Key.ToString(), Text = i.Value })));
@@ -201,7 +142,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 46 "..\..\Views\Device\Export.cshtml"
#line 28 "..\..\Views\Device\Export.cshtml"
Write(Html.DropDownListFor(m => m.Options.ExportTypeTargetId, Model.DeviceModels.Select(i => new SelectListItem() { Value = i.Key.ToString(), Text = i.Value })));
@@ -218,7 +159,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 49 "..\..\Views\Device\Export.cshtml"
#line 31 "..\..\Views\Device\Export.cshtml"
Write(Html.DropDownListFor(m => m.Options.ExportTypeTargetId, Model.DeviceProfiles.Select(i => new SelectListItem() { Value = i.Key.ToString(), Text = i.Value })));
@@ -244,13 +185,13 @@ WriteLiteral(" href=\"#\"");
WriteLiteral(">(Defaults)</a></h2>\r\n <table>\r\n");
#line 58 "..\..\Views\Device\Export.cshtml"
#line 40 "..\..\Views\Device\Export.cshtml"
#line default
#line hidden
#line 58 "..\..\Views\Device\Export.cshtml"
#line 40 "..\..\Views\Device\Export.cshtml"
foreach (var optionGroup in optionGroups)
{
var optionFields = optionGroup.ToList();
@@ -268,7 +209,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 64 "..\..\Views\Device\Export.cshtml"
#line 46 "..\..\Views\Device\Export.cshtml"
Write(optionGroup.Key);
@@ -277,13 +218,13 @@ WriteLiteral(" ");
WriteLiteral("\r\n");
#line 65 "..\..\Views\Device\Export.cshtml"
#line 47 "..\..\Views\Device\Export.cshtml"
#line default
#line hidden
#line 65 "..\..\Views\Device\Export.cshtml"
#line 47 "..\..\Views\Device\Export.cshtml"
if (optionFields.Count > 2)
{
@@ -311,7 +252,7 @@ WriteLiteral(" href=\"#\"");
WriteLiteral(">NONE</a></span>\r\n");
#line 68 "..\..\Views\Device\Export.cshtml"
#line 50 "..\..\Views\Device\Export.cshtml"
}
@@ -338,13 +279,13 @@ WriteLiteral(" class=\"none\"");
WriteLiteral(">\r\n");
#line 76 "..\..\Views\Device\Export.cshtml"
#line 58 "..\..\Views\Device\Export.cshtml"
#line default
#line hidden
#line 76 "..\..\Views\Device\Export.cshtml"
#line 58 "..\..\Views\Device\Export.cshtml"
foreach (var optionItem in optionFields.Take(itemsPerColumn))
{
@@ -353,40 +294,40 @@ WriteLiteral(">\r\n");
#line hidden
WriteLiteral(" <li");
WriteAttribute("title", Tuple.Create(" title=\"", 4330), Tuple.Create("\"", 4361)
WriteAttribute("title", Tuple.Create(" title=\"", 3553), Tuple.Create("\"", 3584)
#line 78 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4338), Tuple.Create<System.Object, System.Int32>(optionItem.Description
#line 60 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 3561), Tuple.Create<System.Object, System.Int32>(optionItem.Description
#line default
#line hidden
, 4338), false)
, 3561), false)
);
WriteLiteral(">\r\n <input");
WriteLiteral(" type=\"checkbox\"");
WriteAttribute("id", Tuple.Create(" id=\"", 4443), Tuple.Create("\"", 4480)
, Tuple.Create(Tuple.Create("", 4448), Tuple.Create("Options_", 4448), true)
WriteAttribute("id", Tuple.Create(" id=\"", 3666), Tuple.Create("\"", 3703)
, Tuple.Create(Tuple.Create("", 3671), Tuple.Create("Options_", 3671), true)
#line 79 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4456), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line 61 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 3679), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line default
#line hidden
, 4456), false)
, 3679), false)
);
WriteAttribute("name", Tuple.Create(" name=\"", 4481), Tuple.Create("\"", 4520)
, Tuple.Create(Tuple.Create("", 4488), Tuple.Create("Options.", 4488), true)
WriteAttribute("name", Tuple.Create(" name=\"", 3704), Tuple.Create("\"", 3743)
, Tuple.Create(Tuple.Create("", 3711), Tuple.Create("Options.", 3711), true)
#line 79 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4496), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line 61 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 3719), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line default
#line hidden
, 4496), false)
, 3719), false)
);
WriteLiteral(" value=\"true\"");
@@ -394,7 +335,7 @@ WriteLiteral(" value=\"true\"");
WriteLiteral(" ");
#line 79 "..\..\Views\Device\Export.cshtml"
#line 61 "..\..\Views\Device\Export.cshtml"
Write(((bool)optionItem.Model) ? "checked " : null);
@@ -402,21 +343,21 @@ WriteLiteral(" ");
#line hidden
WriteLiteral("/><label");
WriteAttribute("for", Tuple.Create(" for=\"", 4590), Tuple.Create("\"", 4628)
, Tuple.Create(Tuple.Create("", 4596), Tuple.Create("Options_", 4596), true)
WriteAttribute("for", Tuple.Create(" for=\"", 3813), Tuple.Create("\"", 3851)
, Tuple.Create(Tuple.Create("", 3819), Tuple.Create("Options_", 3819), true)
#line 79 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4604), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line 61 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 3827), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line default
#line hidden
, 4604), false)
, 3827), false)
);
WriteLiteral(">");
#line 79 "..\..\Views\Device\Export.cshtml"
#line 61 "..\..\Views\Device\Export.cshtml"
Write(optionItem.DisplayName);
@@ -425,7 +366,7 @@ WriteLiteral(">");
WriteLiteral("</label></li>\r\n");
#line 80 "..\..\Views\Device\Export.cshtml"
#line 62 "..\..\Views\Device\Export.cshtml"
}
@@ -443,13 +384,13 @@ WriteLiteral(" class=\"none\"");
WriteLiteral(">\r\n");
#line 85 "..\..\Views\Device\Export.cshtml"
#line 67 "..\..\Views\Device\Export.cshtml"
#line default
#line hidden
#line 85 "..\..\Views\Device\Export.cshtml"
#line 67 "..\..\Views\Device\Export.cshtml"
foreach (var optionItem in optionFields.Skip(itemsPerColumn))
{
@@ -458,40 +399,40 @@ WriteLiteral(">\r\n");
#line hidden
WriteLiteral(" <li");
WriteAttribute("title", Tuple.Create(" title=\"", 5163), Tuple.Create("\"", 5194)
WriteAttribute("title", Tuple.Create(" title=\"", 4386), Tuple.Create("\"", 4417)
#line 87 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 5171), Tuple.Create<System.Object, System.Int32>(optionItem.Description
#line 69 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4394), Tuple.Create<System.Object, System.Int32>(optionItem.Description
#line default
#line hidden
, 5171), false)
, 4394), false)
);
WriteLiteral(">\r\n <input");
WriteLiteral(" type=\"checkbox\"");
WriteAttribute("id", Tuple.Create(" id=\"", 5276), Tuple.Create("\"", 5313)
, Tuple.Create(Tuple.Create("", 5281), Tuple.Create("Options_", 5281), true)
WriteAttribute("id", Tuple.Create(" id=\"", 4499), Tuple.Create("\"", 4536)
, Tuple.Create(Tuple.Create("", 4504), Tuple.Create("Options_", 4504), true)
#line 88 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 5289), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line 70 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4512), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line default
#line hidden
, 5289), false)
, 4512), false)
);
WriteAttribute("name", Tuple.Create(" name=\"", 5314), Tuple.Create("\"", 5353)
, Tuple.Create(Tuple.Create("", 5321), Tuple.Create("Options.", 5321), true)
WriteAttribute("name", Tuple.Create(" name=\"", 4537), Tuple.Create("\"", 4576)
, Tuple.Create(Tuple.Create("", 4544), Tuple.Create("Options.", 4544), true)
#line 88 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 5329), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line 70 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4552), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line default
#line hidden
, 5329), false)
, 4552), false)
);
WriteLiteral(" value=\"true\"");
@@ -499,7 +440,7 @@ WriteLiteral(" value=\"true\"");
WriteLiteral(" ");
#line 88 "..\..\Views\Device\Export.cshtml"
#line 70 "..\..\Views\Device\Export.cshtml"
Write(((bool)optionItem.Model) ? "checked " : null);
@@ -507,21 +448,21 @@ WriteLiteral(" ");
#line hidden
WriteLiteral("/><label");
WriteAttribute("for", Tuple.Create(" for=\"", 5423), Tuple.Create("\"", 5461)
, Tuple.Create(Tuple.Create("", 5429), Tuple.Create("Options_", 5429), true)
WriteAttribute("for", Tuple.Create(" for=\"", 4646), Tuple.Create("\"", 4684)
, Tuple.Create(Tuple.Create("", 4652), Tuple.Create("Options_", 4652), true)
#line 88 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 5437), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line 70 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4660), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line default
#line hidden
, 5437), false)
, 4660), false)
);
WriteLiteral(">");
#line 88 "..\..\Views\Device\Export.cshtml"
#line 70 "..\..\Views\Device\Export.cshtml"
Write(optionItem.DisplayName);
@@ -530,7 +471,7 @@ WriteLiteral(">");
WriteLiteral("</label></li>\r\n");
#line 89 "..\..\Views\Device\Export.cshtml"
#line 71 "..\..\Views\Device\Export.cshtml"
}
@@ -546,7 +487,7 @@ WriteLiteral(@" </ul>
");
#line 97 "..\..\Views\Device\Export.cshtml"
#line 79 "..\..\Views\Device\Export.cshtml"
}
@@ -554,50 +495,55 @@ WriteLiteral(@" </ul>
#line hidden
WriteLiteral(" </table>\r\n </div>\r\n");
WriteLiteral(" <script>\r\n $(function () {\r\n exportDefaultField" +
"s = [\'DeviceSerialNumber\', \'ModelId\', \'ProfileId\', \'BatchId\', \'AssignedUserId\', " +
"\'DeviceLocation\', \'DeviceAssetNumber\'];\r\n $exportFields = $(\'#Dev" +
"ices_Export_Fields\');\r\n $exportType = $(\'#Options_ExportType\');\r\n" +
" $exportTypeTargetContainers = $(\'#Devices_Export_Type\').find(\'.D" +
"evices_Export_Type_Target\');\r\n\r\n function exportTypeChange() {\r\n " +
" $exportTypeTargetContainers.hide();\r\n $exp" +
"ortTypeTargetContainers.find(\'select\').prop(\'disabled\', true);\r\n\r\n " +
" switch ($exportType.val()) {\r\n case \'Batch\':\r\n " +
" $(\'#Devices_Export_Type_Target_Batch\').show().find(\'selec" +
"t\').prop(\'disabled\', false);\r\n break;\r\n " +
" case \'Profile\':\r\n $(\'#Devices_Export_Type_T" +
"arget_Profile\').show().find(\'select\').prop(\'disabled\', false);\r\n " +
" break;\r\n case \'Model\':\r\n " +
" $(\'#Devices_Export_Type_Target_Model\').show().find(\'select\').prop(\'disabl" +
"ed\', false);\r\n break;\r\n }\r\n " +
" }\r\n $exportType.change(exportTypeChange);\r\n " +
" exportTypeChange();\r\n\r\n $exportFields.on(\'click\', \'a.selectAll" +
",a.selectNone\', function () {\r\n $this = $(this);\r\n\r\n " +
" $this.closest(\'tr\').find(\'input\').prop(\'checked\', $this.is(\'.selectAl" +
"l\'));\r\n\r\n return false;\r\n });\r\n\r\n " +
" $(\'#Devices_Export_Fields_Defaults\').click(function () {\r\n\r\n " +
" $exportFields.find(\'input\').prop(\'checked\', false);\r\n\r\n $." +
"each(exportDefaultFields, function (index, value) {\r\n $(\'" +
"#Options_\' + value).prop(\'checked\', true);\r\n });\r\n\r\n " +
" return false;\r\n });\r\n });\r\n </script" +
">\r\n");
WriteLiteral(" <div");
WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n <input");
WriteLiteral(" type=\"submit\"");
WriteLiteral(" class=\"button\"");
WriteLiteral(" value=\"Export Devices\"");
WriteLiteral(" />\r\n </div>\r\n");
WriteLiteral(" <script>\r\n $(function () {\r\n var exportDefaultF" +
"ields = [\'DeviceSerialNumber\', \'ModelId\', \'ProfileId\', \'BatchId\', \'AssignedUserI" +
"d\', \'DeviceLocation\', \'DeviceAssetNumber\'];\r\n var $exportFields =" +
" $(\'#Devices_Export_Fields\');\r\n var $exportType = $(\'#Options_Exp" +
"ortType\');\r\n var $exportTypeTargetContainers = $(\'#Devices_Export" +
"_Type\').find(\'.Devices_Export_Type_Target\');\r\n var $form = $expor" +
"tType.closest(\'form\');\r\n var $exportingDialog = null;\r\n\r\n " +
" function exportTypeChange() {\r\n $exportTypeTargetCont" +
"ainers.hide();\r\n $exportTypeTargetContainers.find(\'select\').p" +
"rop(\'disabled\', true);\r\n\r\n switch ($exportType.val()) {\r\n " +
" case \'Batch\':\r\n $(\'#Devices_Expor" +
"t_Type_Target_Batch\').show().find(\'select\').prop(\'disabled\', false);\r\n " +
" break;\r\n case \'Profile\':\r\n " +
" $(\'#Devices_Export_Type_Target_Profile\').show().find(\'select\').pr" +
"op(\'disabled\', false);\r\n break;\r\n " +
" case \'Model\':\r\n $(\'#Devices_Export_Type_Target_Mo" +
"del\').show().find(\'select\').prop(\'disabled\', false);\r\n " +
" break;\r\n }\r\n }\r\n $exportType." +
"change(exportTypeChange);\r\n exportTypeChange();\r\n\r\n " +
" $exportFields.on(\'click\', \'a.selectAll,a.selectNone\', function () {\r\n " +
" var $this = $(this);\r\n\r\n $this.closest(\'tr\').find(" +
"\'input\').prop(\'checked\', $this.is(\'.selectAll\'));\r\n\r\n return " +
"false;\r\n });\r\n\r\n $(\'#Devices_Export_Fields_Default" +
"s\').click(function () {\r\n\r\n $exportFields.find(\'input\').prop(" +
"\'checked\', false);\r\n\r\n $.each(exportDefaultFields, function (" +
"index, value) {\r\n $(\'#Options_\' + value).prop(\'checked\', " +
"true);\r\n });\r\n\r\n return false;\r\n " +
" });\r\n\r\n // Submit Validation\r\n function subm" +
"itHandler() {\r\n var exportFieldCount = $exportFields.find(\'in" +
"put:checked\').length;\r\n\r\n if (exportFieldCount > 0) {\r\n\r\n " +
" if ($exportingDialog == null) {\r\n " +
" $exportingDialog = $(\'#Devices_Export_Exporting\').dialog({\r\n " +
" width: 400,\r\n height: 160,\r\n " +
" resizable: false,\r\n modal" +
": true,\r\n autoOpen: false\r\n " +
" });\r\n }\r\n $exportingDialog.d" +
"ialog(\'open\');\r\n\r\n $form[0].submit();\r\n " +
" }\r\n else\r\n alert(\'Select at least on" +
"e field to export.\');\r\n }\r\n $.validator.unobtrusiv" +
"e.parse($form);\r\n $form.data(\"validator\").settings.submitHandler " +
"= submitHandler;\r\n\r\n $(\'#Devices_Export_Download_Dialog\').dialog(" +
"{\r\n width: 400,\r\n resizable: false,\r\n " +
" modal: true,\r\n autoOpen: true\r\n " +
" });\r\n $(\'#Devices_Export_Button\').click(function () {\r\n " +
" $form.submit();\r\n });\r\n });\r\n </scri" +
"pt>\r\n");
#line 149 "..\..\Views\Device\Export.cshtml"
#line 165 "..\..\Views\Device\Export.cshtml"
}
@@ -605,6 +551,109 @@ WriteLiteral(" />\r\n </div>\r\n");
#line hidden
WriteLiteral("</div>\r\n");
#line 167 "..\..\Views\Device\Export.cshtml"
if (Model.ExportSessionId != null)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"Devices_Export_Download_Dialog\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Export Devices\"");
WriteLiteral(">\r\n <h4>");
#line 170 "..\..\Views\Device\Export.cshtml"
Write(Model.ExportSessionResult.RecordCount);
#line default
#line hidden
WriteLiteral(" record");
#line 170 "..\..\Views\Device\Export.cshtml"
Write(Model.ExportSessionResult.RecordCount != 1 ? "s" : null);
#line default
#line hidden
WriteLiteral(" were successfully exported.</h4>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 9027), Tuple.Create("\"", 9099)
#line 171 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 9034), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.ExportRetrieve(Model.ExportSessionId))
#line default
#line hidden
, 9034), false)
);
WriteLiteral(" class=\"button\"");
WriteLiteral("><i");
WriteLiteral(" class=\"fa fa-download fa-lg\"");
WriteLiteral("></i>Download Device Export</a>\r\n </div>\r\n");
WriteLiteral(@" <script>
$(function () {
$('#Devices_Export_Download_Dialog')
.dialog({
width: 400,
height: 160,
resizable: false,
modal: true,
autoOpen: true
});
});
</script>
");
#line 185 "..\..\Views\Device\Export.cshtml"
}
#line default
#line hidden
WriteLiteral("<div");
WriteLiteral(" id=\"Devices_Export_Exporting\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Exporting Devices...\"");
WriteLiteral(">\r\n <h4><i");
WriteLiteral(" class=\"fa fa-lg fa-cog fa-spin\"");
WriteLiteral(" title=\"Please Wait\"");
WriteLiteral("></i>Device Exporting devices...</h4>\r\n</div>\r\n<div");
WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n <a");
WriteLiteral(" id=\"Devices_Export_Button\"");
WriteLiteral(" href=\"#\"");
WriteLiteral(" class=\"button\"");
WriteLiteral(">Export Devices</a>\r\n</div>\r\n");
}
}
}