refactor: make exporting consistent

This commit is contained in:
Gary Sharp
2025-02-06 19:14:36 +11:00
parent f946f3250c
commit 67f1c2a5d1
69 changed files with 908 additions and 921 deletions
@@ -1,9 +1,8 @@
using Disco.Models.Repository;
using Disco.Models.Services.Devices.Exporting;
using Disco.Models.Services.Devices.Importing;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Devices.Exporting;
using Disco.Services.Devices;
using Disco.Services.Devices.Importing;
using Disco.Services.Exporting;
using Disco.Services.Interop;
@@ -685,7 +684,6 @@ namespace Disco.Web.Areas.API.Controllers
#endregion
#region Exporting
internal const string ExportSessionCacheKey = "DeviceExportContext_{0}";
[DiscoAuthorize(Claims.Device.Actions.Export)]
[HttpPost, ValidateAntiForgeryToken]
@@ -699,39 +697,29 @@ namespace Disco.Web.Areas.API.Controllers
Database.SaveChanges();
// Start Export
var exportContext = DeviceExportTask.ScheduleNow(Model.Options);
// Store Export Context in Web Cache
string key = string.Format(ExportSessionCacheKey, exportContext.TaskStatus.SessionId);
HttpRuntime.Cache.Insert(key, exportContext, null, DateTime.Now.AddMinutes(60), Cache.NoSlidingExpiration, CacheItemPriority.NotRemovable, null);
// Set Task Finished Url
var finishedActionResult = MVC.Device.Export(exportContext.TaskStatus.SessionId, null, null);
exportContext.TaskStatus.SetFinishedUrl(Url.Action(finishedActionResult));
var exportContext = new DeviceExportContext(Model.Options);
var taskContext = ExportTask.ScheduleNowCacheResult(exportContext, id => Url.Action(MVC.Device.Export(id, null, null)));
// Try waiting for completion
if (exportContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(2)))
return RedirectToAction(finishedActionResult);
if (taskContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(1)))
return RedirectToAction(MVC.Device.Export(taskContext.Id, null, null));
else
return RedirectToAction(MVC.Config.Logging.TaskStatus(exportContext.TaskStatus.SessionId));
return RedirectToAction(MVC.Config.Logging.TaskStatus(taskContext.TaskStatus.SessionId));
}
[DiscoAuthorize(Claims.Device.Actions.Export)]
public virtual ActionResult ExportRetrieve(string Id)
public virtual ActionResult ExportRetrieve(Guid id)
{
if (string.IsNullOrWhiteSpace(Id))
throw new ArgumentNullException("Id");
if (id == Guid.Empty)
throw new ArgumentNullException(nameof(id));
string key = string.Format(ExportSessionCacheKey, Id);
var context = HttpRuntime.Cache.Get(key) as ExportTaskContext<DeviceExportOptions>;
if (context == null)
throw new ArgumentException("The Id specified is invalid, or the export data expired (60 minutes)", "Id");
if (!ExportTask.TryFromCache(id, out var context))
throw new ArgumentException("The export id specified is invalid, or the export data expired (60 minutes)", nameof(id));
if (context.Result == null || context.Result.Result == null)
throw new ArgumentException("The export session is still running, or failed to complete successfully", "Id");
throw new ArgumentException("The export session is still running, or failed to complete successfully", nameof(id));
if (context.Result.RecordCount == 0)
throw new ArgumentException("No records were found to export", nameof(Id));
throw new ArgumentException("No records were found to export", nameof(id));
var fileStream = context.Result.Result;
@@ -404,7 +404,6 @@ namespace Disco.Web.Areas.API.Controllers
#endregion
#region Exporting
internal const string ExportSessionCacheKey = "DeviceFlagExportContext_{0}";
[DiscoAuthorize(Claims.Config.DeviceFlag.Export)]
public virtual ActionResult Export(ExportModel Model)
@@ -413,39 +412,29 @@ namespace Disco.Web.Areas.API.Controllers
throw new ArgumentNullException(nameof(Model));
// Start Export
var exportContext = DeviceFlagExportTask.ScheduleNow(Model.Options);
// Store Export Context in Web Cache
string key = string.Format(ExportSessionCacheKey, exportContext.TaskStatus.SessionId);
HttpRuntime.Cache.Insert(key, exportContext, null, DateTime.Now.AddMinutes(60), Cache.NoSlidingExpiration, CacheItemPriority.NotRemovable, null);
// Set Task Finished Url
var finishedActionResult = MVC.Config.DeviceFlag.Export(exportContext.TaskStatus.SessionId, null, null);
exportContext.TaskStatus.SetFinishedUrl(Url.Action(finishedActionResult));
var exportContext = new DeviceFlagExportContext(Model.Options);
var taskContext = ExportTask.ScheduleNowCacheResult(exportContext, id => Url.Action(MVC.Config.DeviceFlag.Export(id, null, null)));
// Try waiting for completion
if (exportContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(2)))
return RedirectToAction(finishedActionResult);
if (taskContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(1)))
return RedirectToAction(MVC.Config.DeviceFlag.Export(taskContext.Id, null, null));
else
return RedirectToAction(MVC.Config.Logging.TaskStatus(exportContext.TaskStatus.SessionId));
return RedirectToAction(MVC.Config.Logging.TaskStatus(taskContext.TaskStatus.SessionId));
}
[DiscoAuthorize(Claims.Config.DeviceFlag.Export)]
public virtual ActionResult ExportRetrieve(string Id)
public virtual ActionResult ExportRetrieve(Guid id)
{
if (string.IsNullOrWhiteSpace(Id))
throw new ArgumentNullException("Id");
if (id == Guid.Empty)
throw new ArgumentNullException(nameof(id));
string key = string.Format(ExportSessionCacheKey, Id);
var context = HttpRuntime.Cache.Get(key) as ExportTaskContext<DeviceFlagExportOptions>;
if (context == null)
throw new ArgumentException("The Id specified is invalid, or the export data expired (60 minutes)", nameof(Id));
if (!ExportTask.TryFromCache(id, out var context))
throw new ArgumentException("The export id specified is invalid, or the export data expired (60 minutes)", nameof(id));
if (context.Result == null || context.Result.Result == null)
throw new ArgumentException("The export session is still running, or failed to complete successfully", nameof(Id));
throw new ArgumentException("The export session is still running, or failed to complete successfully", nameof(id));
if (context.Result.RecordCount == 0)
throw new ArgumentException("No records were found to export", nameof(Id));
throw new ArgumentException("No records were found to export", nameof(id));
var fileStream = context.Result.Result;
@@ -1,13 +1,11 @@
using Disco.Models.Repository;
using Disco.Models.Services.Jobs;
using Disco.Models.Services.Jobs.Exporting;
using Disco.Models.Services.Jobs.JobLists;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Exporting;
using Disco.Services.Interop;
using Disco.Services.Jobs;
using Disco.Services.Jobs.Exporting;
using Disco.Services.Jobs.JobLists;
using Disco.Services.Jobs.Statistics;
using Disco.Services.Users;
@@ -2168,7 +2166,6 @@ namespace Disco.Web.Areas.API.Controllers
}
#region Exporting
internal const string ExportSessionCacheKey = "JobExportContext_{0}";
[DiscoAuthorize(Claims.Job.Actions.Export)]
[HttpPost, ValidateAntiForgeryToken]
@@ -2182,34 +2179,24 @@ namespace Disco.Web.Areas.API.Controllers
Database.SaveChanges();
// Start Export
var exportContext = JobExportTask.ScheduleNow(model.Options);
// Store Export Context in Web Cache
string key = string.Format(ExportSessionCacheKey, exportContext.TaskStatus.SessionId);
HttpRuntime.Cache.Insert(key, exportContext, null, DateTime.Now.AddMinutes(60), Cache.NoSlidingExpiration, CacheItemPriority.NotRemovable, null);
// Set Task Finished Url
var finishedActionResult = MVC.Job.Export(exportContext.TaskStatus.SessionId);
exportContext.TaskStatus.SetFinishedUrl(Url.Action(finishedActionResult));
var exportContext = new JobExportContext(model.Options);
var taskContext = ExportTask.ScheduleNowCacheResult(exportContext, id => Url.Action(MVC.Job.Export(id)));
// Try waiting for completion
if (exportContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(2)))
return RedirectToAction(finishedActionResult);
if (taskContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(1)))
return RedirectToAction(MVC.Job.Export(taskContext.Id));
else
return RedirectToAction(MVC.Config.Logging.TaskStatus(exportContext.TaskStatus.SessionId));
return RedirectToAction(MVC.Config.Logging.TaskStatus(taskContext.TaskStatus.SessionId));
}
[DiscoAuthorize(Claims.Job.Actions.Export)]
public virtual ActionResult ExportRetrieve(string id)
public virtual ActionResult ExportRetrieve(Guid id)
{
if (string.IsNullOrWhiteSpace(id))
throw new ArgumentNullException("Id");
if (id == Guid.Empty)
throw new ArgumentNullException(nameof(id));
string key = string.Format(ExportSessionCacheKey, id);
var context = HttpRuntime.Cache.Get(key) as ExportTaskContext<JobExportOptions>;
if (context == null)
throw new ArgumentException("The Id specified is invalid, or the export data expired (60 minutes)", nameof(id));
if (!ExportTask.TryFromCache(id, out var context))
throw new ArgumentException("The export id specified is invalid, or the export data expired (60 minutes)", nameof(id));
if (context.Result == null || context.Result.Result == null)
throw new ArgumentException("The export session is still running, or failed to complete successfully", nameof(id));
@@ -1,4 +1,5 @@
using Disco.Models.Exporting;
using Disco.Models.Services.Logging;
using Disco.Services.Authorization;
using Disco.Services.Logging;
using Disco.Services.Tasks;
@@ -23,30 +24,40 @@ namespace Disco.Web.Areas.API.Controllers
[HttpPost, ValidateAntiForgeryToken, DiscoAuthorize(Claims.Config.Logging.Show)]
public virtual ActionResult RetrieveEvents(string Format, DateTime? Start = null, DateTime? End = null, int? ModuleId = null, List<int> EventTypeIds = null, int? Take = null)
{
var logRetriever = new ReadLogContext()
if (string.Equals(Format, "json", StringComparison.OrdinalIgnoreCase))
{
Start = Start,
End = End,
Module = ModuleId,
EventTypes = EventTypeIds,
Take = Take
};
var results = logRetriever.Query(Database);
var exportFormat = ExportFormat.Xlsx;
switch (Format.ToLower())
{
case "json":
return Json(results, JsonRequestBehavior.AllowGet);
case "csv":
exportFormat = ExportFormat.Csv;
break;
var logRetriever = new ReadLogContext()
{
Start = Start,
End = End,
Module = ModuleId,
EventTypes = EventTypeIds,
Take = Take,
};
var results = logRetriever.Query(Database);
return Json(results, JsonRequestBehavior.AllowGet);
}
else
{
var exportFormat = ExportFormat.Xlsx;
if (string.Equals(Format, "csv", StringComparison.OrdinalIgnoreCase))
exportFormat = ExportFormat.Csv;
var export = LogExport.GenerateExport(exportFormat, results);
var options = new LogExportOptions()
{
Format = exportFormat,
StartDate = Start,
EndDate = End,
ModuleId = ModuleId,
EventTypeIds = EventTypeIds,
Take = Take,
};
var exportContext = new LogExportContext(options);
return File(export.Result, export.MimeType, export.Filename);
var export = exportContext.Export(Database, ScheduledTaskMockStatus.Create("Log Export"));
return File(export.Result, export.MimeType, export.Filename);
}
}
public virtual ActionResult ScheduledTaskStatus(string id)
@@ -409,7 +409,6 @@ namespace Disco.Web.Areas.API.Controllers
#endregion
#region Exporting
internal const string ExportSessionCacheKey = "UserFlagExportContext_{0}";
[DiscoAuthorize(Claims.Config.UserFlag.Export)]
public virtual ActionResult Export(ExportModel Model)
@@ -418,39 +417,26 @@ namespace Disco.Web.Areas.API.Controllers
throw new ArgumentNullException(nameof(Model));
// Start Export
var exportContext = UserFlagExportTask.ScheduleNow(Model.Options);
// Store Export Context in Web Cache
string key = string.Format(ExportSessionCacheKey, exportContext.TaskStatus.SessionId);
HttpRuntime.Cache.Insert(key, exportContext, null, DateTime.Now.AddMinutes(60), Cache.NoSlidingExpiration, CacheItemPriority.NotRemovable, null);
// Set Task Finished Url
var finishedActionResult = MVC.Config.UserFlag.Export(exportContext.TaskStatus.SessionId, null, null);
exportContext.TaskStatus.SetFinishedUrl(Url.Action(finishedActionResult));
var exportContext = new UserFlagExportContext(Model.Options);
var taskContext = ExportTask.ScheduleNowCacheResult(exportContext, id => Url.Action(MVC.Config.UserFlag.Export(id, null, null)));
// Try waiting for completion
if (exportContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(2)))
return RedirectToAction(finishedActionResult);
if (taskContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(1)))
return RedirectToAction(MVC.Config.UserFlag.Export(taskContext.Id, null, null));
else
return RedirectToAction(MVC.Config.Logging.TaskStatus(exportContext.TaskStatus.SessionId));
return RedirectToAction(MVC.Config.Logging.TaskStatus(taskContext.TaskStatus.SessionId));
}
[DiscoAuthorize(Claims.Config.UserFlag.Export)]
public virtual ActionResult ExportRetrieve(string Id)
public virtual ActionResult ExportRetrieve(Guid id)
{
if (string.IsNullOrWhiteSpace(Id))
throw new ArgumentNullException("Id");
string key = string.Format(ExportSessionCacheKey, Id);
var context = HttpRuntime.Cache.Get(key) as ExportTaskContext<UserFlagExportOptions>;
if (context == null)
throw new ArgumentException("The Id specified is invalid, or the export data expired (60 minutes)", nameof(Id));
if (!ExportTask.TryFromCache(id, out var context))
throw new ArgumentException("The export id specified is invalid, or the export data expired (60 minutes)", nameof(id));
if (context.Result == null || context.Result.Result == null)
throw new ArgumentException("The export session is still running, or failed to complete successfully", nameof(Id));
throw new ArgumentException("The export session is still running, or failed to complete successfully", nameof(id));
if (context.Result.RecordCount == 0)
throw new ArgumentException("No records were found to export", nameof(Id));
throw new ArgumentException("No records were found to export", nameof(id));
var fileStream = context.Result.Result;
@@ -122,7 +122,7 @@ namespace Disco.Web.Areas.Config.Controllers
#region Export
[DiscoAuthorizeAny(Claims.Config.DeviceFlag.Export), HttpGet]
public virtual ActionResult Export(string DownloadId, int? DeviceFlagId, bool? CurrentOnly)
public virtual ActionResult Export(Guid? exportId, int? deviceFlagId, bool? currentOnly)
{
var m = new ExportModel()
{
@@ -130,26 +130,20 @@ namespace Disco.Web.Areas.Config.Controllers
DeviceFlags = DeviceFlagService.GetDeviceFlags(),
};
if (!string.IsNullOrWhiteSpace(DownloadId))
if (ExportTask.TryFromCache(exportId, out var context))
{
string key = string.Format(API.Controllers.DeviceFlagController.ExportSessionCacheKey, DownloadId);
var context = HttpRuntime.Cache.Get(key) as ExportTaskContext<DeviceFlagExportOptions>;
if (context != null)
{
m.ExportSessionResult = context.Result;
m.ExportSessionId = DownloadId;
}
m.ExportId = context.Id;
m.ExportResult = context.Result;
}
if (DeviceFlagId.HasValue && CurrentOnly.HasValue)
if (deviceFlagId.HasValue && currentOnly.HasValue)
{
m.Options.DeviceFlagIds = new List<int>() { DeviceFlagId.Value };
m.Options.CurrentOnly = CurrentOnly.Value;
m.Options.DeviceFlagIds = new List<int>() { deviceFlagId.Value };
m.Options.CurrentOnly = currentOnly.Value;
}
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceFlagExportModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigDeviceFlagExportModel>(ControllerContext, m);
return View(m);
}
@@ -124,7 +124,7 @@ namespace Disco.Web.Areas.Config.Controllers
#region Export
[DiscoAuthorizeAny(Claims.Config.UserFlag.Export), HttpGet]
public virtual ActionResult Export(string DownloadId, int? UserFlagId, bool? CurrentOnly)
public virtual ActionResult Export(Guid? exportId, int? userFlagId, bool? currentOnly)
{
var m = new ExportModel()
{
@@ -132,26 +132,20 @@ namespace Disco.Web.Areas.Config.Controllers
UserFlags = UserFlagService.GetUserFlags(),
};
if (!string.IsNullOrWhiteSpace(DownloadId))
if (ExportTask.TryFromCache(exportId, out var context))
{
string key = string.Format(API.Controllers.UserFlagController.ExportSessionCacheKey, DownloadId);
var context = HttpRuntime.Cache.Get(key) as ExportTaskContext<UserFlagExportOptions>;
if (context != null)
{
m.ExportSessionResult = context.Result;
m.ExportSessionId = DownloadId;
}
m.ExportId = exportId;
m.ExportResult = context.Result;
}
if (UserFlagId.HasValue && CurrentOnly.HasValue)
if (userFlagId.HasValue && currentOnly.HasValue)
{
m.Options.UserFlagIds = new List<int>() { UserFlagId.Value };
m.Options.CurrentOnly = CurrentOnly.Value;
m.Options.UserFlagIds = new List<int>() { userFlagId.Value };
m.Options.CurrentOnly = currentOnly.Value;
}
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigUserFlagExportModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<ConfigUserFlagExportModel>(ControllerContext, m);
return View(m);
}
@@ -1,6 +1,7 @@
using Disco.Models.Areas.Config.UI.DeviceFlag;
using Disco.Models.Services.Devices.DeviceFlag;
using Disco.Models.Services.Exporting;
using System;
using System.Collections.Generic;
namespace Disco.Web.Areas.Config.Models.DeviceFlag
@@ -9,8 +10,8 @@ namespace Disco.Web.Areas.Config.Models.DeviceFlag
{
public DeviceFlagExportOptions Options { get; set; }
public string ExportSessionId { get; set; }
public ExportResult ExportSessionResult { get; set; }
public Guid? ExportId { get; set; }
public ExportResult ExportResult { get; set; }
public List<Disco.Models.Repository.DeviceFlag> DeviceFlags { get; set; }
}
@@ -1,6 +1,7 @@
using Disco.Models.Areas.Config.UI.UserFlag;
using Disco.Models.Services.Exporting;
using Disco.Models.Services.Users.UserFlags;
using System;
using System.Collections.Generic;
namespace Disco.Web.Areas.Config.Models.UserFlag
@@ -9,8 +10,8 @@ namespace Disco.Web.Areas.Config.Models.UserFlag
{
public UserFlagExportOptions Options { get; set; }
public string ExportSessionId { get; set; }
public ExportResult ExportSessionResult { get; set; }
public Guid? ExportId { get; set; }
public ExportResult ExportResult { get; set; }
public List<Disco.Models.Repository.UserFlag> UserFlags { get; set; }
}
@@ -1017,7 +1017,7 @@
{
if (Authorization.Has(Claims.Device.Actions.Export))
{
@Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.Exporting.DeviceExportTypes.Batch, Model.DeviceBatch.Id))
@Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.DeviceExportTypes.Batch, Model.DeviceBatch.Id))
}
if (Authorization.Has(Claims.Device.Search) && Model.DeviceCount > 0)
{
@@ -2778,14 +2778,14 @@ WriteLiteral(" ");
#line hidden
#line 1020 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
Write(Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.Exporting.DeviceExportTypes.Batch, Model.DeviceBatch.Id)));
Write(Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.DeviceExportTypes.Batch, Model.DeviceBatch.Id)));
#line default
#line hidden
#line 1020 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml"
}
if (Authorization.Has(Claims.Device.Search) && Model.DeviceCount > 0)
{
@@ -161,17 +161,17 @@
</script>
}
</div>
@if (Model.ExportSessionId != null)
@if (Model.ExportId.HasValue)
{
<div id="DeviceFlag_Export_Download_Dialog" class="dialog" title="Export Device Flags">
@if (Model.ExportSessionResult.RecordCount == 0)
@if (Model.ExportResult.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.DeviceFlag.ExportRetrieve(Model.ExportSessionId))" class="button"><i class="fa fa-download fa-lg"></i>Download Device Flag Export</a>
<h4>@Model.ExportResult.RecordCount record@(Model.ExportResult.RecordCount != 1 ? "s" : null) were successfully exported.</h4>
<a href="@Url.Action(MVC.API.DeviceFlag.ExportRetrieve(Model.ExportId.Value))" class="button"><i class="fa fa-download fa-lg"></i>Download Device Flag Export</a>
}
</div>
<script>
@@ -601,7 +601,7 @@ WriteLiteral("</div>\r\n");
#line 164 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
if (Model.ExportSessionId != null)
if (Model.ExportId.HasValue)
{
@@ -625,7 +625,7 @@ WriteLiteral(">\r\n");
#line hidden
#line 167 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
if (Model.ExportSessionResult.RecordCount == 0)
if (Model.ExportResult.RecordCount == 0)
{
@@ -646,7 +646,7 @@ WriteLiteral(" <h4>");
#line 173 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
Write(Model.ExportSessionResult.RecordCount);
Write(Model.ExportResult.RecordCount);
#line default
@@ -655,7 +655,7 @@ WriteLiteral(" record");
#line 173 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
Write(Model.ExportSessionResult.RecordCount != 1 ? "s" : null);
Write(Model.ExportResult.RecordCount != 1 ? "s" : null);
#line default
@@ -664,14 +664,14 @@ WriteLiteral(" were successfully exported.</h4>\r\n");
WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 8524), Tuple.Create("\"", 8600)
WriteAttribute("href", Tuple.Create(" href=\"", 8497), Tuple.Create("\"", 8572)
#line 174 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
, Tuple.Create(Tuple.Create("", 8531), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DeviceFlag.ExportRetrieve(Model.ExportSessionId))
, Tuple.Create(Tuple.Create("", 8504), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DeviceFlag.ExportRetrieve(Model.ExportId.Value))
#line default
#line hidden
, 8531), false)
, 8504), false)
);
WriteLiteral(" class=\"button\"");
@@ -255,7 +255,7 @@
{
if (Authorization.Has(Claims.Device.Actions.Export))
{
@Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.Exporting.DeviceExportTypes.Model, Model.DeviceModel.Id))
@Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.DeviceExportTypes.Model, Model.DeviceModel.Id))
}
if (Authorization.Has(Claims.Device.Search) && Model.DeviceCount > 0)
{
@@ -859,14 +859,14 @@ WriteLiteral(" ");
#line hidden
#line 258 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.Exporting.DeviceExportTypes.Model, Model.DeviceModel.Id)));
Write(Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.DeviceExportTypes.Model, Model.DeviceModel.Id)));
#line default
#line hidden
#line 258 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
}
if (Authorization.Has(Claims.Device.Search) && Model.DeviceCount > 0)
{
@@ -1012,7 +1012,7 @@
}
@if (Authorization.Has(Claims.Device.Actions.Export))
{
@Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.Exporting.DeviceExportTypes.Profile, Model.DeviceProfile.Id))
@Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.DeviceExportTypes.Profile, Model.DeviceProfile.Id))
}
@if (Authorization.Has(Claims.Device.Search) && Model.DeviceCount > 0)
{
@@ -3022,14 +3022,14 @@ WriteLiteral(" ");
#line hidden
#line 1015 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.Exporting.DeviceExportTypes.Profile, Model.DeviceProfile.Id)));
Write(Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.DeviceExportTypes.Profile, Model.DeviceProfile.Id)));
#line default
#line hidden
#line 1015 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}
@@ -161,17 +161,17 @@
</script>
}
</div>
@if (Model.ExportSessionId != null)
@if (Model.ExportId.HasValue)
{
<div id="UserFlag_Export_Download_Dialog" class="dialog" title="Export User Flags">
@if (Model.ExportSessionResult.RecordCount == 0)
@if (Model.ExportResult.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.UserFlag.ExportRetrieve(Model.ExportSessionId))" class="button"><i class="fa fa-download fa-lg"></i>Download User Flag Export</a>
<h4>@Model.ExportResult.RecordCount record@(Model.ExportResult.RecordCount != 1 ? "s" : null) were successfully exported.</h4>
<a href="@Url.Action(MVC.API.UserFlag.ExportRetrieve(Model.ExportId.Value))" class="button"><i class="fa fa-download fa-lg"></i>Download User Flag Export</a>
}
</div>
<script>
@@ -601,7 +601,7 @@ WriteLiteral("</div>\r\n");
#line 164 "..\..\Areas\Config\Views\UserFlag\Export.cshtml"
if (Model.ExportSessionId != null)
if (Model.ExportId.HasValue)
{
@@ -625,7 +625,7 @@ WriteLiteral(">\r\n");
#line hidden
#line 167 "..\..\Areas\Config\Views\UserFlag\Export.cshtml"
if (Model.ExportSessionResult.RecordCount == 0)
if (Model.ExportResult.RecordCount == 0)
{
@@ -646,7 +646,7 @@ WriteLiteral(" <h4>");
#line 173 "..\..\Areas\Config\Views\UserFlag\Export.cshtml"
Write(Model.ExportSessionResult.RecordCount);
Write(Model.ExportResult.RecordCount);
#line default
@@ -655,7 +655,7 @@ WriteLiteral(" record");
#line 173 "..\..\Areas\Config\Views\UserFlag\Export.cshtml"
Write(Model.ExportSessionResult.RecordCount != 1 ? "s" : null);
Write(Model.ExportResult.RecordCount != 1 ? "s" : null);
#line default
@@ -664,14 +664,14 @@ WriteLiteral(" were successfully exported.</h4>\r\n");
WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 8500), Tuple.Create("\"", 8574)
WriteAttribute("href", Tuple.Create(" href=\"", 8473), Tuple.Create("\"", 8546)
#line 174 "..\..\Areas\Config\Views\UserFlag\Export.cshtml"
, Tuple.Create(Tuple.Create("", 8507), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.UserFlag.ExportRetrieve(Model.ExportSessionId))
, Tuple.Create(Tuple.Create("", 8480), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.UserFlag.ExportRetrieve(Model.ExportId.Value))
#line default
#line hidden
, 8507), false)
, 8480), false)
);
WriteLiteral(" class=\"button\"");
+8 -15
View File
@@ -1,5 +1,5 @@
using Disco.Models.Repository;
using Disco.Models.Services.Devices.Exporting;
using Disco.Models.Services.Devices;
using Disco.Models.Services.Jobs.JobLists;
using Disco.Models.UI.Device;
using Disco.Services;
@@ -15,7 +15,6 @@ using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
@@ -114,7 +113,7 @@ namespace Disco.Web.Controllers
#region Export
[DiscoAuthorizeAny(Claims.Device.Actions.Export), HttpGet]
public virtual ActionResult Export(string DownloadId, DeviceExportTypes? ExportType, int? ExportTypeTargetId)
public virtual ActionResult Export(Guid? exportId, DeviceExportTypes? exportType, int? exportTypeTargetId)
{
var m = new Models.Device.ExportModel()
{
@@ -124,22 +123,16 @@ namespace Disco.Web.Controllers
DeviceProfiles = Database.DeviceProfiles.OrderBy(dp => dp.Name).Select(dp => new { Key = dp.Id, Value = dp.Name }).ToList().Select(i => new KeyValuePair<int, string>(i.Key, i.Value))
};
if (!string.IsNullOrWhiteSpace(DownloadId))
if (ExportTask.TryFromCache(exportId.Value, out var context))
{
string key = string.Format(Areas.API.Controllers.DeviceController.ExportSessionCacheKey, DownloadId);
var context = HttpRuntime.Cache.Get(key) as ExportTaskContext<DeviceExportOptions>;
if (context != null)
{
m.ExportSessionResult = context.Result;
m.ExportSessionId = DownloadId;
}
m.ExportId = context.Id;
m.ExportResult = context.Result;
}
if (ExportType.HasValue && ExportTypeTargetId.HasValue)
if (exportType.HasValue && exportTypeTargetId.HasValue)
{
m.Options.ExportType = ExportType.Value;
m.Options.ExportTypeTargetId = ExportTypeTargetId.Value;
m.Options.ExportType = exportType.Value;
m.Options.ExportTypeTargetId = exportTypeTargetId.Value;
}
// UI Extensions
+5 -13
View File
@@ -1,6 +1,5 @@
using Disco.Models.Repository;
using Disco.Models.Services.Jobs;
using Disco.Models.Services.Jobs.Exporting;
using Disco.Models.Services.Jobs.JobLists;
using Disco.Models.UI.Job;
using Disco.Services;
@@ -24,7 +23,6 @@ using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Disco.Web.Controllers
@@ -1084,7 +1082,7 @@ namespace Disco.Web.Controllers
#region Export
[DiscoAuthorizeAny(Claims.Job.Actions.Export), HttpGet]
public virtual ActionResult Export(string downloadId)
public virtual ActionResult Export(Guid? exportId)
{
var m = new Models.Job.ExportModel()
{
@@ -1100,20 +1098,14 @@ namespace Disco.Web.Controllers
m.Options.FilterEndDate = null;
}
if (!string.IsNullOrWhiteSpace(downloadId))
if (ExportTask.TryFromCache(exportId, out var context))
{
string key = string.Format(Areas.API.Controllers.JobController.ExportSessionCacheKey, downloadId);
var context = HttpRuntime.Cache.Get(key) as ExportTaskContext<JobExportOptions>;
if (context != null)
{
m.ExportSessionResult = context.Result;
m.ExportSessionId = downloadId;
}
m.ExportId = context.Id;
m.ExportResult = context.Result;
}
// UI Extensions
UIExtensions.ExecuteExtensions<JobExportModel>(this.ControllerContext, m);
UIExtensions.ExecuteExtensions<JobExportModel>(ControllerContext, m);
return View(m);
}
@@ -546,7 +546,7 @@ namespace Disco.Web.Areas.API.Controllers
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_ExportRetrieve
{
public readonly string Id = "Id";
public readonly string id = "id";
}
static readonly ViewsClass s_views = new ViewsClass();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
@@ -911,14 +911,14 @@ namespace Disco.Web.Areas.API.Controllers
}
[NonAction]
partial void ExportRetrieveOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string Id);
partial void ExportRetrieveOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, System.Guid id);
[NonAction]
public override System.Web.Mvc.ActionResult ExportRetrieve(string Id)
public override System.Web.Mvc.ActionResult ExportRetrieve(System.Guid id)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.ExportRetrieve);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "Id", Id);
ExportRetrieveOverride(callInfo, Id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ExportRetrieveOverride(callInfo, id);
return callInfo;
}
@@ -349,7 +349,7 @@ namespace Disco.Web.Areas.API.Controllers
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_ExportRetrieve
{
public readonly string Id = "Id";
public readonly string id = "id";
}
static readonly ViewsClass s_views = new ViewsClass();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
@@ -567,14 +567,14 @@ namespace Disco.Web.Areas.API.Controllers
}
[NonAction]
partial void ExportRetrieveOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string Id);
partial void ExportRetrieveOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, System.Guid id);
[NonAction]
public override System.Web.Mvc.ActionResult ExportRetrieve(string Id)
public override System.Web.Mvc.ActionResult ExportRetrieve(System.Guid id)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.ExportRetrieve);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "Id", Id);
ExportRetrieveOverride(callInfo, Id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ExportRetrieveOverride(callInfo, id);
return callInfo;
}
@@ -2229,10 +2229,10 @@ namespace Disco.Web.Areas.API.Controllers
}
[NonAction]
partial void ExportRetrieveOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string id);
partial void ExportRetrieveOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, System.Guid id);
[NonAction]
public override System.Web.Mvc.ActionResult ExportRetrieve(string id)
public override System.Web.Mvc.ActionResult ExportRetrieve(System.Guid id)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.ExportRetrieve);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
@@ -349,7 +349,7 @@ namespace Disco.Web.Areas.API.Controllers
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_ExportRetrieve
{
public readonly string Id = "Id";
public readonly string id = "id";
}
static readonly ViewsClass s_views = new ViewsClass();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
@@ -567,14 +567,14 @@ namespace Disco.Web.Areas.API.Controllers
}
[NonAction]
partial void ExportRetrieveOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string Id);
partial void ExportRetrieveOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, System.Guid id);
[NonAction]
public override System.Web.Mvc.ActionResult ExportRetrieve(string Id)
public override System.Web.Mvc.ActionResult ExportRetrieve(System.Guid id)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.ExportRetrieve);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "Id", Id);
ExportRetrieveOverride(callInfo, Id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ExportRetrieveOverride(callInfo, id);
return callInfo;
}
@@ -123,9 +123,9 @@ namespace Disco.Web.Areas.Config.Controllers
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_Export
{
public readonly string DownloadId = "DownloadId";
public readonly string DeviceFlagId = "DeviceFlagId";
public readonly string CurrentOnly = "CurrentOnly";
public readonly string exportId = "exportId";
public readonly string deviceFlagId = "deviceFlagId";
public readonly string currentOnly = "currentOnly";
}
static readonly ViewsClass s_views = new ViewsClass();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
@@ -190,16 +190,16 @@ namespace Disco.Web.Areas.Config.Controllers
}
[NonAction]
partial void ExportOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string DownloadId, int? DeviceFlagId, bool? CurrentOnly);
partial void ExportOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, System.Guid? exportId, int? deviceFlagId, bool? currentOnly);
[NonAction]
public override System.Web.Mvc.ActionResult Export(string DownloadId, int? DeviceFlagId, bool? CurrentOnly)
public override System.Web.Mvc.ActionResult Export(System.Guid? exportId, int? deviceFlagId, bool? currentOnly)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Export);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "DownloadId", DownloadId);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "DeviceFlagId", DeviceFlagId);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "CurrentOnly", CurrentOnly);
ExportOverride(callInfo, DownloadId, DeviceFlagId, CurrentOnly);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "exportId", exportId);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "deviceFlagId", deviceFlagId);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "currentOnly", currentOnly);
ExportOverride(callInfo, exportId, deviceFlagId, currentOnly);
return callInfo;
}
@@ -123,9 +123,9 @@ namespace Disco.Web.Areas.Config.Controllers
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_Export
{
public readonly string DownloadId = "DownloadId";
public readonly string UserFlagId = "UserFlagId";
public readonly string CurrentOnly = "CurrentOnly";
public readonly string exportId = "exportId";
public readonly string userFlagId = "userFlagId";
public readonly string currentOnly = "currentOnly";
}
static readonly ViewsClass s_views = new ViewsClass();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
@@ -190,16 +190,16 @@ namespace Disco.Web.Areas.Config.Controllers
}
[NonAction]
partial void ExportOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string DownloadId, int? UserFlagId, bool? CurrentOnly);
partial void ExportOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, System.Guid? exportId, int? userFlagId, bool? currentOnly);
[NonAction]
public override System.Web.Mvc.ActionResult Export(string DownloadId, int? UserFlagId, bool? CurrentOnly)
public override System.Web.Mvc.ActionResult Export(System.Guid? exportId, int? userFlagId, bool? currentOnly)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Export);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "DownloadId", DownloadId);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "UserFlagId", UserFlagId);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "CurrentOnly", CurrentOnly);
ExportOverride(callInfo, DownloadId, UserFlagId, CurrentOnly);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "exportId", exportId);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "userFlagId", userFlagId);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "currentOnly", currentOnly);
ExportOverride(callInfo, exportId, userFlagId, currentOnly);
return callInfo;
}
@@ -141,9 +141,9 @@ namespace Disco.Web.Controllers
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_Export
{
public readonly string DownloadId = "DownloadId";
public readonly string ExportType = "ExportType";
public readonly string ExportTypeTargetId = "ExportTypeTargetId";
public readonly string exportId = "exportId";
public readonly string exportType = "exportType";
public readonly string exportTypeTargetId = "exportTypeTargetId";
}
static readonly ActionParamsClass_Import s_params_Import = new ActionParamsClass_Import();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
@@ -274,16 +274,16 @@ namespace Disco.Web.Controllers
}
[NonAction]
partial void ExportOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string DownloadId, Disco.Models.Services.Devices.Exporting.DeviceExportTypes? ExportType, int? ExportTypeTargetId);
partial void ExportOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, System.Guid? exportId, Disco.Models.Services.Devices.DeviceExportTypes? exportType, int? exportTypeTargetId);
[NonAction]
public override System.Web.Mvc.ActionResult Export(string DownloadId, Disco.Models.Services.Devices.Exporting.DeviceExportTypes? ExportType, int? ExportTypeTargetId)
public override System.Web.Mvc.ActionResult Export(System.Guid? exportId, Disco.Models.Services.Devices.DeviceExportTypes? exportType, int? exportTypeTargetId)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Export);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "DownloadId", DownloadId);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "ExportType", ExportType);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "ExportTypeTargetId", ExportTypeTargetId);
ExportOverride(callInfo, DownloadId, ExportType, ExportTypeTargetId);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "exportId", exportId);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "exportType", exportType);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "exportTypeTargetId", exportTypeTargetId);
ExportOverride(callInfo, exportId, exportType, exportTypeTargetId);
return callInfo;
}
@@ -285,7 +285,7 @@ namespace Disco.Web.Controllers
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_Export
{
public readonly string downloadId = "downloadId";
public readonly string exportId = "exportId";
}
static readonly ViewsClass s_views = new ViewsClass();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
@@ -711,14 +711,14 @@ namespace Disco.Web.Controllers
}
[NonAction]
partial void ExportOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string downloadId);
partial void ExportOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, System.Guid? exportId);
[NonAction]
public override System.Web.Mvc.ActionResult Export(string downloadId)
public override System.Web.Mvc.ActionResult Export(System.Guid? exportId)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Export);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "downloadId", downloadId);
ExportOverride(callInfo, downloadId);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "exportId", exportId);
ExportOverride(callInfo, exportId);
return callInfo;
}
+4 -3
View File
@@ -1,6 +1,7 @@
using Disco.Models.Services.Devices.Exporting;
using Disco.Models.Services.Devices;
using Disco.Models.Services.Exporting;
using Disco.Models.UI.Device;
using System;
using System.Collections.Generic;
namespace Disco.Web.Models.Device
@@ -9,8 +10,8 @@ namespace Disco.Web.Models.Device
{
public DeviceExportOptions Options { get; set; }
public string ExportSessionId { get; set; }
public ExportResult ExportSessionResult { get; set; }
public Guid? ExportId { get; set; }
public ExportResult ExportResult { get; set; }
public IEnumerable<KeyValuePair<int, string>> DeviceBatches { get; set; }
public IEnumerable<KeyValuePair<int, string>> DeviceModels { get; set; }
+4 -3
View File
@@ -1,7 +1,8 @@
using Disco.Models.Repository;
using Disco.Models.Services.Exporting;
using Disco.Models.Services.Jobs.Exporting;
using Disco.Models.Services.Jobs;
using Disco.Models.UI.Job;
using System;
using System.Collections.Generic;
namespace Disco.Web.Models.Job
@@ -10,8 +11,8 @@ namespace Disco.Web.Models.Job
{
public JobExportOptions Options { get; set; }
public string ExportSessionId { get; set; }
public ExportResult ExportSessionResult { get; set; }
public Guid? ExportId { get; set; }
public ExportResult ExportResult { get; set; }
public List<JobQueue> JobQueues { get; set; }
public List<KeyValuePair<string, string>> JobStatuses { get; set; }
+5 -5
View File
@@ -21,7 +21,7 @@
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 }))
@Html.DropDownListFor(m => m.Options.ExportType, Enum.GetNames(typeof(Disco.Models.Services.Devices.DeviceExportTypes)).Select(t => new SelectListItem() { Text = t, Value = t }))
<div id="Devices_Export_Type_Target_Batch" class="Devices_Export_Type_Target">
@Html.DropDownListFor(m => m.Options.ExportTypeTargetId, Model.DeviceBatches.Select(i => new SelectListItem() { Value = i.Key.ToString(), Text = i.Value }))
</div>
@@ -175,17 +175,17 @@
</script>
}
</div>
@if (Model.ExportSessionId != null)
@if (Model.ExportId.HasValue)
{
<div id="Devices_Export_Download_Dialog" class="dialog" title="Export Devices">
@if (Model.ExportSessionResult.RecordCount == 0)
@if (Model.ExportResult.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>
<h4>@Model.ExportResult.RecordCount record@(Model.ExportResult.RecordCount != 1 ? "s" : null) were successfully exported.</h4>
<a href="@Url.Action(MVC.API.Device.ExportRetrieve(Model.ExportId.Value))" class="button"><i class="fa fa-download fa-lg"></i>Download Device Export</a>
}
</div>
<script>
+38 -38
View File
@@ -117,7 +117,7 @@ WriteLiteral(" ");
#line 24 "..\..\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 })));
Write(Html.DropDownListFor(m => m.Options.ExportType, Enum.GetNames(typeof(Disco.Models.Services.Devices.DeviceExportTypes)).Select(t => new SelectListItem() { Text = t, Value = t })));
#line default
@@ -323,40 +323,40 @@ WriteLiteral(">\r\n");
#line hidden
WriteLiteral(" <li");
WriteAttribute("title", Tuple.Create(" title=\"", 3928), Tuple.Create("\"", 3959)
WriteAttribute("title", Tuple.Create(" title=\"", 3918), Tuple.Create("\"", 3949)
#line 67 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 3936), Tuple.Create<System.Object, System.Int32>(optionItem.Description
, Tuple.Create(Tuple.Create("", 3926), Tuple.Create<System.Object, System.Int32>(optionItem.Description
#line default
#line hidden
, 3936), false)
, 3926), false)
);
WriteLiteral(">\r\n <input");
WriteLiteral(" type=\"checkbox\"");
WriteAttribute("id", Tuple.Create(" id=\"", 4041), Tuple.Create("\"", 4078)
, Tuple.Create(Tuple.Create("", 4046), Tuple.Create("Options_", 4046), true)
WriteAttribute("id", Tuple.Create(" id=\"", 4031), Tuple.Create("\"", 4068)
, Tuple.Create(Tuple.Create("", 4036), Tuple.Create("Options_", 4036), true)
#line 68 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4054), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
, Tuple.Create(Tuple.Create("", 4044), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line default
#line hidden
, 4054), false)
, 4044), false)
);
WriteAttribute("name", Tuple.Create(" name=\"", 4079), Tuple.Create("\"", 4118)
, Tuple.Create(Tuple.Create("", 4086), Tuple.Create("Options.", 4086), true)
WriteAttribute("name", Tuple.Create(" name=\"", 4069), Tuple.Create("\"", 4108)
, Tuple.Create(Tuple.Create("", 4076), Tuple.Create("Options.", 4076), true)
#line 68 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4094), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
, Tuple.Create(Tuple.Create("", 4084), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line default
#line hidden
, 4094), false)
, 4084), false)
);
WriteLiteral(" value=\"true\"");
@@ -372,15 +372,15 @@ WriteLiteral(" ");
#line hidden
WriteLiteral(" /><label");
WriteAttribute("for", Tuple.Create(" for=\"", 4189), Tuple.Create("\"", 4227)
, Tuple.Create(Tuple.Create("", 4195), Tuple.Create("Options_", 4195), true)
WriteAttribute("for", Tuple.Create(" for=\"", 4179), Tuple.Create("\"", 4217)
, Tuple.Create(Tuple.Create("", 4185), Tuple.Create("Options_", 4185), true)
#line 68 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4203), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
, Tuple.Create(Tuple.Create("", 4193), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line default
#line hidden
, 4203), false)
, 4193), false)
);
WriteLiteral(">");
@@ -428,40 +428,40 @@ WriteLiteral(">\r\n");
#line hidden
WriteLiteral(" <li");
WriteAttribute("title", Tuple.Create(" title=\"", 4816), Tuple.Create("\"", 4847)
WriteAttribute("title", Tuple.Create(" title=\"", 4806), Tuple.Create("\"", 4837)
#line 77 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4824), Tuple.Create<System.Object, System.Int32>(optionItem.Description
, Tuple.Create(Tuple.Create("", 4814), Tuple.Create<System.Object, System.Int32>(optionItem.Description
#line default
#line hidden
, 4824), false)
, 4814), false)
);
WriteLiteral(">\r\n <input");
WriteLiteral(" type=\"checkbox\"");
WriteAttribute("id", Tuple.Create(" id=\"", 4929), Tuple.Create("\"", 4966)
, Tuple.Create(Tuple.Create("", 4934), Tuple.Create("Options_", 4934), true)
WriteAttribute("id", Tuple.Create(" id=\"", 4919), Tuple.Create("\"", 4956)
, Tuple.Create(Tuple.Create("", 4924), Tuple.Create("Options_", 4924), true)
#line 78 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4942), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
, Tuple.Create(Tuple.Create("", 4932), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line default
#line hidden
, 4942), false)
, 4932), false)
);
WriteAttribute("name", Tuple.Create(" name=\"", 4967), Tuple.Create("\"", 5006)
, Tuple.Create(Tuple.Create("", 4974), Tuple.Create("Options.", 4974), true)
WriteAttribute("name", Tuple.Create(" name=\"", 4957), Tuple.Create("\"", 4996)
, Tuple.Create(Tuple.Create("", 4964), Tuple.Create("Options.", 4964), true)
#line 78 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4982), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
, Tuple.Create(Tuple.Create("", 4972), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line default
#line hidden
, 4982), false)
, 4972), false)
);
WriteLiteral(" value=\"true\"");
@@ -477,15 +477,15 @@ WriteLiteral(" ");
#line hidden
WriteLiteral(" /><label");
WriteAttribute("for", Tuple.Create(" for=\"", 5077), Tuple.Create("\"", 5115)
, Tuple.Create(Tuple.Create("", 5083), Tuple.Create("Options_", 5083), true)
WriteAttribute("for", Tuple.Create(" for=\"", 5067), Tuple.Create("\"", 5105)
, Tuple.Create(Tuple.Create("", 5073), Tuple.Create("Options_", 5073), true)
#line 78 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 5091), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
, Tuple.Create(Tuple.Create("", 5081), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line default
#line hidden
, 5091), false)
, 5081), false)
);
WriteLiteral(">");
@@ -583,7 +583,7 @@ WriteLiteral("</div>\r\n");
#line 178 "..\..\Views\Device\Export.cshtml"
if (Model.ExportSessionId != null)
if (Model.ExportId.HasValue)
{
@@ -607,7 +607,7 @@ WriteLiteral(">\r\n");
#line hidden
#line 181 "..\..\Views\Device\Export.cshtml"
if (Model.ExportSessionResult.RecordCount == 0)
if (Model.ExportResult.RecordCount == 0)
{
@@ -628,7 +628,7 @@ WriteLiteral(" <h4>");
#line 187 "..\..\Views\Device\Export.cshtml"
Write(Model.ExportSessionResult.RecordCount);
Write(Model.ExportResult.RecordCount);
#line default
@@ -637,7 +637,7 @@ WriteLiteral(" record");
#line 187 "..\..\Views\Device\Export.cshtml"
Write(Model.ExportSessionResult.RecordCount != 1 ? "s" : null);
Write(Model.ExportResult.RecordCount != 1 ? "s" : null);
#line default
@@ -646,14 +646,14 @@ WriteLiteral(" were successfully exported.</h4>\r\n");
WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 9710), Tuple.Create("\"", 9782)
WriteAttribute("href", Tuple.Create(" href=\"", 9673), Tuple.Create("\"", 9744)
#line 188 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 9717), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.ExportRetrieve(Model.ExportSessionId))
, Tuple.Create(Tuple.Create("", 9680), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.ExportRetrieve(Model.ExportId.Value))
#line default
#line hidden
, 9717), false)
, 9680), false)
);
WriteLiteral(" class=\"button\"");
+4 -4
View File
@@ -253,17 +253,17 @@
</script>
}
</div>
@if (Model.ExportSessionId != null)
@if (Model.ExportId.HasValue)
{
<div id="Jobs_Export_Download_Dialog" class="dialog" title="Export Jobs">
@if (Model.ExportSessionResult.RecordCount == 0)
@if (Model.ExportResult.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.Job.ExportRetrieve(Model.ExportSessionId))" class="button"><i class="fa fa-download fa-lg"></i>Download Job Export</a>
<h4>@Model.ExportResult.RecordCount record@(Model.ExportResult.RecordCount != 1 ? "s" : null) were successfully exported.</h4>
<a href="@Url.Action(MVC.API.Job.ExportRetrieve(Model.ExportId.Value))" class="button"><i class="fa fa-download fa-lg"></i>Download Job Export</a>
}
</div>
<script>
+7 -7
View File
@@ -960,7 +960,7 @@ WriteLiteral("</div>\r\n");
#line 256 "..\..\Views\Job\Export.cshtml"
if (Model.ExportSessionId != null)
if (Model.ExportId.HasValue)
{
@@ -984,7 +984,7 @@ WriteLiteral(">\r\n");
#line hidden
#line 259 "..\..\Views\Job\Export.cshtml"
if (Model.ExportSessionResult.RecordCount == 0)
if (Model.ExportResult.RecordCount == 0)
{
@@ -1005,7 +1005,7 @@ WriteLiteral(" <h4>");
#line 265 "..\..\Views\Job\Export.cshtml"
Write(Model.ExportSessionResult.RecordCount);
Write(Model.ExportResult.RecordCount);
#line default
@@ -1014,7 +1014,7 @@ WriteLiteral(" record");
#line 265 "..\..\Views\Job\Export.cshtml"
Write(Model.ExportSessionResult.RecordCount != 1 ? "s" : null);
Write(Model.ExportResult.RecordCount != 1 ? "s" : null);
#line default
@@ -1023,14 +1023,14 @@ WriteLiteral(" were successfully exported.</h4>\r\n");
WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 14444), Tuple.Create("\"", 14513)
WriteAttribute("href", Tuple.Create(" href=\"", 14417), Tuple.Create("\"", 14485)
#line 266 "..\..\Views\Job\Export.cshtml"
, Tuple.Create(Tuple.Create("", 14451), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.ExportRetrieve(Model.ExportSessionId))
, Tuple.Create(Tuple.Create("", 14424), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.ExportRetrieve(Model.ExportId.Value))
#line default
#line hidden
, 14451), false)
, 14424), false)
);
WriteLiteral(" class=\"button\"");