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\"");