Export devices without a batch assigned #60
This commit is contained in:
@@ -120,7 +120,10 @@ namespace Disco.Services.Devices.Exporting
|
|||||||
case DeviceExportTypes.All:
|
case DeviceExportTypes.All:
|
||||||
return GenerateExport(Database, Database.Devices, Options, TaskStatus);
|
return GenerateExport(Database, Database.Devices, Options, TaskStatus);
|
||||||
case DeviceExportTypes.Batch:
|
case DeviceExportTypes.Batch:
|
||||||
|
if (Options.ExportTypeTargetId.HasValue && Options.ExportTypeTargetId.Value > 0)
|
||||||
return GenerateExport(Database, Database.Devices.Where(d => d.DeviceBatchId == Options.ExportTypeTargetId), Options, TaskStatus);
|
return GenerateExport(Database, Database.Devices.Where(d => d.DeviceBatchId == Options.ExportTypeTargetId), Options, TaskStatus);
|
||||||
|
else
|
||||||
|
return GenerateExport(Database, Database.Devices.Where(d => d.DeviceBatchId == null), Options, TaskStatus);
|
||||||
case DeviceExportTypes.Model:
|
case DeviceExportTypes.Model:
|
||||||
return GenerateExport(Database, Database.Devices.Where(d => d.DeviceModelId == Options.ExportTypeTargetId), Options, TaskStatus);
|
return GenerateExport(Database, Database.Devices.Where(d => d.DeviceModelId == Options.ExportTypeTargetId), Options, TaskStatus);
|
||||||
case DeviceExportTypes.Profile:
|
case DeviceExportTypes.Profile:
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ namespace Disco.Web.Controllers
|
|||||||
var m = new Models.Device.ExportModel()
|
var m = new Models.Device.ExportModel()
|
||||||
{
|
{
|
||||||
Options = Database.DiscoConfiguration.Devices.LastExportOptions,
|
Options = Database.DiscoConfiguration.Devices.LastExportOptions,
|
||||||
DeviceBatches = Database.DeviceBatches.OrderBy(db => db.Name).Select(db => new { Key = db.Id, Value = db.Name }).ToList().Select(i => new KeyValuePair<int, string>(i.Key, i.Value)),
|
DeviceBatches = new KeyValuePair<int, string>[] { new KeyValuePair<int, string>(0, "<No Associated Batch>") }.Concat(Database.DeviceBatches.OrderBy(db => db.Name).Select(db => new { Key = db.Id, Value = db.Name }).ToList().Select(i => new KeyValuePair<int, string>(i.Key, i.Value))),
|
||||||
DeviceModels = Database.DeviceModels.OrderBy(dm => dm.Description).Select(dm => new { Key = dm.Id, Value = dm.Description }).ToList().Select(i => new KeyValuePair<int, string>(i.Key, i.Value)),
|
DeviceModels = Database.DeviceModels.OrderBy(dm => dm.Description).Select(dm => new { Key = dm.Id, Value = dm.Description }).ToList().Select(i => new KeyValuePair<int, string>(i.Key, i.Value)),
|
||||||
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))
|
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))
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user