diff --git a/Disco.Models/Exporting/ExportMetadata.cs b/Disco.Models/Exporting/ExportMetadata.cs index 50800aa6..9df00d3f 100644 --- a/Disco.Models/Exporting/ExportMetadata.cs +++ b/Disco.Models/Exporting/ExportMetadata.cs @@ -8,7 +8,7 @@ namespace Disco.Models.Exporting where O : IExportOptions where R : IExportRecord { - public List IgnoreShortNames { get; } = new List(); + public List IgnoreGroupNames { get; } = new List(); public O Options { get; set; } public ExportMetadata(O options) diff --git a/Disco.Models/Services/Devices/DeviceExportOptions.cs b/Disco.Models/Services/Devices/DeviceExportOptions.cs index c4371cae..3733bd45 100644 --- a/Disco.Models/Services/Devices/DeviceExportOptions.cs +++ b/Disco.Models/Services/Devices/DeviceExportOptions.cs @@ -1,5 +1,6 @@ using Disco.Models.Exporting; using Disco.Models.Services.Exporting; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace Disco.Models.Services.Devices @@ -13,127 +14,126 @@ namespace Disco.Models.Services.Devices public int? ExportTypeTargetId { get; set; } // Device - [Display(ShortName = "Device", Name = "Serial Number", Description = "The device serial number")] + [Display(GroupName = "Device", Name = "Serial Number", Description = "The device serial number")] public bool DeviceSerialNumber { get; set; } - [Display(ShortName = "Device", Name = "Asset Number", Description = "The device asset number")] + [Display(GroupName = "Device", Name = "Asset Number", Description = "The device asset number")] public bool DeviceAssetNumber { get; set; } - [Display(ShortName = "Device", Name = "Location", Description = "The device location")] + [Display(GroupName = "Device", Name = "Location", Description = "The device location")] public bool DeviceLocation { get; set; } - [Display(ShortName = "Device", Name = "Computer Name", Description = "The device computer name")] + [Display(GroupName = "Device", Name = "Computer Name", Description = "The device computer name")] public bool DeviceComputerName { get; set; } - [Display(ShortName = "Device", Name = "Last Network Logon", Description = "The last recorded time the device access the network")] + [Display(GroupName = "Device", Name = "Last Network Logon", Description = "The last recorded time the device access the network")] public bool DeviceLastNetworkLogon { get; set; } - [Display(ShortName = "Device", Name = "Created Date", Description = "The date the device was created in Disco ICT")] + [Display(GroupName = "Device", Name = "Created Date", Description = "The date the device was created in Disco ICT")] public bool DeviceCreatedDate { get; set; } - [Display(ShortName = "Device", Name = "First Enrolled Date", Description = "The date the device was first enrolled in Disco ICT")] + [Display(GroupName = "Device", Name = "First Enrolled Date", Description = "The date the device was first enrolled in Disco ICT")] public bool DeviceFirstEnrolledDate { get; set; } - [Display(ShortName = "Device", Name = "Last Enrolled Date", Description = "The date the device was last enrolled in Disco ICT")] + [Display(GroupName = "Device", Name = "Last Enrolled Date", Description = "The date the device was last enrolled in Disco ICT")] public bool DeviceLastEnrolledDate { get; set; } - [Display(ShortName = "Device", Name = "Enrolment Trusted", Description = "The device is trusted to complete an unauthenticated enrolment")] + [Display(GroupName = "Device", Name = "Enrollment Trusted", Description = "The device is trusted to complete an unauthenticated enrollment")] public bool DeviceAllowUnauthenticatedEnrol { get; set; } - [Display(ShortName = "Device", Name = "Decommissioned Date", Description = "The date the device was decommissioned in Disco ICT")] + [Display(GroupName = "Device", Name = "Decommissioned Date", Description = "The date the device was decommissioned in Disco ICT")] public bool DeviceDecommissionedDate { get; set; } - [Display(ShortName = "Device", Name = "Decommissioned Reason", Description = "The reason the device was decommissioned")] + [Display(GroupName = "Device", Name = "Decommissioned Reason", Description = "The reason the device was decommissioned")] public bool DeviceDecommissionedReason { get; set; } // Model - [Display(ShortName = "Model", Name = "Identifier", Description = "The identifier of the device model associated with the device")] + [Display(GroupName = "Model", Name = "Identifier", Description = "The identifier of the device model associated with the device")] public bool ModelId { get; set; } - [Display(ShortName = "Model", Name = "Description", Description = "The description of the device model associated with the device")] + [Display(GroupName = "Model", Name = "Description", Description = "The description of the device model associated with the device")] public bool ModelDescription { get; set; } - [Display(ShortName = "Model", Name = "Manufacturer", Description = "The manufacturer of the device model associated with the device")] + [Display(GroupName = "Model", Name = "Manufacturer", Description = "The manufacturer of the device model associated with the device")] public bool ModelManufacturer { get; set; } - [Display(ShortName = "Model", Name = "Model", Description = "The model of the device model associated with the device")] + [Display(GroupName = "Model", Name = "Model", Description = "The model of the device model associated with the device")] public bool ModelModel { get; set; } - [Display(ShortName = "Model", Name = "Type", Description = "The type of device model associated with the device")] + [Display(GroupName = "Model", Name = "Type", Description = "The type of device model associated with the device")] public bool ModelType { get; set; } // Batch - [Display(ShortName = "Batch", Name = "Identifier", Description = "The identifier of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Identifier", Description = "The identifier of the device batch associated with the device")] public bool BatchId { get; set; } - [Display(ShortName = "Batch", Name = "Name", Description = "The name of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Name", Description = "The name of the device batch associated with the device")] public bool BatchName { get; set; } - [Display(ShortName = "Batch", Name = "Purchase Date", Description = "The purchase date of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Purchase Date", Description = "The purchase date of the device batch associated with the device")] public bool BatchPurchaseDate { get; set; } - [Display(ShortName = "Batch", Name = "Supplier", Description = "The supplier of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Supplier", Description = "The supplier of the device batch associated with the device")] public bool BatchSupplier { get; set; } - [Display(ShortName = "Batch", Name = "Unit Cost", Description = "The unit cost of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Unit Cost", Description = "The unit cost of the device batch associated with the device")] public bool BatchUnitCost { get; set; } - [Display(ShortName = "Batch", Name = "Warranty Valid Until Date", Description = "The warranty valid until date of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Warranty Valid Until Date", Description = "The warranty valid until date of the device batch associated with the device")] public bool BatchWarrantyValidUntilDate { get; set; } - [Display(ShortName = "Batch", Name = "Insured Date", Description = "The insured date of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Insured Date", Description = "The insured date of the device batch associated with the device")] public bool BatchInsuredDate { get; set; } - [Display(ShortName = "Batch", Name = "Insurance Supplier", Description = "The insurance supplier of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Insurance Supplier", Description = "The insurance supplier of the device batch associated with the device")] public bool BatchInsuranceSupplier { get; set; } - [Display(ShortName = "Batch", Name = "Insured Until Date", Description = "The insured until date of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Insured Until Date", Description = "The insured until date of the device batch associated with the device")] public bool BatchInsuredUntilDate { get; set; } // Profile - [Display(ShortName = "Profile", Name = "Identifier", Description = "The identifier of the device profile associated with the device")] + [Display(GroupName = "Profile", Name = "Identifier", Description = "The identifier of the device profile associated with the device")] public bool ProfileId { get; set; } - [Display(ShortName = "Profile", Name = "Name", Description = "The name of the device profile associated with the device")] + [Display(GroupName = "Profile", Name = "Name", Description = "The name of the device profile associated with the device")] public bool ProfileName { get; set; } - [Display(ShortName = "Profile", Name = "Short Name", Description = "The short name of the device profile associated with the device")] + [Display(GroupName = "Profile", Name = "Short Name", Description = "The short name of the device profile associated with the device")] public bool ProfileShortName { get; set; } // User - [Display(ShortName = "Assigned User", Name = "Identifier", Description = "The identifier of the user assigned to the device")] + [Display(GroupName = "Assigned User", Name = "Identifier", Description = "The identifier of the user assigned to the device")] public bool AssignedUserId { get; set; } - [Display(ShortName = "Assigned User", Name = "Assigned Date", Description = "The date the device was assigned to the user")] + [Display(GroupName = "Assigned User", Name = "Assigned Date", Description = "The date the device was assigned to the user")] public bool AssignedUserDate { get; set; } - [Display(ShortName = "Assigned User", Name = "Display Name", Description = "The display name of the user assigned to the device")] + [Display(GroupName = "Assigned User", Name = "Display Name", Description = "The display name of the user assigned to the device")] public bool AssignedUserDisplayName { get; set; } - [Display(ShortName = "Assigned User", Name = "Surname", Description = "The surname of the user assigned to the device")] + [Display(GroupName = "Assigned User", Name = "Surname", Description = "The surname of the user assigned to the device")] public bool AssignedUserSurname { get; set; } - [Display(ShortName = "Assigned User", Name = "Given Name", Description = "The given name of the user assigned to the device")] + [Display(GroupName = "Assigned User", Name = "Given Name", Description = "The given name of the user assigned to the device")] public bool AssignedUserGivenName { get; set; } - [Display(ShortName = "Assigned User", Name = "Phone Number", Description = "The phone number of the user assigned to the device")] + [Display(GroupName = "Assigned User", Name = "Phone Number", Description = "The phone number of the user assigned to the device")] public bool AssignedUserPhoneNumber { get; set; } - [Display(ShortName = "Assigned User", Name = "Email Address", Description = "The email address of the user assigned to the device")] + [Display(GroupName = "Assigned User", Name = "Email Address", Description = "The email address of the user assigned to the device")] public bool AssignedUserEmailAddress { get; set; } - [Display(ShortName = "Assigned User", Name = "Custom Details", Description = "The custom details provided by plugins for the user assigned to the device")] - public bool AssignedUserDetailCustom { get; set; } + public List UserDetailCustom { get; set; } = new List(); // Jobs - [Display(ShortName = "Jobs", Name = "Count", Description = "The total number of jobs associated with the device")] + [Display(GroupName = "Jobs", Name = "Count", Description = "The total number of jobs associated with the device")] public bool JobsTotalCount { get; set; } - [Display(ShortName = "Jobs", Name = "Count Open", Description = "The total number of open jobs associated with the device")] + [Display(GroupName = "Jobs", Name = "Count Open", Description = "The total number of open jobs associated with the device")] public bool JobsOpenCount { get; set; } // Attachments - [Display(ShortName = "Attachments", Name = "Count", Description = "The number of attachments associated with the device")] + [Display(GroupName = "Attachments", Name = "Count", Description = "The number of attachments associated with the device")] public bool AttachmentsCount { get; set; } // Certificates - [Display(ShortName = "Certificates", Name = "Certificates", Description = "The assigned active certificates associated with the device")] + [Display(GroupName = "Certificates", Name = "Certificates", Description = "The assigned active certificates associated with the device")] public bool Certificates { get; set; } // Details - [Display(ShortName = "Details", Name = "BIOS", Description = "The BIOS associated with the device")] + [Display(GroupName = "Details", Name = "BIOS", Description = "The BIOS associated with the device")] public bool DetailBios { get; set; } - [Display(ShortName = "Details", Name = "Base Board", Description = "The Base Board associated with the device")] + [Display(GroupName = "Details", Name = "Base Board", Description = "The Base Board associated with the device")] public bool DetailBaseBoard { get; set; } - [Display(ShortName = "Details", Name = "System", Description = "The System information associated with the device")] + [Display(GroupName = "Details", Name = "System", Description = "The System information associated with the device")] public bool DetailComputerSystem { get; set; } - [Display(ShortName = "Details", Name = "Processors", Description = "The CPU Processors associated with the device")] + [Display(GroupName = "Details", Name = "Processors", Description = "The CPU Processors associated with the device")] public bool DetailProcessors { get; set; } - [Display(ShortName = "Details", Name = "Memory", Description = "The Memory/RAM associated with the device")] + [Display(GroupName = "Details", Name = "Memory", Description = "The Memory/RAM associated with the device")] public bool DetailMemory { get; set; } - [Display(ShortName = "Details", Name = "Disk Drives", Description = "The Disk Drives associated with the device")] + [Display(GroupName = "Details", Name = "Disk Drives", Description = "The Disk Drives associated with the device")] public bool DetailDiskDrives { get; set; } - [Display(ShortName = "Details", Name = "LAN Adapters", Description = "The LAN Adapters associated with the device")] + [Display(GroupName = "Details", Name = "LAN Adapters", Description = "The LAN Adapters associated with the device")] public bool DetailLanAdapters { get; set; } - [Display(ShortName = "Details", Name = "Wireless LAN Adapters", Description = "The Wireless LAN Adapters associated with the device")] + [Display(GroupName = "Details", Name = "Wireless LAN Adapters", Description = "The Wireless LAN Adapters associated with the device")] public bool DetailWLanAdapters { get; set; } - [Display(ShortName = "Details", Name = "MDM Hardware Data", Description = "The Mobile Device Management Hardware Data associated with the device")] + [Display(GroupName = "Details", Name = "MDM Hardware Data", Description = "The Mobile Device Management Hardware Data associated with the device")] public bool DetailMdmHardwareData { get; set; } - [Display(ShortName = "Details", Name = "AC Adapter", Description = "The AC Adapter associated with the device")] + [Display(GroupName = "Details", Name = "AC Adapter", Description = "The AC Adapter associated with the device")] public bool DetailACAdapter { get; set; } - [Display(ShortName = "Details", Name = "Battery", Description = "The manually entered battery associated with the device")] + [Display(GroupName = "Details", Name = "Battery", Description = "The manually entered battery associated with the device")] public bool DetailBatteries { get; set; } - [Display(ShortName = "Details", Name = "Batteries", Description = "The reported batteries associated with the device")] + [Display(GroupName = "Details", Name = "Batteries", Description = "The reported batteries associated with the device")] public bool DetailBattery { get; set; } - [Display(ShortName = "Details", Name = "Keyboard", Description = "The Keyboard associated with the device")] + [Display(GroupName = "Details", Name = "Keyboard", Description = "The Keyboard associated with the device")] public bool DetailKeyboard { get; set; } public static DeviceExportOptions DefaultOptions() diff --git a/Disco.Models/Services/Devices/DeviceFlags/DeviceFlagExportOptions.cs b/Disco.Models/Services/Devices/DeviceFlags/DeviceFlagExportOptions.cs index d275b30d..917748d2 100644 --- a/Disco.Models/Services/Devices/DeviceFlags/DeviceFlagExportOptions.cs +++ b/Disco.Models/Services/Devices/DeviceFlags/DeviceFlagExportOptions.cs @@ -17,51 +17,51 @@ namespace Disco.Models.Services.Devices.DeviceFlag public bool CurrentOnly { get; set; } // Device Flag - [Display(ShortName = "Device Flag", Name = "Identifier", Description = "The identifier of the device flag")] + [Display(GroupName = "Device Flag", Name = "Identifier", Description = "The identifier of the device flag")] public bool Id { get; set; } - [Display(ShortName = "Device Flag", Name = "Name", Description = "The name of the device flag")] + [Display(GroupName = "Device Flag", Name = "Name", Description = "The name of the device flag")] public bool Name { get; set; } - [Display(ShortName = "Device Flag", Name = "Description", Description = "The description of the device flag")] + [Display(GroupName = "Device Flag", Name = "Description", Description = "The description of the device flag")] public bool Description { get; set; } - [Display(ShortName = "Device Flag", Name = "Icon", Description = "The icon assigned to the device flag")] + [Display(GroupName = "Device Flag", Name = "Icon", Description = "The icon assigned to the device flag")] public bool Icon { get; set; } - [Display(ShortName = "Device Flag", Name = "Icon Colour", Description = "The icon colour assigned to the device flag")] + [Display(GroupName = "Device Flag", Name = "Icon Colour", Description = "The icon colour assigned to the device flag")] public bool IconColour { get; set; } - [Display(ShortName = "Device Flag", Name = "Assignment Identifier", Description = "The identifier of the device flag assignment")] + [Display(GroupName = "Device Flag", Name = "Assignment Identifier", Description = "The identifier of the device flag assignment")] public bool AssignmentId { get; set; } - [Display(ShortName = "Device Flag", Name = "Added Date", Description = "The date the device flag was assigned to the user")] + [Display(GroupName = "Device Flag", Name = "Added Date", Description = "The date the device flag was assigned to the user")] public bool AddedDate { get; set; } - [Display(ShortName = "Device Flag", Name = "Added User Identifier", Description = "The identifier of the user who assigned the device flag")] + [Display(GroupName = "Device Flag", Name = "Added User Identifier", Description = "The identifier of the user who assigned the device flag")] public bool AddedUserId { get; set; } - [Display(ShortName = "Device Flag", Name = "Removed Date", Description = "The date the device flag was unassigned from the user")] + [Display(GroupName = "Device Flag", Name = "Removed Date", Description = "The date the device flag was unassigned from the user")] public bool RemovedDate { get; set; } - [Display(ShortName = "Device Flag", Name = "Removed User Identifier", Description = "The identifier of the user who unassigned the device flag")] + [Display(GroupName = "Device Flag", Name = "Removed User Identifier", Description = "The identifier of the user who unassigned the device flag")] public bool RemovedUserId { get; set; } - [Display(ShortName = "Device Flag", Name = "Comments", Description = "The comments associated with the device flag assignment")] + [Display(GroupName = "Device Flag", Name = "Comments", Description = "The comments associated with the device flag assignment")] public bool Comments { get; set; } // Device - [Display(ShortName = "Device", Name = "Serial Number", Description = "The device serial number")] + [Display(GroupName = "Device", Name = "Serial Number", Description = "The device serial number")] public bool DeviceSerialNumber { get; set; } - [Display(ShortName = "Device", Name = "Asset Number", Description = "The device asset number")] + [Display(GroupName = "Device", Name = "Asset Number", Description = "The device asset number")] public bool DeviceAssetNumber { get; set; } - [Display(ShortName = "Device", Name = "Location", Description = "The device location")] + [Display(GroupName = "Device", Name = "Location", Description = "The device location")] public bool DeviceLocation { get; set; } - [Display(ShortName = "Device", Name = "Computer Name", Description = "The device computer name")] + [Display(GroupName = "Device", Name = "Computer Name", Description = "The device computer name")] public bool DeviceComputerName { get; set; } - [Display(ShortName = "Device", Name = "Last Network Logon", Description = "The last recorded time the device access the network")] + [Display(GroupName = "Device", Name = "Last Network Logon", Description = "The last recorded time the device access the network")] public bool DeviceLastNetworkLogon { get; set; } - [Display(ShortName = "Device", Name = "Created Date", Description = "The date the device was created in Disco ICT")] + [Display(GroupName = "Device", Name = "Created Date", Description = "The date the device was created in Disco ICT")] public bool DeviceCreatedDate { get; set; } - [Display(ShortName = "Device", Name = "First Enrolled Date", Description = "The date the device was first enrolled in Disco ICT")] + [Display(GroupName = "Device", Name = "First Enrolled Date", Description = "The date the device was first enrolled in Disco ICT")] public bool DeviceFirstEnrolledDate { get; set; } - [Display(ShortName = "Device", Name = "Last Enrolled Date", Description = "The date the device was last enrolled in Disco ICT")] + [Display(GroupName = "Device", Name = "Last Enrolled Date", Description = "The date the device was last enrolled in Disco ICT")] public bool DeviceLastEnrolledDate { get; set; } - [Display(ShortName = "Device", Name = "Enrolment Trusted", Description = "The device is trusted to complete an unauthenticated enrolment")] + [Display(GroupName = "Device", Name = "Enrolment Trusted", Description = "The device is trusted to complete an unauthenticated enrolment")] public bool DeviceAllowUnauthenticatedEnrol { get; set; } - [Display(ShortName = "Device", Name = "Decommissioned Date", Description = "The date the device was decommissioned in Disco ICT")] + [Display(GroupName = "Device", Name = "Decommissioned Date", Description = "The date the device was decommissioned in Disco ICT")] public bool DeviceDecommissionedDate { get; set; } - [Display(ShortName = "Device", Name = "Decommissioned Reason", Description = "The reason the device was decommissioned")] + [Display(GroupName = "Device", Name = "Decommissioned Reason", Description = "The reason the device was decommissioned")] public bool DeviceDecommissionedReason { get; set; } public bool HasDeviceOptions() @@ -80,15 +80,15 @@ namespace Disco.Models.Services.Devices.DeviceFlag } // Model - [Display(ShortName = "Model", Name = "Identifier", Description = "The identifier of the device model associated with the device")] + [Display(GroupName = "Model", Name = "Identifier", Description = "The identifier of the device model associated with the device")] public bool ModelId { get; set; } - [Display(ShortName = "Model", Name = "Description", Description = "The description of the device model associated with the device")] + [Display(GroupName = "Model", Name = "Description", Description = "The description of the device model associated with the device")] public bool ModelDescription { get; set; } - [Display(ShortName = "Model", Name = "Manufacturer", Description = "The manufacturer of the device model associated with the device")] + [Display(GroupName = "Model", Name = "Manufacturer", Description = "The manufacturer of the device model associated with the device")] public bool ModelManufacturer { get; set; } - [Display(ShortName = "Model", Name = "Model", Description = "The model of the device model associated with the device")] + [Display(GroupName = "Model", Name = "Model", Description = "The model of the device model associated with the device")] public bool ModelModel { get; set; } - [Display(ShortName = "Model", Name = "Type", Description = "The type of device model associated with the device")] + [Display(GroupName = "Model", Name = "Type", Description = "The type of device model associated with the device")] public bool ModelType { get; set; } public bool HasDeviceModelOptions() { @@ -100,23 +100,23 @@ namespace Disco.Models.Services.Devices.DeviceFlag } // Batch - [Display(ShortName = "Batch", Name = "Identifier", Description = "The identifier of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Identifier", Description = "The identifier of the device batch associated with the device")] public bool BatchId { get; set; } - [Display(ShortName = "Batch", Name = "Name", Description = "The name of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Name", Description = "The name of the device batch associated with the device")] public bool BatchName { get; set; } - [Display(ShortName = "Batch", Name = "Purchase Date", Description = "The purchase date of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Purchase Date", Description = "The purchase date of the device batch associated with the device")] public bool BatchPurchaseDate { get; set; } - [Display(ShortName = "Batch", Name = "Supplier", Description = "The supplier of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Supplier", Description = "The supplier of the device batch associated with the device")] public bool BatchSupplier { get; set; } - [Display(ShortName = "Batch", Name = "Unit Cost", Description = "The unit cost of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Unit Cost", Description = "The unit cost of the device batch associated with the device")] public bool BatchUnitCost { get; set; } - [Display(ShortName = "Batch", Name = "Warranty Valid Until Date", Description = "The warranty valid until date of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Warranty Valid Until Date", Description = "The warranty valid until date of the device batch associated with the device")] public bool BatchWarrantyValidUntilDate { get; set; } - [Display(ShortName = "Batch", Name = "Insured Date", Description = "The insured date of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Insured Date", Description = "The insured date of the device batch associated with the device")] public bool BatchInsuredDate { get; set; } - [Display(ShortName = "Batch", Name = "Insurance Supplier", Description = "The insurance supplier of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Insurance Supplier", Description = "The insurance supplier of the device batch associated with the device")] public bool BatchInsuranceSupplier { get; set; } - [Display(ShortName = "Batch", Name = "Insured Until Date", Description = "The insured until date of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Insured Until Date", Description = "The insured until date of the device batch associated with the device")] public bool BatchInsuredUntilDate { get; set; } public bool HasDeviceBatchOptions() { @@ -132,11 +132,11 @@ namespace Disco.Models.Services.Devices.DeviceFlag } // Profile - [Display(ShortName = "Profile", Name = "Identifier", Description = "The identifier of the device profile associated with the device")] + [Display(GroupName = "Profile", Name = "Identifier", Description = "The identifier of the device profile associated with the device")] public bool ProfileId { get; set; } - [Display(ShortName = "Profile", Name = "Name", Description = "The name of the device profile associated with the device")] + [Display(GroupName = "Profile", Name = "Name", Description = "The name of the device profile associated with the device")] public bool ProfileName { get; set; } - [Display(ShortName = "Profile", Name = "Short Name", Description = "The short name of the device profile associated with the device")] + [Display(GroupName = "Profile", Name = "Short Name", Description = "The short name of the device profile associated with the device")] public bool ProfileShortName { get; set; } public bool HasDeviceProfileOptions() { @@ -146,20 +146,19 @@ namespace Disco.Models.Services.Devices.DeviceFlag } // Assigned User - [Display(ShortName = "Assigned User", Name = "Identifier", Description = "The identifier of the user assigned to the device flag")] + [Display(GroupName = "Assigned User", Name = "Identifier", Description = "The identifier of the user assigned to the device flag")] public bool AssignedUserId { get; set; } - [Display(ShortName = "Assigned User", Name = "Display Name", Description = "The display name of the user assigned to the device flag")] + [Display(GroupName = "Assigned User", Name = "Display Name", Description = "The display name of the user assigned to the device flag")] public bool AssignedUserDisplayName { get; set; } - [Display(ShortName = "Assigned User", Name = "Surname", Description = "The surname of the user assigned to the device flag")] + [Display(GroupName = "Assigned User", Name = "Surname", Description = "The surname of the user assigned to the device flag")] public bool AssignedUserSurname { get; set; } - [Display(ShortName = "Assigned User", Name = "Given Name", Description = "The given name of the user assigned to the device flag")] + [Display(GroupName = "Assigned User", Name = "Given Name", Description = "The given name of the user assigned to the device flag")] public bool AssignedUserGivenName { get; set; } - [Display(ShortName = "Assigned User", Name = "Phone Number", Description = "The phone number of the user assigned to the device flag")] + [Display(GroupName = "Assigned User", Name = "Phone Number", Description = "The phone number of the user assigned to the device flag")] public bool AssignedUserPhoneNumber { get; set; } - [Display(ShortName = "Assigned User", Name = "Email Address", Description = "The email address of the user assigned to the device flag")] + [Display(GroupName = "Assigned User", Name = "Email Address", Description = "The email address of the user assigned to the device flag")] public bool AssignedUserEmailAddress { get; set; } - [Display(ShortName = "Assigned User", Name = "Custom Details", Description = "The custom details provided by plugins for the user assigned to the device flag")] - public bool AssignedUserDetailCustom { get; set; } + public List UserDetailCustom { get; set; } = new List(); public bool HasAssignedUserOptions() { return AssignedUserId || diff --git a/Disco.Models/Services/Documents/DocumentExportOptions.cs b/Disco.Models/Services/Documents/DocumentExportOptions.cs index d3d6dac2..ee40251d 100644 --- a/Disco.Models/Services/Documents/DocumentExportOptions.cs +++ b/Disco.Models/Services/Documents/DocumentExportOptions.cs @@ -14,53 +14,52 @@ namespace Disco.Models.Services.Documents [Required] public List DocumentTemplateIds { get; set; } = new List(); - [Display(Name = "Latest Instance Only")] public bool LatestOnly { get; set; } // Document Template - [Display(ShortName = "Document Template", Name = "Identifier", Description = "The identifier of the document template")] + [Display(GroupName = "Document Template", Name = "Identifier", Description = "The identifier of the document template")] public bool Id { get; set; } - [Display(ShortName = "Document Template", Name = "Description", Description = "The description of the document template")] + [Display(GroupName = "Document Template", Name = "Description", Description = "The description of the document template")] public bool Description { get; set; } - [Display(ShortName = "Document Template", Name = "Scope", Description = "The scope of the document template")] + [Display(GroupName = "Document Template", Name = "Scope", Description = "The scope of the document template")] public bool Scope { get; set; } // Attachment - [Display(ShortName = "Attachment", Name = "Identifier", Description = "The identifier of the document instance")] + [Display(GroupName = "Attachment", Name = "Identifier", Description = "The identifier of the document instance")] public bool AttachmentId { get; set; } - [Display(ShortName = "Attachment", Name = "Created Date", Description = "The date the document instance was created")] + [Display(GroupName = "Attachment", Name = "Created Date", Description = "The date the document instance was created")] public bool AttachmentCreatedDate { get; set; } - [Display(ShortName = "Attachment", Name = "Created User", Description = "The user who created the document instance")] + [Display(GroupName = "Attachment", Name = "Created User", Description = "The user who created the document instance")] public bool AttachmentCreatedUser { get; set; } - [Display(ShortName = "Attachment", Name = "Filename", Description = "The filename of the document instance")] + [Display(GroupName = "Attachment", Name = "Filename", Description = "The filename of the document instance")] public bool AttachmentFilename { get; set; } - [Display(ShortName = "Attachment", Name = "Mime Type", Description = "The mime type of the document instance")] + [Display(GroupName = "Attachment", Name = "Mime Type", Description = "The mime type of the document instance")] public bool AttachmentMimeType { get; set; } - [Display(ShortName = "Attachment", Name = "Comments", Description = "The comments of the document instance")] + [Display(GroupName = "Attachment", Name = "Comments", Description = "The comments of the document instance")] public bool AttachmentComments { get; set; } // Device - [Display(ShortName = "Device", Name = "Serial Number", Description = "The serial number of the device associated with the document instance")] + [Display(GroupName = "Device", Name = "Serial Number", Description = "The serial number of the device associated with the document instance")] public bool DeviceSerialNumber { get; set; } - [Display(ShortName = "Device", Name = "Asset Number", Description = "The asset number of the device associated with the document instance")] + [Display(GroupName = "Device", Name = "Asset Number", Description = "The asset number of the device associated with the document instance")] public bool DeviceAssetNumber { get; set; } - [Display(ShortName = "Device", Name = "Location", Description = "The location of the device associated with the document instance")] + [Display(GroupName = "Device", Name = "Location", Description = "The location of the device associated with the document instance")] public bool DeviceLocation { get; set; } - [Display(ShortName = "Device", Name = "Computer Name", Description = "The computer name of the device associated with the document instance")] + [Display(GroupName = "Device", Name = "Computer Name", Description = "The computer name of the device associated with the document instance")] public bool DeviceComputerName { get; set; } - [Display(ShortName = "Device", Name = "Last Network Logon", Description = "The last recorded time that the device associated with the document instance accessed the network")] + [Display(GroupName = "Device", Name = "Last Network Logon", Description = "The last recorded time that the device associated with the document instance accessed the network")] public bool DeviceLastNetworkLogon { get; set; } - [Display(ShortName = "Device", Name = "Created Date", Description = "The date that the device associated with the document instance was created in Disco ICT")] + [Display(GroupName = "Device", Name = "Created Date", Description = "The date that the device associated with the document instance was created in Disco ICT")] public bool DeviceCreatedDate { get; set; } - [Display(ShortName = "Device", Name = "First Enrolled Date", Description = "The date that the device associated with the document instance was first enrolled in Disco ICT")] + [Display(GroupName = "Device", Name = "First Enrolled Date", Description = "The date that the device associated with the document instance was first enrolled in Disco ICT")] public bool DeviceFirstEnrolledDate { get; set; } - [Display(ShortName = "Device", Name = "Last Enrolled Date", Description = "The date that the device associated with the document instance was last enrolled in Disco ICT")] + [Display(GroupName = "Device", Name = "Last Enrolled Date", Description = "The date that the device associated with the document instance was last enrolled in Disco ICT")] public bool DeviceLastEnrolledDate { get; set; } - [Display(ShortName = "Device", Name = "Enrolment Trusted", Description = "Whether the device associated with the document instance is trusted to complete an unauthenticated enrolment")] + [Display(GroupName = "Device", Name = "Enrolment Trusted", Description = "Whether the device associated with the document instance is trusted to complete an unauthenticated enrolment")] public bool DeviceAllowUnauthenticatedEnrol { get; set; } - [Display(ShortName = "Device", Name = "Decommissioned Date", Description = "The date that the device associated with the document instance was decommissioned in Disco ICT")] + [Display(GroupName = "Device", Name = "Decommissioned Date", Description = "The date that the device associated with the document instance was decommissioned in Disco ICT")] public bool DeviceDecommissionedDate { get; set; } - [Display(ShortName = "Device", Name = "Decommissioned Reason", Description = "The reason that the device associated with the document instance was decommissioned")] + [Display(GroupName = "Device", Name = "Decommissioned Reason", Description = "The reason that the device associated with the document instance was decommissioned")] public bool DeviceDecommissionedReason { get; set; } public bool HasDeviceOptions() @@ -69,91 +68,91 @@ namespace Disco.Models.Services.Documents DeviceAllowUnauthenticatedEnrol || DeviceDecommissionedDate || DeviceDecommissionedReason; // Model - [Display(ShortName = "Model", Name = "Identifier", Description = "The identifier of the device model associated with the device")] + [Display(GroupName = "Model", Name = "Identifier", Description = "The identifier of the device model associated with the device")] public bool ModelId { get; set; } - [Display(ShortName = "Model", Name = "Description", Description = "The description of the device model associated with the device")] + [Display(GroupName = "Model", Name = "Description", Description = "The description of the device model associated with the device")] public bool ModelDescription { get; set; } - [Display(ShortName = "Model", Name = "Manufacturer", Description = "The manufacturer of the device model associated with the device")] + [Display(GroupName = "Model", Name = "Manufacturer", Description = "The manufacturer of the device model associated with the device")] public bool ModelManufacturer { get; set; } - [Display(ShortName = "Model", Name = "Model", Description = "The model of the device model associated with the device")] + [Display(GroupName = "Model", Name = "Model", Description = "The model of the device model associated with the device")] public bool ModelModel { get; set; } - [Display(ShortName = "Model", Name = "Type", Description = "The type of device model associated with the device")] + [Display(GroupName = "Model", Name = "Type", Description = "The type of device model associated with the device")] public bool ModelType { get; set; } public bool HasDeviceModelOptions() => ModelId || ModelDescription || ModelManufacturer || ModelModel || ModelType; // Batch - [Display(ShortName = "Batch", Name = "Identifier", Description = "The identifier of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Identifier", Description = "The identifier of the device batch associated with the device")] public bool BatchId { get; set; } - [Display(ShortName = "Batch", Name = "Name", Description = "The name of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Name", Description = "The name of the device batch associated with the device")] public bool BatchName { get; set; } - [Display(ShortName = "Batch", Name = "Purchase Date", Description = "The purchase date of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Purchase Date", Description = "The purchase date of the device batch associated with the device")] public bool BatchPurchaseDate { get; set; } - [Display(ShortName = "Batch", Name = "Supplier", Description = "The supplier of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Supplier", Description = "The supplier of the device batch associated with the device")] public bool BatchSupplier { get; set; } - [Display(ShortName = "Batch", Name = "Unit Cost", Description = "The unit cost of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Unit Cost", Description = "The unit cost of the device batch associated with the device")] public bool BatchUnitCost { get; set; } - [Display(ShortName = "Batch", Name = "Warranty Valid Until Date", Description = "The warranty valid until date of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Warranty Valid Until Date", Description = "The warranty valid until date of the device batch associated with the device")] public bool BatchWarrantyValidUntilDate { get; set; } - [Display(ShortName = "Batch", Name = "Insured Date", Description = "The insured date of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Insured Date", Description = "The insured date of the device batch associated with the device")] public bool BatchInsuredDate { get; set; } - [Display(ShortName = "Batch", Name = "Insurance Supplier", Description = "The insurance supplier of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Insurance Supplier", Description = "The insurance supplier of the device batch associated with the device")] public bool BatchInsuranceSupplier { get; set; } - [Display(ShortName = "Batch", Name = "Insured Until Date", Description = "The insured until date of the device batch associated with the device")] + [Display(GroupName = "Batch", Name = "Insured Until Date", Description = "The insured until date of the device batch associated with the device")] public bool BatchInsuredUntilDate { get; set; } public bool HasDeviceBatchOptions() => BatchId || BatchName || BatchPurchaseDate || BatchSupplier || BatchUnitCost || BatchWarrantyValidUntilDate || BatchInsuredDate || BatchInsuranceSupplier || BatchInsuredUntilDate; // Profile - [Display(ShortName = "Profile", Name = "Identifier", Description = "The identifier of the device profile associated with the device")] + [Display(GroupName = "Profile", Name = "Identifier", Description = "The identifier of the device profile associated with the device")] public bool ProfileId { get; set; } - [Display(ShortName = "Profile", Name = "Name", Description = "The name of the device profile associated with the device")] + [Display(GroupName = "Profile", Name = "Name", Description = "The name of the device profile associated with the device")] public bool ProfileName { get; set; } - [Display(ShortName = "Profile", Name = "Short Name", Description = "The short name of the device profile associated with the device")] + [Display(GroupName = "Profile", Name = "Short Name", Description = "The short name of the device profile associated with the device")] public bool ProfileShortName { get; set; } public bool HasDeviceProfileOptions() => ProfileId || ProfileName || ProfileShortName; // Job - [Display(ShortName = "Job", Name = "Identifier", Description = "The identifier of the job associated with the document instance")] + [Display(GroupName = "Job", Name = "Identifier", Description = "The identifier of the job associated with the document instance")] public bool JobId { get; set; } - [Display(ShortName = "Job", Name = "Status", Description = "The status of the job associated with the document instance")] + [Display(GroupName = "Job", Name = "Status", Description = "The status of the job associated with the document instance")] public bool JobStatus { get; set; } - [Display(ShortName = "Job", Name = "Type", Description = "The type of the job associated with the document instance")] + [Display(GroupName = "Job", Name = "Type", Description = "The type of the job associated with the document instance")] public bool JobType { get; set; } - [Display(ShortName = "Job", Name = "Sub Types", Description = "The sub types of the job associated with the document instance")] + [Display(GroupName = "Job", Name = "Sub Types", Description = "The sub types of the job associated with the document instance")] public bool JobSubTypes { get; set; } - [Display(ShortName = "Job", Name = "Opened Date", Description = "The date the job was opened associated with the document instance")] + [Display(GroupName = "Job", Name = "Opened Date", Description = "The date the job was opened associated with the document instance")] public bool JobOpenedDate { get; set; } - [Display(ShortName = "Job", Name = "Opened User", Description = "The user who opened the job associated with the document instance")] + [Display(GroupName = "Job", Name = "Opened User", Description = "The user who opened the job associated with the document instance")] public bool JobOpenedUser { get; set; } - [Display(ShortName = "Job", Name = "Expected Closed Date", Description = "The expected closed date of the job associated with the document instance")] + [Display(GroupName = "Job", Name = "Expected Closed Date", Description = "The expected closed date of the job associated with the document instance")] public bool JobExpectedClosedDate { get; set; } - [Display(ShortName = "Job", Name = "Closed Date", Description = "The date the job was closed associated with the document instance")] + [Display(GroupName = "Job", Name = "Closed Date", Description = "The date the job was closed associated with the document instance")] public bool JobClosedDate { get; set; } - [Display(ShortName = "Job", Name = "Closed User", Description = "The user who closed the job associated with the document instance")] + [Display(GroupName = "Job", Name = "Closed User", Description = "The user who closed the job associated with the document instance")] public bool JobClosedUser { get; set; } public bool HasJobOptions() => JobId || JobStatus || JobType || JobSubTypes || JobOpenedDate || JobOpenedUser || JobExpectedClosedDate || JobClosedDate || JobClosedUser; // User - [Display(ShortName = "User", Name = "Identifier", Description = "The identifier of the user associated with the document instance")] + [Display(GroupName = "User", Name = "Identifier", Description = "The identifier of the user associated with the document instance")] public bool UserId { get; set; } - [Display(ShortName = "User", Name = "Display Name", Description = "The display name of the user associated with the document instance")] + [Display(GroupName = "User", Name = "Display Name", Description = "The display name of the user associated with the document instance")] public bool UserDisplayName { get; set; } - [Display(ShortName = "User", Name = "Surname", Description = "The surname of the user associated with the document instance")] + [Display(GroupName = "User", Name = "Surname", Description = "The surname of the user associated with the document instance")] public bool UserSurname { get; set; } - [Display(ShortName = "User", Name = "Given Name", Description = "The given name of the user associated with the document instance")] + [Display(GroupName = "User", Name = "Given Name", Description = "The given name of the user associated with the document instance")] public bool UserGivenName { get; set; } - [Display(ShortName = "User", Name = "Phone Number", Description = "The phone number of the user associated with the document instance")] + [Display(GroupName = "User", Name = "Phone Number", Description = "The phone number of the user associated with the document instance")] public bool UserPhoneNumber { get; set; } - [Display(ShortName = "User", Name = "Email Address", Description = "The email address of the user associated with the document instance")] + [Display(GroupName = "User", Name = "Email Address", Description = "The email address of the user associated with the document instance")] public bool UserEmailAddress { get; set; } public List UserDetailCustom { get; set; } = new List(); public bool HasUserOptions() - => UserDisplayName || UserSurname || UserGivenName || UserPhoneNumber || UserEmailAddress || UserDetailCustom.Any(); + => UserDisplayName || UserSurname || UserGivenName || UserPhoneNumber || UserEmailAddress || (UserDetailCustom?.Any() ?? false); public static DocumentExportOptions DefaultOptions() { diff --git a/Disco.Models/Services/Exporting/ExportOptionField.cs b/Disco.Models/Services/Exporting/ExportOptionField.cs index ceab4e57..b580ad59 100644 --- a/Disco.Models/Services/Exporting/ExportOptionField.cs +++ b/Disco.Models/Services/Exporting/ExportOptionField.cs @@ -6,8 +6,9 @@ public string Name { get; set; } public string DisplayName { get; set; } public string Description { get; set; } - public bool Checked { get; set; } - public string Key { get; set; } - public string Value { get; set; } + public bool IsDefault { get; set; } + public bool IsChecked { get; set; } + public string CustomKey { get; set; } + public string CustomValue { get; set; } } } diff --git a/Disco.Models/Services/Users/UserFlags/UserFlagExportOptions.cs b/Disco.Models/Services/Users/UserFlags/UserFlagExportOptions.cs index 72794f20..e42676d0 100644 --- a/Disco.Models/Services/Users/UserFlags/UserFlagExportOptions.cs +++ b/Disco.Models/Services/Users/UserFlags/UserFlagExportOptions.cs @@ -2,6 +2,7 @@ using Disco.Models.Services.Exporting; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using System.Linq; namespace Disco.Models.Services.Users.UserFlags { @@ -17,47 +18,46 @@ namespace Disco.Models.Services.Users.UserFlags public bool CurrentOnly { get; set; } // User Flag - [Display(ShortName = "User Flag", Name = "Identifier", Description = "The identifier of the user flag")] + [Display(GroupName = "User Flag", Name = "Identifier", Description = "The identifier of the user flag")] public bool Id { get; set; } - [Display(ShortName = "User Flag", Name = "Name", Description = "The name of the user flag")] + [Display(GroupName = "User Flag", Name = "Name", Description = "The name of the user flag")] public bool Name { get; set; } - [Display(ShortName = "User Flag", Name = "Description", Description = "The description of the user flag")] + [Display(GroupName = "User Flag", Name = "Description", Description = "The description of the user flag")] public bool Description { get; set; } - [Display(ShortName = "User Flag", Name = "Icon", Description = "The icon assigned to the user flag")] + [Display(GroupName = "User Flag", Name = "Icon", Description = "The icon assigned to the user flag")] public bool Icon { get; set; } - [Display(ShortName = "User Flag", Name = "Icon Colour", Description = "The icon colour assigned to the user flag")] + [Display(GroupName = "User Flag", Name = "Icon Colour", Description = "The icon colour assigned to the user flag")] public bool IconColour { get; set; } - [Display(ShortName = "User Flag", Name = "Assignment Identifier", Description = "The identifier of the user flag assignment")] + [Display(GroupName = "User Flag", Name = "Assignment Identifier", Description = "The identifier of the user flag assignment")] public bool AssignmentId { get; set; } - [Display(ShortName = "User Flag", Name = "Added Date", Description = "The date the user flag was assigned to the user")] + [Display(GroupName = "User Flag", Name = "Added Date", Description = "The date the user flag was assigned to the user")] public bool AddedDate { get; set; } - [Display(ShortName = "User Flag", Name = "Added User Identifier", Description = "The identifier of the user who assigned the user flag")] + [Display(GroupName = "User Flag", Name = "Added User Identifier", Description = "The identifier of the user who assigned the user flag")] public bool AddedUserId { get; set; } - [Display(ShortName = "User Flag", Name = "Removed Date", Description = "The date the user flag was unassigned from the user")] + [Display(GroupName = "User Flag", Name = "Removed Date", Description = "The date the user flag was unassigned from the user")] public bool RemovedDate { get; set; } - [Display(ShortName = "User Flag", Name = "Removed User Identifier", Description = "The identifier of the user who unassigned the user flag")] + [Display(GroupName = "User Flag", Name = "Removed User Identifier", Description = "The identifier of the user who unassigned the user flag")] public bool RemovedUserId { get; set; } - [Display(ShortName = "User Flag", Name = "Comments", Description = "The comments associated with the user flag assignment")] + [Display(GroupName = "User Flag", Name = "Comments", Description = "The comments associated with the user flag assignment")] public bool Comments { get; set; } // User - [Display(ShortName = "User", Name = "Identifier", Description = "The identifier of the user assigned to the user flag")] + [Display(GroupName = "User", Name = "Identifier", Description = "The identifier of the user assigned to the user flag")] public bool UserId { get; set; } - [Display(ShortName = "User", Name = "Display Name", Description = "The display name of the user assigned to the user flag")] + [Display(GroupName = "User", Name = "Display Name", Description = "The display name of the user assigned to the user flag")] public bool UserDisplayName { get; set; } - [Display(ShortName = "User", Name = "Surname", Description = "The surname of the user assigned to the user flag")] + [Display(GroupName = "User", Name = "Surname", Description = "The surname of the user assigned to the user flag")] public bool UserSurname { get; set; } - [Display(ShortName = "User", Name = "Given Name", Description = "The given name of the user assigned to the user flag")] + [Display(GroupName = "User", Name = "Given Name", Description = "The given name of the user assigned to the user flag")] public bool UserGivenName { get; set; } - [Display(ShortName = "User", Name = "Phone Number", Description = "The phone number of the user assigned to the user flag")] + [Display(GroupName = "User", Name = "Phone Number", Description = "The phone number of the user assigned to the user flag")] public bool UserPhoneNumber { get; set; } - [Display(ShortName = "User", Name = "Email Address", Description = "The email address of the user assigned to the user flag")] + [Display(GroupName = "User", Name = "Email Address", Description = "The email address of the user assigned to the user flag")] public bool UserEmailAddress { get; set; } - [Display(ShortName = "User", Name = "Custom Details", Description = "The custom details provided by plugins for the user assigned to the user flag")] - public bool UserDetailCustom { get; set; } + public List UserDetailCustom { get; set; } = new List(); public bool HasAssignedUserDetails() - => UserDisplayName || UserSurname || UserGivenName || UserPhoneNumber || UserEmailAddress || UserDetailCustom; + => UserDisplayName || UserSurname || UserGivenName || UserPhoneNumber || UserEmailAddress || (UserDetailCustom?.Any() ?? false); public static UserFlagExportOptions DefaultOptions() { diff --git a/Disco.Models/UI/Config/DeviceFlag/ConfigDeviceFlagExportModel.cs b/Disco.Models/UI/Config/DeviceFlag/ConfigDeviceFlagExportModel.cs index 9ff236c9..62ee92cf 100644 --- a/Disco.Models/UI/Config/DeviceFlag/ConfigDeviceFlagExportModel.cs +++ b/Disco.Models/UI/Config/DeviceFlag/ConfigDeviceFlagExportModel.cs @@ -1,6 +1,7 @@ using Disco.Models.Services.Devices.DeviceFlag; using Disco.Models.Services.Exporting; using Disco.Models.UI; +using Disco.Models.UI.Shared; using System; using System.Collections.Generic; @@ -14,5 +15,7 @@ namespace Disco.Models.Areas.Config.UI.DeviceFlag ExportResult ExportResult { get; set; } List DeviceFlags { get; set; } + + SharedExportFieldsModel Fields { get; set; } } } diff --git a/Disco.Models/UI/Config/UserFlag/ConfigUserFlagExportModel.cs b/Disco.Models/UI/Config/UserFlag/ConfigUserFlagExportModel.cs index 026f9ddb..95d2b1b1 100644 --- a/Disco.Models/UI/Config/UserFlag/ConfigUserFlagExportModel.cs +++ b/Disco.Models/UI/Config/UserFlag/ConfigUserFlagExportModel.cs @@ -1,6 +1,8 @@ -using Disco.Models.Services.Exporting; +using Disco.Models.Services.Devices; +using Disco.Models.Services.Exporting; using Disco.Models.Services.Users.UserFlags; using Disco.Models.UI; +using Disco.Models.UI.Shared; using System; using System.Collections.Generic; @@ -14,5 +16,7 @@ namespace Disco.Models.Areas.Config.UI.UserFlag ExportResult ExportResult { get; set; } List UserFlags { get; set; } + + SharedExportFieldsModel Fields { get; set; } } } diff --git a/Disco.Models/UI/Device/DeviceExportModel.cs b/Disco.Models/UI/Device/DeviceExportModel.cs index 69d7b636..267bc80a 100644 --- a/Disco.Models/UI/Device/DeviceExportModel.cs +++ b/Disco.Models/UI/Device/DeviceExportModel.cs @@ -1,5 +1,6 @@ using Disco.Models.Services.Devices; using Disco.Models.Services.Exporting; +using Disco.Models.UI.Shared; using System; using System.Collections.Generic; @@ -15,5 +16,7 @@ namespace Disco.Models.UI.Device IEnumerable> DeviceBatches { get; set; } IEnumerable> DeviceModels { get; set; } IEnumerable> DeviceProfiles { get; set; } + + SharedExportFieldsModel Fields { get; set; } } } \ No newline at end of file diff --git a/Disco.Models/UI/Shared/SharedExportFieldsModel.cs b/Disco.Models/UI/Shared/SharedExportFieldsModel.cs index 2c5ba465..7f1440ac 100644 --- a/Disco.Models/UI/Shared/SharedExportFieldsModel.cs +++ b/Disco.Models/UI/Shared/SharedExportFieldsModel.cs @@ -1,5 +1,7 @@ using Disco.Models.Services.Exporting; +using System; using System.Collections.Generic; +using System.Linq.Expressions; namespace Disco.Models.UI.Shared { @@ -8,5 +10,6 @@ namespace Disco.Models.UI.Shared { T Options { get; set; } List FieldGroups { get; set; } + void AddCustomUserDetails(Expression>> modelAccessor, int groupIndex = -1); } } diff --git a/Disco.Services/Devices/DeviceExport.cs b/Disco.Services/Devices/DeviceExport.cs index 86f55729..6b7f0126 100644 --- a/Disco.Services/Devices/DeviceExport.cs +++ b/Disco.Services/Devices/DeviceExport.cs @@ -171,21 +171,37 @@ namespace Disco.Services.Devices if (Options.DetailBatteries) r.DeviceDetailBatteries = r.DeviceDetails.Batteries(); - if (Options.AssignedUserDetailCustom && r.AssignedUser != null) - { - var detailsService = new DetailsProviderService(database); - r.AssignedUserCustomDetails = detailsService.GetDetails(r.AssignedUser); - } }); + if (Options.UserDetailCustom?.Any() ?? false) + AddUserCustomDetails(database, records, taskStatus); + return records; } + private static void AddUserCustomDetails(DiscoDataContext database, List records, IScheduledTaskStatus status) + { + if (!records.Any(r => r.AssignedUser != null)) + return; + status.UpdateStatus(50, "Extracting custom user detail records"); + var detailsService = new DetailsProviderService(database); + var cache = new Dictionary>(StringComparer.Ordinal); + foreach (var record in records) + { + var userId = record.AssignedUser?.UserId; + if (string.IsNullOrWhiteSpace(userId)) + continue; + if (!cache.TryGetValue(userId, out var details)) + details = detailsService.GetDetails(record.AssignedUser); + record.AssignedUserCustomDetails = details; + } + } + public ExportMetadata BuildMetadata(DiscoDataContext database, List records, IScheduledTaskStatus taskStatus) { var metadata = new ExportMetadata(Options); - metadata.IgnoreShortNames.Add("Device"); - metadata.IgnoreShortNames.Add("Details"); + metadata.IgnoreGroupNames.Add("Device"); + metadata.IgnoreGroupNames.Add("Details"); // Device metadata.Add(o => o.DeviceSerialNumber, r => r.Device.SerialNumber); @@ -233,13 +249,10 @@ namespace Disco.Services.Devices metadata.Add(o => o.AssignedUserEmailAddress, r => r.AssignedUser?.EmailAddress); // User Custom Details - if (Options.AssignedUserDetailCustom) + if (Options.UserDetailCustom.Any()) { - var keys = records.Where(r => r.AssignedUserCustomDetails != null).SelectMany(r => r.AssignedUserCustomDetails.Keys).Distinct(StringComparer.OrdinalIgnoreCase).ToList(); - foreach (var key in keys.OrderBy(k => k, StringComparer.OrdinalIgnoreCase)) - { - metadata.Add(key, r => r.AssignedUserCustomDetails != null && r.AssignedUserCustomDetails.TryGetValue(key, out var value) ? value : null); - } + foreach (var key in Options.UserDetailCustom.OrderBy(k => k, StringComparer.OrdinalIgnoreCase)) + metadata.Add($"Assigned User Detail {key.TrimEnd('*', '&')}", r => r.AssignedUserCustomDetails != null && r.AssignedUserCustomDetails.TryGetValue(key, out var value) ? value : null); } // Jobs diff --git a/Disco.Services/Devices/DeviceFlags/DeviceFlagExport.cs b/Disco.Services/Devices/DeviceFlags/DeviceFlagExport.cs index b6cee3bf..be3f113a 100644 --- a/Disco.Services/Devices/DeviceFlags/DeviceFlagExport.cs +++ b/Disco.Services/Devices/DeviceFlags/DeviceFlagExport.cs @@ -54,7 +54,7 @@ namespace Disco.Services.Devices.DeviceFlags query = query.Include(a => a.Device.DeviceProfile); if (Options.HasAssignedUserOptions()) query = query.Include(a => a.Device.AssignedUser); - if (Options.AssignedUserDetailCustom) + if (Options.UserDetailCustom?.Any() ?? false) query = query.Include(a => a.Device.AssignedUser.UserDetails); query = query.Where(a => Options.DeviceFlagIds.Contains(a.DeviceFlagId)); @@ -86,7 +86,7 @@ namespace Disco.Services.Devices.DeviceFlags Assignment = a }).ToList(); - if (Options.AssignedUserDetailCustom) + if (Options.UserDetailCustom?.Any() ?? false) { status.UpdateStatus(50, "Extracting custom user detail records"); @@ -111,7 +111,7 @@ namespace Disco.Services.Devices.DeviceFlags public ExportMetadata BuildMetadata(DiscoDataContext database, List records, IScheduledTaskStatus status) { var metadata = new ExportMetadata(Options); - metadata.IgnoreShortNames.Add("Device Flag"); + metadata.IgnoreGroupNames.Add("Device Flag"); // Device Flag metadata.Add(o => o.Id, r => r.Assignment.DeviceFlagId); @@ -171,13 +171,10 @@ namespace Disco.Services.Devices.DeviceFlags metadata.Add(o => o.AssignedUserEmailAddress, r => r.Assignment.Device?.AssignedUser?.EmailAddress); // User Custom Details - if (Options.AssignedUserDetailCustom) + if (Options.UserDetailCustom?.Any() ?? false) { - var keys = records.Where(r => r.AssignedUserCustomDetails != null).SelectMany(r => r.AssignedUserCustomDetails.Keys).Distinct(StringComparer.OrdinalIgnoreCase).ToList(); - foreach (var key in keys.OrderBy(k => k, StringComparer.OrdinalIgnoreCase)) - { - metadata.Add(key, r => r.AssignedUserCustomDetails != null && r.AssignedUserCustomDetails.TryGetValue(key, out var value) ? value : null); - } + foreach (var key in Options.UserDetailCustom.OrderBy(k => k, StringComparer.OrdinalIgnoreCase)) + metadata.Add($"Assigned User Detail {key.TrimEnd('*', '&')}", r => r.AssignedUserCustomDetails != null && r.AssignedUserCustomDetails.TryGetValue(key, out var value) ? value : null); } return metadata; diff --git a/Disco.Services/Documents/DocumentExport.cs b/Disco.Services/Documents/DocumentExport.cs index 75347431..8c582fbe 100644 --- a/Disco.Services/Documents/DocumentExport.cs +++ b/Disco.Services/Documents/DocumentExport.cs @@ -4,14 +4,14 @@ using Disco.Models.Repository; using Disco.Models.Services.Documents; using Disco.Models.Services.Exporting; using Disco.Services.Exporting; +using Disco.Services.Plugins.Features.DetailsProvider; using Disco.Services.Tasks; +using Disco.Services.Users; using Newtonsoft.Json; -using System.Data.Entity; using System; using System.Collections.Generic; +using System.Data.Entity; using System.Linq; -using Disco.Services.Users; -using Disco.Services.Plugins.Features.DetailsProvider; namespace Disco.Services.Documents { @@ -110,12 +110,10 @@ namespace Disco.Services.Documents metadata.Add(o => o.UserEmailAddress, r => r.User?.EmailAddress); // User Custom Details - if (Options.UserDetailCustom.Any()) + if (Options.UserDetailCustom?.Any() ?? false) { foreach (var key in Options.UserDetailCustom.OrderBy(k => k, StringComparer.OrdinalIgnoreCase)) - { - metadata.Add(key, r => r.UserCustomDetails != null && r.UserCustomDetails.TryGetValue(key, out var value) ? value : null); - } + metadata.Add($"User Detail {key.TrimEnd('*', '&')}", r => r.UserCustomDetails != null && r.UserCustomDetails.TryGetValue(key, out var value) ? value : null); } return metadata; diff --git a/Disco.Services/Exporting/Exporter.cs b/Disco.Services/Exporting/Exporter.cs index 541e49a0..03175877 100644 --- a/Disco.Services/Exporting/Exporter.cs +++ b/Disco.Services/Exporting/Exporter.cs @@ -139,10 +139,10 @@ namespace Disco.Services.Exporting var member = ((MemberExpression)optionAccessor.Body).Member; var attribute = (DisplayAttribute)member.GetCustomAttributes(typeof(DisplayAttribute), false).Single(); - if (metadata.IgnoreShortNames.Contains(attribute.ShortName)) + if (metadata.IgnoreGroupNames.Contains(attribute.GroupName)) columnName = attribute.Name; else - columnName = $"{attribute.ShortName} {attribute.Name}"; + columnName = $"{attribute.GroupName} {attribute.Name}"; } metadata.Add(columnName, valueAccessor, csvValueEncoder); @@ -190,6 +190,8 @@ namespace Disco.Services.Exporting { typeof(ushort?), ToStringEncoder }, { typeof(bool), ToStringEncoder }, { typeof(bool?), ToStringEncoder }, + { typeof(Guid), ToStringEncoder }, + { typeof(Guid?), ToStringEncoder }, { typeof(DateTime), DateTimeEncoder }, { typeof(DateTime?), NullableDateTimeEncoder }, }; diff --git a/Disco.Services/Jobs/JobExport.cs b/Disco.Services/Jobs/JobExport.cs index 1f32b620..b39061b5 100644 --- a/Disco.Services/Jobs/JobExport.cs +++ b/Disco.Services/Jobs/JobExport.cs @@ -219,8 +219,8 @@ namespace Disco.Services.Jobs public ExportMetadata BuildMetadata(DiscoDataContext database, List records, IScheduledTaskStatus status) { var metadata = new ExportMetadata(Options); - metadata.IgnoreShortNames.Add("Job"); - metadata.IgnoreShortNames.Add("Job Details"); + metadata.IgnoreGroupNames.Add("Job"); + metadata.IgnoreGroupNames.Add("Job Details"); // Job metadata.Add(o => o.JobId, r => r.Job.Id); diff --git a/Disco.Services/Plugins/Features/ExportProvider/ExportProviderFeature.cs b/Disco.Services/Plugins/Features/ExportProvider/ExportProviderFeature.cs index 4d6ae8e3..cd7c32b0 100644 --- a/Disco.Services/Plugins/Features/ExportProvider/ExportProviderFeature.cs +++ b/Disco.Services/Plugins/Features/ExportProvider/ExportProviderFeature.cs @@ -7,12 +7,12 @@ namespace Disco.Services.Plugins.Features.ExportProvider [PluginFeatureCategory(DisplayName = "Exporter")] public class ExportProviderFeature : PluginFeature { - public void RegisterExportType() - where T : IExport, new() - where E : IExportOptions, new() + public void RegisterExportType() + where T : IExport, new() + where O : IExportOptions, new() where R : IExportRecord { - SavedExports.RegisterExportType(); + SavedExports.RegisterExportType(); } } } diff --git a/Disco.Services/Users/UserFlags/UserFlagExport.cs b/Disco.Services/Users/UserFlags/UserFlagExport.cs index a2279f94..68260bb6 100644 --- a/Disco.Services/Users/UserFlags/UserFlagExport.cs +++ b/Disco.Services/Users/UserFlags/UserFlagExport.cs @@ -74,7 +74,7 @@ namespace Disco.Services.Users.UserFlags Assignment = a }).ToList(); - if (Options.UserDetailCustom) + if (Options.UserDetailCustom?.Any() ?? false) { status.UpdateStatus(50, "Extracting custom user detail records"); @@ -96,7 +96,7 @@ namespace Disco.Services.Users.UserFlags status.UpdateStatus(80, "Building metadata"); var metadata = new ExportMetadata(Options); - metadata.IgnoreShortNames.Add("User Flag"); + metadata.IgnoreGroupNames.Add("User Flag"); // User Flag metadata.Add(o => o.Id, r => r.Assignment.UserFlagId); @@ -120,13 +120,10 @@ namespace Disco.Services.Users.UserFlags metadata.Add(o => o.UserEmailAddress, r => r.Assignment.User?.EmailAddress); // User Custom Details - if (Options.UserDetailCustom) + if (Options.UserDetailCustom?.Any() ?? false) { - var keys = records.Where(r => r.UserCustomDetails != null).SelectMany(r => r.UserCustomDetails.Keys).Distinct(StringComparer.OrdinalIgnoreCase).ToList(); - foreach (var key in keys.OrderBy(k => k, StringComparer.OrdinalIgnoreCase)) - { - metadata.Add(key, r => r.UserCustomDetails != null && r.UserCustomDetails.TryGetValue(key, out var value) ? value : null); - } + foreach (var key in Options.UserDetailCustom.OrderBy(k => k, StringComparer.OrdinalIgnoreCase)) + metadata.Add($"User Detail {key.TrimEnd('*', '&')}", r => r.UserCustomDetails != null && r.UserCustomDetails.TryGetValue(key, out var value) ? value : null); } return metadata; diff --git a/Disco.Web/Areas/API/Controllers/DeviceController.cs b/Disco.Web/Areas/API/Controllers/DeviceController.cs index 2faac843..33226759 100644 --- a/Disco.Web/Areas/API/Controllers/DeviceController.cs +++ b/Disco.Web/Areas/API/Controllers/DeviceController.cs @@ -687,21 +687,21 @@ namespace Disco.Web.Areas.API.Controllers [DiscoAuthorize(Claims.Device.Actions.Export)] [HttpPost, ValidateAntiForgeryToken] - public virtual ActionResult Export(ExportModel Model) + public virtual ActionResult Export(ExportModel model) { - if (Model == null || Model.Options == null) + if (model == null || model.Options == null) throw new ArgumentNullException("Model"); // Write Options to Configuration - Database.DiscoConfiguration.Devices.LastExportOptions = Model.Options; + Database.DiscoConfiguration.Devices.LastExportOptions = model.Options; Database.SaveChanges(); // Start Export - var exportContext = new DeviceExport(Model.Options); + var exportContext = new DeviceExport(model.Options); var taskContext = ExportTask.ScheduleNowCacheResult(exportContext, id => Url.Action(MVC.Device.Export(id, null, null))); // Try waiting for completion - if (taskContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(1))) + if (taskContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(2))) return RedirectToAction(MVC.Device.Export(taskContext.Id, null, null)); else return RedirectToAction(MVC.Config.Logging.TaskStatus(taskContext.TaskStatus.SessionId)); @@ -729,9 +729,11 @@ namespace Disco.Web.Areas.API.Controllers [DiscoAuthorizeAll(Claims.Config.ManageSavedExports, Claims.Device.Actions.Export)] [HttpPost, ValidateAntiForgeryToken] - public virtual ActionResult SaveExport(ExportModel Model) + public virtual ActionResult SaveExport(ExportModel model) { - var export = new DeviceExport(Model.Options); + Database.DiscoConfiguration.Devices.LastExportOptions = model.Options; + + var export = new DeviceExport(model.Options); var savedExport = SavedExports.SaveExport(export, Database, CurrentUser); return RedirectToAction(MVC.Config.Export.Create(savedExport.Id)); diff --git a/Disco.Web/Areas/API/Controllers/DeviceFlagController.cs b/Disco.Web/Areas/API/Controllers/DeviceFlagController.cs index 9d0327cd..a5cdc08e 100644 --- a/Disco.Web/Areas/API/Controllers/DeviceFlagController.cs +++ b/Disco.Web/Areas/API/Controllers/DeviceFlagController.cs @@ -404,20 +404,20 @@ namespace Disco.Web.Areas.API.Controllers [DiscoAuthorize(Claims.Config.DeviceFlag.Export)] [HttpPost, ValidateAntiForgeryToken] - public virtual ActionResult Export(ExportModel Model) + public virtual ActionResult Export(ExportModel model) { - if (Model == null || Model.Options == null) - throw new ArgumentNullException(nameof(Model)); + if (model == null || model.Options == null) + throw new ArgumentNullException(nameof(model)); - Database.DiscoConfiguration.DeviceFlags.LastExportOptions = Model.Options; + Database.DiscoConfiguration.DeviceFlags.LastExportOptions = model.Options; Database.SaveChanges(); // Start Export - var exportContext = new DeviceFlagExport(Model.Options); + var exportContext = new DeviceFlagExport(model.Options); var taskContext = ExportTask.ScheduleNowCacheResult(exportContext, id => Url.Action(MVC.Config.DeviceFlag.Export(id, null, null))); // Try waiting for completion - if (taskContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(1))) + if (taskContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(2))) return RedirectToAction(MVC.Config.DeviceFlag.Export(taskContext.Id, null, null)); else return RedirectToAction(MVC.Config.Logging.TaskStatus(taskContext.TaskStatus.SessionId)); @@ -445,11 +445,11 @@ namespace Disco.Web.Areas.API.Controllers [DiscoAuthorizeAll(Claims.Config.ManageSavedExports, Claims.Config.DeviceFlag.Export)] [HttpPost, ValidateAntiForgeryToken] - public virtual ActionResult SaveExport(ExportModel Model) + public virtual ActionResult SaveExport(ExportModel model) { - Database.DiscoConfiguration.DeviceFlags.LastExportOptions = Model.Options; + Database.DiscoConfiguration.DeviceFlags.LastExportOptions = model.Options; - var export = new DeviceFlagExport(Model.Options); + var export = new DeviceFlagExport(model.Options); var savedExport = SavedExports.SaveExport(export, Database, CurrentUser); return RedirectToAction(MVC.Config.Export.Create(savedExport.Id)); diff --git a/Disco.Web/Areas/API/Controllers/DocumentTemplateController.cs b/Disco.Web/Areas/API/Controllers/DocumentTemplateController.cs index 643dcc1a..9e142966 100644 --- a/Disco.Web/Areas/API/Controllers/DocumentTemplateController.cs +++ b/Disco.Web/Areas/API/Controllers/DocumentTemplateController.cs @@ -11,7 +11,6 @@ using Disco.Services.Plugins; using Disco.Services.Plugins.Features.DocumentHandlerProvider; using Disco.Services.Tasks; using Disco.Services.Users; -using Disco.Services.Users.UserFlags; using Disco.Services.Web; using Disco.Web.Areas.API.Models.DocumentTemplate; using Disco.Web.Areas.Config.Models.DocumentTemplate; @@ -1453,25 +1452,25 @@ namespace Disco.Web.Areas.API.Controllers [DiscoAuthorize(Claims.Config.DocumentTemplate.Export)] [HttpPost, ValidateAntiForgeryToken] - public virtual ActionResult Export(ExportModel Model) + public virtual ActionResult Export(ExportModel model) { - if (Model == null || Model.Options == null) - throw new ArgumentNullException(nameof(Model)); + if (model == null || model.Options == null) + throw new ArgumentNullException(nameof(model)); var templateId = default(string); - if (Model.Options.DocumentTemplateIds.Count == 1) - templateId = Model.Options.DocumentTemplateIds.First(); + if (model.Options.DocumentTemplateIds.Count == 1) + templateId = model.Options.DocumentTemplateIds.First(); - Database.DiscoConfiguration.Documents.LastExportOptions = Model.Options; + Database.DiscoConfiguration.Documents.LastExportOptions = model.Options; Database.SaveChanges(); // Start Export - var exportContext = new DocumentExport(Model.Options); - var taskContext = ExportTask.ScheduleNowCacheResult(exportContext, id => Url.Action(MVC.Config.DocumentTemplate.Export(templateId, id))); + var exportContext = new DocumentExport(model.Options); + var taskContext = ExportTask.ScheduleNowCacheResult(exportContext, id => Url.Action(MVC.Config.DocumentTemplate.Export(null, id))); // Try waiting for completion - if (taskContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(1))) - return RedirectToAction(MVC.Config.DocumentTemplate.Export(templateId, taskContext.Id)); + if (taskContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(2))) + return RedirectToAction(MVC.Config.DocumentTemplate.Export(null, taskContext.Id)); else return RedirectToAction(MVC.Config.Logging.TaskStatus(taskContext.TaskStatus.SessionId)); } @@ -1495,11 +1494,11 @@ namespace Disco.Web.Areas.API.Controllers [DiscoAuthorizeAll(Claims.Config.ManageSavedExports, Claims.Config.DocumentTemplate.Export)] [HttpPost, ValidateAntiForgeryToken] - public virtual ActionResult SaveExport(ExportModel Model) + public virtual ActionResult SaveExport(ExportModel model) { - Database.DiscoConfiguration.Documents.LastExportOptions = Model.Options; + Database.DiscoConfiguration.Documents.LastExportOptions = model.Options; - var export = new DocumentExport(Model.Options); + var export = new DocumentExport(model.Options); var savedExport = SavedExports.SaveExport(export, Database, CurrentUser); return RedirectToAction(MVC.Config.Export.Create(savedExport.Id)); diff --git a/Disco.Web/Areas/API/Controllers/JobController.cs b/Disco.Web/Areas/API/Controllers/JobController.cs index 91643047..8cb398d2 100644 --- a/Disco.Web/Areas/API/Controllers/JobController.cs +++ b/Disco.Web/Areas/API/Controllers/JobController.cs @@ -2182,7 +2182,7 @@ namespace Disco.Web.Areas.API.Controllers var taskContext = ExportTask.ScheduleNowCacheResult(exportContext, id => Url.Action(MVC.Job.Export(id))); // Try waiting for completion - if (taskContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(1))) + if (taskContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(2))) return RedirectToAction(MVC.Job.Export(taskContext.Id)); else return RedirectToAction(MVC.Config.Logging.TaskStatus(taskContext.TaskStatus.SessionId)); @@ -2210,9 +2210,13 @@ namespace Disco.Web.Areas.API.Controllers [DiscoAuthorizeAll(Claims.Config.ManageSavedExports, Claims.Job.Actions.Export)] [HttpPost, ValidateAntiForgeryToken] - public virtual ActionResult SaveExport(ExportModel Model) + public virtual ActionResult SaveExport(ExportModel model) { - var export = new JobExport(Model.Options); + // Write Options to Configuration + Database.DiscoConfiguration.JobPreferences.LastExportOptions = model.Options; + Database.SaveChanges(); + + var export = new JobExport(model.Options); var savedExport = SavedExports.SaveExport(export, Database, CurrentUser); return RedirectToAction(MVC.Config.Export.Create(savedExport.Id)); diff --git a/Disco.Web/Areas/API/Controllers/UserFlagController.cs b/Disco.Web/Areas/API/Controllers/UserFlagController.cs index 507afcd5..00f0d019 100644 --- a/Disco.Web/Areas/API/Controllers/UserFlagController.cs +++ b/Disco.Web/Areas/API/Controllers/UserFlagController.cs @@ -409,20 +409,20 @@ namespace Disco.Web.Areas.API.Controllers [DiscoAuthorize(Claims.Config.UserFlag.Export)] [HttpPost, ValidateAntiForgeryToken] - public virtual ActionResult Export(ExportModel Model) + public virtual ActionResult Export(ExportModel model) { - if (Model == null || Model.Options == null) - throw new ArgumentNullException(nameof(Model)); + if (model == null || model.Options == null) + throw new ArgumentNullException(nameof(model)); - Database.DiscoConfiguration.UserFlags.LastExportOptions = Model.Options; + Database.DiscoConfiguration.UserFlags.LastExportOptions = model.Options; Database.SaveChanges(); // Start Export - var exportContext = new UserFlagExport(Model.Options); + var exportContext = new UserFlagExport(model.Options); var taskContext = ExportTask.ScheduleNowCacheResult(exportContext, id => Url.Action(MVC.Config.UserFlag.Export(id, null, null))); // Try waiting for completion - if (taskContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(1))) + if (taskContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(2))) return RedirectToAction(MVC.Config.UserFlag.Export(taskContext.Id, null, null)); else return RedirectToAction(MVC.Config.Logging.TaskStatus(taskContext.TaskStatus.SessionId)); @@ -447,11 +447,11 @@ namespace Disco.Web.Areas.API.Controllers [DiscoAuthorizeAll(Claims.Config.ManageSavedExports, Claims.Config.UserFlag.Export)] [HttpPost, ValidateAntiForgeryToken] - public virtual ActionResult SaveExport(ExportModel Model) + public virtual ActionResult SaveExport(ExportModel model) { - Database.DiscoConfiguration.UserFlags.LastExportOptions = Model.Options; + Database.DiscoConfiguration.UserFlags.LastExportOptions = model.Options; - var export = new UserFlagExport(Model.Options); + var export = new UserFlagExport(model.Options); var savedExport = SavedExports.SaveExport(export, Database, CurrentUser); return RedirectToAction(MVC.Config.Export.Create(savedExport.Id)); diff --git a/Disco.Web/Areas/Config/Controllers/DeviceFlagController.cs b/Disco.Web/Areas/Config/Controllers/DeviceFlagController.cs index c0d309f4..1595b280 100644 --- a/Disco.Web/Areas/Config/Controllers/DeviceFlagController.cs +++ b/Disco.Web/Areas/Config/Controllers/DeviceFlagController.cs @@ -1,6 +1,7 @@ using Disco.Models.Areas.Config.UI.DeviceFlag; using Disco.Models.Repository; using Disco.Models.Services.Devices.DeviceFlag; +using Disco.Models.Services.Users.UserFlags; using Disco.Models.UI.Config.DeviceFlag; using Disco.Services.Authorization; using Disco.Services.Devices.DeviceFlags; @@ -9,6 +10,7 @@ using Disco.Services.Extensions; using Disco.Services.Plugins.Features.UIExtension; using Disco.Services.Web; using Disco.Web.Areas.Config.Models.DeviceFlag; +using Disco.Web.Models.Shared; using System; using System.Collections.Generic; using System.Linq; @@ -129,6 +131,9 @@ namespace Disco.Web.Areas.Config.Controllers DeviceFlags = DeviceFlagService.GetDeviceFlags(), }; + m.Fields = ExportFieldsModel.Create(m.Options, DeviceFlagExportOptions.DefaultOptions(), nameof(DeviceFlagExportOptions.CurrentOnly)); + m.Fields.AddCustomUserDetails(o => o.UserDetailCustom); + if (ExportTask.TryFromCache(exportId, out var context)) { m.ExportId = context.Id; diff --git a/Disco.Web/Areas/Config/Controllers/DocumentTemplateController.cs b/Disco.Web/Areas/Config/Controllers/DocumentTemplateController.cs index 50f27c83..41525320 100644 --- a/Disco.Web/Areas/Config/Controllers/DocumentTemplateController.cs +++ b/Disco.Web/Areas/Config/Controllers/DocumentTemplateController.cs @@ -3,7 +3,6 @@ using Disco.Data.Repository; using Disco.Models.Areas.Config.UI.UserFlag; using Disco.Models.Repository; using Disco.Models.Services.Documents; -using Disco.Models.Services.Exporting; using Disco.Models.UI.Config.DocumentTemplate; using Disco.Services; using Disco.Services.Authorization; @@ -306,27 +305,8 @@ namespace Disco.Web.Areas.Config.Controllers DocumentTemplates = Database.DocumentTemplates.OrderBy(d => d.Id).ToList(), }; - m.Fields = ExportFieldsModel.Create(m.Options, nameof(DocumentExportOptions.LatestOnly)); - - var userCustomDetailKeys = Database.UserDetails.Where(d => d.Scope == "Details").Select(d => d.Key).Distinct().OrderBy(k => k).ToList(); - if (userCustomDetailKeys.Any()) - { - var group = new ExportOptionGroup("User Custom Details"); - foreach (var key in userCustomDetailKeys) - { - group.Add(new ExportOptionField() - { - GroupName = group.Name, - Name = key, - DisplayName = key.TrimEnd('*', '&'), - Description = $"{key} custom detail for the user associated with the document instance", - Checked = false, - Key = "UserDetailCustom", - Value = key, - }); - } - m.Fields.FieldGroups.Add(group); - } + m.Fields = ExportFieldsModel.Create(m.Options, DocumentExportOptions.DefaultOptions(), nameof(DocumentExportOptions.LatestOnly)); + m.Fields.AddCustomUserDetails(o => o.UserDetailCustom); if (ExportTask.TryFromCache(exportId, out var context)) { @@ -340,6 +320,7 @@ namespace Disco.Web.Areas.Config.Controllers if (template != null) { + m.Options.DocumentTemplateIds.Clear(); m.Options.DocumentTemplateIds.Add(template.Id); } } diff --git a/Disco.Web/Areas/Config/Controllers/UserFlagController.cs b/Disco.Web/Areas/Config/Controllers/UserFlagController.cs index c5f77cd4..32749c62 100644 --- a/Disco.Web/Areas/Config/Controllers/UserFlagController.cs +++ b/Disco.Web/Areas/Config/Controllers/UserFlagController.cs @@ -9,6 +9,7 @@ using Disco.Services.Plugins.Features.UIExtension; using Disco.Services.Users.UserFlags; using Disco.Services.Web; using Disco.Web.Areas.Config.Models.UserFlag; +using Disco.Web.Models.Shared; using System; using System.Collections.Generic; using System.Linq; @@ -132,6 +133,9 @@ namespace Disco.Web.Areas.Config.Controllers UserFlags = UserFlagService.GetUserFlags(), }; + m.Fields = ExportFieldsModel.Create(m.Options, UserFlagExportOptions.DefaultOptions(), nameof(UserFlagExportOptions.CurrentOnly)); + m.Fields.AddCustomUserDetails(o => o.UserDetailCustom); + if (ExportTask.TryFromCache(exportId, out var context)) { m.ExportId = exportId; diff --git a/Disco.Web/Areas/Config/Models/DeviceFlag/ExportModel.cs b/Disco.Web/Areas/Config/Models/DeviceFlag/ExportModel.cs index 5578ebf4..541dbe20 100644 --- a/Disco.Web/Areas/Config/Models/DeviceFlag/ExportModel.cs +++ b/Disco.Web/Areas/Config/Models/DeviceFlag/ExportModel.cs @@ -1,6 +1,7 @@ using Disco.Models.Areas.Config.UI.DeviceFlag; using Disco.Models.Services.Devices.DeviceFlag; using Disco.Models.Services.Exporting; +using Disco.Models.UI.Shared; using System; using System.Collections.Generic; @@ -14,5 +15,7 @@ namespace Disco.Web.Areas.Config.Models.DeviceFlag public ExportResult ExportResult { get; set; } public List DeviceFlags { get; set; } + + public SharedExportFieldsModel Fields { get; set; } } } diff --git a/Disco.Web/Areas/Config/Models/UserFlag/ExportModel.cs b/Disco.Web/Areas/Config/Models/UserFlag/ExportModel.cs index 673ceb2c..92036c1d 100644 --- a/Disco.Web/Areas/Config/Models/UserFlag/ExportModel.cs +++ b/Disco.Web/Areas/Config/Models/UserFlag/ExportModel.cs @@ -1,6 +1,7 @@ using Disco.Models.Areas.Config.UI.UserFlag; using Disco.Models.Services.Exporting; using Disco.Models.Services.Users.UserFlags; +using Disco.Models.UI.Shared; using System; using System.Collections.Generic; @@ -14,5 +15,7 @@ namespace Disco.Web.Areas.Config.Models.UserFlag public ExportResult ExportResult { get; set; } public List UserFlags { get; set; } + + public SharedExportFieldsModel Fields { get; set; } } } diff --git a/Disco.Web/Areas/Config/Views/DeviceFlag/Export.cshtml b/Disco.Web/Areas/Config/Views/DeviceFlag/Export.cshtml index ccaf65c6..e710a83f 100644 --- a/Disco.Web/Areas/Config/Views/DeviceFlag/Export.cshtml +++ b/Disco.Web/Areas/Config/Views/DeviceFlag/Export.cshtml @@ -4,10 +4,6 @@ Authorization.RequireAny(Claims.Config.DeviceFlag.Export); ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Flags", MVC.Config.DeviceFlag.Index(null), "Export"); - - var optionsMetadata = ModelMetadata.FromLambdaExpression(m => m.Options, ViewData); - var optionGroups = optionsMetadata.Properties.Where(p => p.ShortDisplayName != null && p.ModelType == typeof(bool) && p.PropertyName != "CurrentOnly") - .GroupBy(m => m.ShortDisplayName); }
@using (Html.BeginForm(MVC.API.DeviceFlag.Export(), FormMethod.Post, new { @data_saveaction = Url.Action(MVC.API.DeviceFlag.SaveExport()) })) @@ -48,89 +44,21 @@
-
-

Export Fields (Defaults)

- - @foreach (var optionGroup in optionGroups) - { - var optionFields = optionGroup.ToList(); - var itemsPerColumn = (int)Math.Ceiling((double)optionFields.Count / 2); - - - - - - } -
- @optionGroup.Key - @if (optionFields.Count > 2) - { - ALL | NONE - } - -
- - - - - -
-
    - @foreach (var optionItem in optionFields.Take(itemsPerColumn)) - { -
  • - -
  • - } -
-
-
    - @foreach (var optionItem in optionFields.Skip(itemsPerColumn)) - { -
  • - -
  • - } -
-
-
-
-
+ @Html.Partial(MVC.Shared.Views._ExportFields, Model.Fields.FieldGroups) } -
+

Exporting device flags...

diff --git a/Disco.Web/Areas/Config/Views/DeviceFlag/Export.generated.cs b/Disco.Web/Areas/Config/Views/DeviceFlag/Export.generated.cs index 747b53fc..d8f3ce19 100644 --- a/Disco.Web/Areas/Config/Views/DeviceFlag/Export.generated.cs +++ b/Disco.Web/Areas/Config/Views/DeviceFlag/Export.generated.cs @@ -56,10 +56,6 @@ namespace Disco.Web.Areas.Config.Views.DeviceFlag ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Flags", MVC.Config.DeviceFlag.Index(null), "Export"); - var optionsMetadata = ModelMetadata.FromLambdaExpression(m => m.Options, ViewData); - var optionGroups = optionsMetadata.Properties.Where(p => p.ShortDisplayName != null && p.ModelType == typeof(bool) && p.PropertyName != "CurrentOnly") - .GroupBy(m => m.ShortDisplayName); - #line default #line hidden @@ -70,13 +66,13 @@ WriteLiteral(" id=\"DeviceFlag_Export\""); WriteLiteral(">\r\n"); - #line 13 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" + #line 9 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" #line default #line hidden - #line 13 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" + #line 9 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" using (Html.BeginForm(MVC.API.DeviceFlag.Export(), FormMethod.Post, new { @data_saveaction = Url.Action(MVC.API.DeviceFlag.SaveExport()) })) { @@ -84,14 +80,14 @@ WriteLiteral(">\r\n"); #line default #line hidden - #line 15 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" + #line 11 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" Write(Html.AntiForgeryToken()); #line default #line hidden - #line 15 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" + #line 11 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" @@ -114,13 +110,13 @@ WriteLiteral(">\r\n Device Flags:\r\n " \r\n"); - #line 24 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" + #line 20 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" #line default #line hidden - #line 24 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" + #line 20 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" foreach (var flag in Model.DeviceFlags) { @@ -136,20 +132,20 @@ WriteLiteral(" id=\"Options_DeviceFlagIds\""); WriteLiteral(" name=\"Options.DeviceFlagIds\""); -WriteAttribute("value", Tuple.Create(" value=\"", 1375), Tuple.Create("\"", 1391) +WriteAttribute("value", Tuple.Create(" value=\"", 1084), Tuple.Create("\"", 1100) - #line 28 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" - , Tuple.Create(Tuple.Create("", 1383), Tuple.Create(flag.Id + #line 24 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" + , Tuple.Create(Tuple.Create("", 1092), Tuple.Create(flag.Id #line default #line hidden -, 1383), false) +, 1092), false) ); WriteLiteral(" "); - #line 28 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" + #line 24 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" Write(((bool)Model.Options.DeviceFlagIds.Contains(flag.Id)) ? "checked " : null); @@ -157,31 +153,31 @@ WriteLiteral(" "); #line hidden WriteLiteral(" />\r\n (flag.Icon + #line 25 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" +, Tuple.Create(Tuple.Create("", 1235), Tuple.Create(flag.Icon #line default #line hidden -, 1526), false) -, Tuple.Create(Tuple.Create(" ", 1538), Tuple.Create("fa-lg", 1539), true) -, Tuple.Create(Tuple.Create(" ", 1544), Tuple.Create("d-", 1545), true) +, 1235), false) +, Tuple.Create(Tuple.Create(" ", 1247), Tuple.Create("fa-lg", 1248), true) +, Tuple.Create(Tuple.Create(" ", 1253), Tuple.Create("d-", 1254), true) - #line 29 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" -, Tuple.Create(Tuple.Create("", 1547), Tuple.Create(flag.IconColour + #line 25 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" +, Tuple.Create(Tuple.Create("", 1256), Tuple.Create(flag.IconColour #line default #line hidden -, 1547), false) +, 1256), false) ); WriteLiteral(">\r\n "); - #line 30 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" + #line 26 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" Write(flag.Name); @@ -191,7 +187,7 @@ WriteLiteral("\r\n \r\n "div>\r\n"); - #line 33 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" + #line 29 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" } @@ -201,7 +197,7 @@ WriteLiteral(" \r\n \r\n " "); - #line 37 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" + #line 33 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" Write(Html.LabelFor(m => m.Options.CurrentOnly)); @@ -212,7 +208,7 @@ WriteLiteral("\r\n \r\n"); WriteLiteral(" "); - #line 39 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" + #line 35 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" Write(Html.CheckBoxFor(m => m.Options.CurrentOnly)); @@ -223,7 +219,7 @@ WriteLiteral("\r\n

Uncheck to include all historical d "r>\r\n "); - #line 44 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" + #line 40 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" Write(Html.LabelFor(m => m.Options.Format)); @@ -234,7 +230,7 @@ WriteLiteral("\r\n \r\n"); WriteLiteral(" "); - #line 46 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" + #line 42 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" Write(Html.DropDownListFor(m => m.Options.Format, Enum.GetNames(typeof(Disco.Models.Exporting.ExportFormat)).Select(v => new SelectListItem() { Value = v, Text = v }))); @@ -243,372 +239,49 @@ WriteLiteral(" "); WriteLiteral("\r\n \r\n \r\n \r\n " + "

\r\n"); -WriteLiteral(" \r\n

Export Fields (Defaults)

\r\n \r\n"); - - #line 54 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" - + #line 47 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" + #line default #line hidden - #line 54 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" - foreach (var optionGroup in optionGroups) - { - var optionFields = optionGroup.ToList(); - var itemsPerColumn = (int)Math.Ceiling((double)optionFields.Count / 2); + #line 47 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" + Write(Html.Partial(MVC.Shared.Views._ExportFields, Model.Fields.FieldGroups)); #line default #line hidden -WriteLiteral(" \r\n \r\n"); - -WriteLiteral(" "); - - #line 60 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" - Write(optionGroup.Key); + #line 47 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" + #line default #line hidden -WriteLiteral("\r\n"); - - - #line 61 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" - - - #line default - #line hidden - - #line 61 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" - if (optionFields.Count > 2) - { - - - #line default - #line hidden -WriteLiteral(" ALL | NONE\r\n"); - - - #line 64 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" - } - - - #line default - #line hidden -WriteLiteral(" \r\n \r\n " + -" \r\n \r\n"); - - - #line 72 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" - - - #line default - #line hidden - - #line 72 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" - foreach (var optionItem in optionFields.Take(itemsPerColumn)) - { - - - #line default - #line hidden -WriteLiteral(" (optionItem.Description - - #line default - #line hidden -, 3963), false) -); - -WriteLiteral(">\r\n (optionItem.PropertyName - - #line default - #line hidden -, 4081), false) -); - -WriteAttribute("name", Tuple.Create(" name=\"", 4106), Tuple.Create("\"", 4145) -, Tuple.Create(Tuple.Create("", 4113), Tuple.Create("Options.", 4113), true) - - #line 75 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" - , Tuple.Create(Tuple.Create("", 4121), Tuple.Create(optionItem.PropertyName - - #line default - #line hidden -, 4121), false) -); - -WriteLiteral(" value=\"true\""); - -WriteLiteral(" "); - - - #line 75 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" - Write(((bool)optionItem.Model) ? "checked " : null); - - - #line default - #line hidden -WriteLiteral(" />(optionItem.PropertyName - - #line default - #line hidden -, 4230), false) -); - -WriteLiteral(">"); - - - #line 75 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" - Write(optionItem.DisplayName); - - - #line default - #line hidden -WriteLiteral("\r\n \r\n"); - - - #line 77 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" - } - - - #line default - #line hidden -WriteLiteral(" \r\n " + -" \r\n \r\n \r\n"); - - - #line 82 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" - - - #line default - #line hidden - - #line 82 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" - foreach (var optionItem in optionFields.Skip(itemsPerColumn)) - { - - - #line default - #line hidden -WriteLiteral(" (optionItem.Description - - #line default - #line hidden -, 4851), false) -); - -WriteLiteral(">\r\n (optionItem.PropertyName - - #line default - #line hidden -, 4969), false) -); - -WriteAttribute("name", Tuple.Create(" name=\"", 4994), Tuple.Create("\"", 5033) -, Tuple.Create(Tuple.Create("", 5001), Tuple.Create("Options.", 5001), true) - - #line 85 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" - , Tuple.Create(Tuple.Create("", 5009), Tuple.Create(optionItem.PropertyName - - #line default - #line hidden -, 5009), false) -); - -WriteLiteral(" value=\"true\""); - -WriteLiteral(" "); - - - #line 85 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" - Write(((bool)optionItem.Model) ? "checked " : null); - - - #line default - #line hidden -WriteLiteral(" />(optionItem.PropertyName - - #line default - #line hidden -, 5118), false) -); - -WriteLiteral(">"); - - - #line 85 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" - Write(optionItem.DisplayName); - - - #line default - #line hidden -WriteLiteral("\r\n \r\n"); +WriteLiteral(" \r\n"); #line 87 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" - } - - - #line default - #line hidden -WriteLiteral(@" - - -
\r\n " + -" \r\n \r\n
-
- - -"); - - - #line 95 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" - - } - - - #line default - #line hidden -WriteLiteral(" \r\n \r\n"); - -WriteLiteral(" \r\n"); - - - #line 167 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml" } @@ -617,7 +290,7 @@ WriteLiteral(" + @Html.Partial(MVC.Shared.Views._ExportFields, Model.Fields.FieldGroups) } @if (Model.ExportId.HasValue) { -
+
@if (Model.ExportResult.RecordCount == 0) {

No records matched the filter criteria

@@ -191,7 +75,7 @@
} -
+

Exporting document instances...

@@ -216,4 +100,42 @@ } +
diff --git a/Disco.Web/Areas/Config/Views/DocumentTemplate/Export.generated.cs b/Disco.Web/Areas/Config/Views/DocumentTemplate/Export.generated.cs index 4e6309d2..912f6721 100644 --- a/Disco.Web/Areas/Config/Views/DocumentTemplate/Export.generated.cs +++ b/Disco.Web/Areas/Config/Views/DocumentTemplate/Export.generated.cs @@ -30,12 +30,6 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate using Disco.Models.Repository; using Disco.Services; using Disco.Services.Authorization; - - #line 2 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - using Disco.Services.Exporting; - - #line default - #line hidden using Disco.Services.Web; using Disco.Web; @@ -56,7 +50,7 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate public override void Execute() { - #line 4 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + #line 3 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" Authorization.Require(Claims.Config.DocumentTemplate.Export); @@ -72,13 +66,13 @@ WriteLiteral(" id=\"DocumentTemplate_Export\""); WriteLiteral(">\r\n"); - #line 10 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + #line 9 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" #line default #line hidden - #line 10 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + #line 9 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" using (Html.BeginForm(MVC.API.DocumentTemplate.Export(), FormMethod.Post, new { @data_saveaction = Url.Action(MVC.API.DocumentTemplate.SaveExport()) })) { @@ -86,14 +80,14 @@ WriteLiteral(">\r\n"); #line default #line hidden - #line 12 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + #line 11 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" Write(Html.AntiForgeryToken()); #line default #line hidden - #line 12 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + #line 11 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" @@ -101,7 +95,7 @@ WriteLiteral(">\r\n"); #line hidden WriteLiteral(" \r\n"); - #line 22 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + #line 21 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" #line default #line hidden - #line 22 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + #line 21 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" var index = 0; foreach (var document in Model.DocumentTemplates) @@ -145,33 +139,33 @@ WriteLiteral(" \r\n WriteLiteral(" type=\"checkbox\""); -WriteAttribute("id", Tuple.Create(" id=\"", 1353), Tuple.Create("\"", 1392) -, Tuple.Create(Tuple.Create("", 1358), Tuple.Create("Options_DocumentTemplateIds_", 1358), true) +WriteAttribute("id", Tuple.Create(" id=\"", 1302), Tuple.Create("\"", 1341) +, Tuple.Create(Tuple.Create("", 1307), Tuple.Create("Options_DocumentTemplateIds_", 1307), true) - #line 29 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - , Tuple.Create(Tuple.Create("", 1386), Tuple.Create(index + #line 28 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + , Tuple.Create(Tuple.Create("", 1335), Tuple.Create(index #line default #line hidden -, 1386), false) +, 1335), false) ); WriteLiteral(" name=\"Options.DocumentTemplateIds\""); -WriteAttribute("value", Tuple.Create(" value=\"", 1428), Tuple.Create("\"", 1448) +WriteAttribute("value", Tuple.Create(" value=\"", 1377), Tuple.Create("\"", 1397) - #line 29 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - , Tuple.Create(Tuple.Create("", 1436), Tuple.Create(document.Id + #line 28 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + , Tuple.Create(Tuple.Create("", 1385), Tuple.Create(document.Id #line default #line hidden -, 1436), false) +, 1385), false) ); WriteLiteral(" "); - #line 29 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + #line 28 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" Write(((bool)Model.Options.DocumentTemplateIds.Contains(document.Id)) ? "checked " : null); @@ -180,7 +174,7 @@ WriteLiteral(" "); WriteLiteral(" />\r\n "); - #line 30 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + #line 29 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" Write(document.Id); @@ -190,21 +184,21 @@ WriteLiteral("\r\n \ " \r\n \r\n " + " (index + #line 33 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + , Tuple.Create(Tuple.Create("", 1800), Tuple.Create(index #line default #line hidden -, 1851), false) +, 1800), false) ); WriteLiteral(">"); - #line 34 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + #line 33 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" Write(document.Description); @@ -216,7 +210,7 @@ WriteLiteral("\r\n \r\n WriteLiteral(" "); - #line 37 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + #line 36 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" Write(document.Scope); @@ -226,7 +220,7 @@ WriteLiteral("\r\n \r\n " \r\n"); - #line 40 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + #line 39 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" index++; } @@ -237,7 +231,7 @@ WriteLiteral("\r\n \r\n \ "tr>\r\n \r\n "); - #line 47 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + #line 46 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" Write(Html.LabelFor(m => m.Options.LatestOnly)); @@ -248,7 +242,7 @@ WriteLiteral("\r\n \r\n"); WriteLiteral(" "); - #line 49 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + #line 48 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" Write(Html.CheckBoxFor(m => m.Options.LatestOnly)); @@ -259,7 +253,7 @@ WriteLiteral("\r\n

Uncheck to include all document ins " "); - #line 54 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + #line 53 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" Write(Html.LabelFor(m => m.Options.Format)); @@ -270,7 +264,7 @@ WriteLiteral("\r\n \r\n"); WriteLiteral(" "); - #line 56 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + #line 55 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" Write(Html.DropDownListFor(m => m.Options.Format, Enum.GetNames(typeof(Disco.Models.Exporting.ExportFormat)).Select(v => new SelectListItem() { Value = v, Text = v }))); @@ -279,390 +273,22 @@ WriteLiteral(" "); WriteLiteral("\r\n \r\n \r\n \r\n " + "

\r\n"); -WriteLiteral(" \r\n

Export Fields (Defaults)

\r\n \r\n"); - - #line 64 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - + #line 60 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + #line default #line hidden - #line 64 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - foreach (var optionGroup in Model.Fields.FieldGroups) - { - var optionFields = optionGroup.ToList(); - var itemsPerColumn = (int)Math.Ceiling((double)optionFields.Count / 2); + #line 60 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + Write(Html.Partial(MVC.Shared.Views._ExportFields, Model.Fields.FieldGroups)); #line default #line hidden -WriteLiteral(" \r\n \r\n"); - -WriteLiteral(" "); - - #line 70 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - Write(optionGroup.Name); - - - #line default - #line hidden -WriteLiteral("\r\n"); - - - #line 71 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - - - #line default - #line hidden - - #line 71 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - if (optionFields.Count > 2) - { - - - #line default - #line hidden -WriteLiteral(" ALL | NONE\r\n"); - - - #line 74 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - } - - - #line default - #line hidden -WriteLiteral(" \r\n \r\n " + -" \r\n \r\n"); - - - #line 82 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - - - #line default - #line hidden - - #line 82 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - foreach (var optionItem in optionFields.Take(itemsPerColumn)) - { - - - #line default - #line hidden -WriteLiteral(" (optionItem.Description - - #line default - #line hidden -, 4517), false) -); - -WriteLiteral(">\r\n (optionItem.Name - - #line default - #line hidden -, 4635), false) -); - -WriteAttribute("name", Tuple.Create(" name=\"", 4652), Tuple.Create("\"", 4703) -, Tuple.Create(Tuple.Create("", 4659), Tuple.Create("Options.", 4659), true) - - #line 85 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - , Tuple.Create(Tuple.Create("", 4667), Tuple.Create(optionItem.Key ?? optionItem.Name - - #line default - #line hidden -, 4667), false) -); - -WriteAttribute("value", Tuple.Create(" value=\"", 4704), Tuple.Create("\"", 4741) - - #line 85 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - , Tuple.Create(Tuple.Create("", 4712), Tuple.Create(optionItem.Value ?? "true" - - #line default - #line hidden -, 4712), false) -); - -WriteLiteral(" "); - - - #line 85 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - Write((optionItem.Checked) ? "checked " : null); - - - #line default - #line hidden -WriteLiteral(" />(optionItem.Name - - #line default - #line hidden -, 4809), false) -); - -WriteLiteral(">"); - - - #line 85 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - Write(optionItem.DisplayName); - - - #line default - #line hidden -WriteLiteral("\r\n \r\n"); - - - #line 87 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - } - - - #line default - #line hidden -WriteLiteral(" \r\n " + -" \r\n \r\n \r\n"); - - - #line 92 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - - - #line default - #line hidden - - #line 92 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - foreach (var optionItem in optionFields.Skip(itemsPerColumn)) - { - - - #line default - #line hidden -WriteLiteral(" (optionItem.Description - - #line default - #line hidden -, 5422), false) -); - -WriteLiteral(">\r\n (optionItem.Name - - #line default - #line hidden -, 5540), false) -); - -WriteAttribute("name", Tuple.Create(" name=\"", 5557), Tuple.Create("\"", 5608) -, Tuple.Create(Tuple.Create("", 5564), Tuple.Create("Options.", 5564), true) - - #line 95 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - , Tuple.Create(Tuple.Create("", 5572), Tuple.Create(optionItem.Key ?? optionItem.Name - - #line default - #line hidden -, 5572), false) -); - -WriteAttribute("value", Tuple.Create(" value=\"", 5609), Tuple.Create("\"", 5646) - - #line 95 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - , Tuple.Create(Tuple.Create("", 5617), Tuple.Create(optionItem.Value ?? "true" - - #line default - #line hidden -, 5617), false) -); - -WriteLiteral(" "); - - - #line 95 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - Write((optionItem.Checked) ? "checked " : null); - - - #line default - #line hidden -WriteLiteral(" />(optionItem.Name - - #line default - #line hidden -, 5714), false) -); - -WriteLiteral(">"); - - - #line 95 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - Write(optionItem.DisplayName); - - - #line default - #line hidden -WriteLiteral("\r\n \r\n"); - - - #line 97 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - } - - - #line default - #line hidden -WriteLiteral(@" - - -
\r\n " + -" \r\n \r\n
-
- - -"); - - - #line 105 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" - - } - - - #line default - #line hidden -WriteLiteral(" \r\n \r\n"); - -WriteLiteral(" \r\n"); - - - #line 177 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + #line 60 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml" + } @@ -671,7 +297,7 @@ WriteLiteral(" + +"); } } diff --git a/Disco.Web/Areas/Config/Views/UserFlag/Export.cshtml b/Disco.Web/Areas/Config/Views/UserFlag/Export.cshtml index 2ce72335..371c38ee 100644 --- a/Disco.Web/Areas/Config/Views/UserFlag/Export.cshtml +++ b/Disco.Web/Areas/Config/Views/UserFlag/Export.cshtml @@ -4,10 +4,6 @@ Authorization.RequireAny(Claims.Config.UserFlag.Export); ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "User Flags", MVC.Config.UserFlag.Index(null), "Export"); - - var optionsMetadata = ModelMetadata.FromLambdaExpression(m => m.Options, ViewData); - var optionGroups = optionsMetadata.Properties.Where(p => p.ShortDisplayName != null && p.ModelType == typeof(bool) && p.PropertyName != "CurrentOnly") - .GroupBy(m => m.ShortDisplayName); }
@using (Html.BeginForm(MVC.API.UserFlag.Export(), FormMethod.Post, new { @data_saveaction = Url.Action(MVC.API.UserFlag.SaveExport()) })) @@ -48,89 +44,21 @@
-
-

Export Fields (Defaults)

- - @foreach (var optionGroup in optionGroups) - { - var optionFields = optionGroup.ToList(); - var itemsPerColumn = (int)Math.Ceiling((double)optionFields.Count / 2); - - - - - - } -
- @optionGroup.Key - @if (optionFields.Count > 2) - { - ALL | NONE - } - -
- - - - - -
-
    - @foreach (var optionItem in optionFields.Take(itemsPerColumn)) - { -
  • - -
  • - } -
-
-
    - @foreach (var optionItem in optionFields.Skip(itemsPerColumn)) - { -
  • - -
  • - } -
-
-
-
-
+ @Html.Partial(MVC.Shared.Views._ExportFields, Model.Fields.FieldGroups) } -
+

Exporting user flags...

diff --git a/Disco.Web/Areas/Config/Views/UserFlag/Export.generated.cs b/Disco.Web/Areas/Config/Views/UserFlag/Export.generated.cs index 93541069..dfb8fa60 100644 --- a/Disco.Web/Areas/Config/Views/UserFlag/Export.generated.cs +++ b/Disco.Web/Areas/Config/Views/UserFlag/Export.generated.cs @@ -56,10 +56,6 @@ namespace Disco.Web.Areas.Config.Views.UserFlag ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "User Flags", MVC.Config.UserFlag.Index(null), "Export"); - var optionsMetadata = ModelMetadata.FromLambdaExpression(m => m.Options, ViewData); - var optionGroups = optionsMetadata.Properties.Where(p => p.ShortDisplayName != null && p.ModelType == typeof(bool) && p.PropertyName != "CurrentOnly") - .GroupBy(m => m.ShortDisplayName); - #line default #line hidden @@ -70,13 +66,13 @@ WriteLiteral(" id=\"UserFlag_Export\""); WriteLiteral(">\r\n"); - #line 13 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" + #line 9 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" #line default #line hidden - #line 13 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" + #line 9 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" using (Html.BeginForm(MVC.API.UserFlag.Export(), FormMethod.Post, new { @data_saveaction = Url.Action(MVC.API.UserFlag.SaveExport()) })) { @@ -84,14 +80,14 @@ WriteLiteral(">\r\n"); #line default #line hidden - #line 15 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" + #line 11 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" Write(Html.AntiForgeryToken()); #line default #line hidden - #line 15 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" + #line 11 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" @@ -114,13 +110,13 @@ WriteLiteral(">\r\n User Flags:\r\n \r\n"); - #line 24 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" + #line 20 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" #line default #line hidden - #line 24 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" + #line 20 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" foreach (var userFlag in Model.UserFlags) { @@ -136,20 +132,20 @@ WriteLiteral(" id=\"Options_UserFlagIds\""); WriteLiteral(" name=\"Options.UserFlagIds\""); -WriteAttribute("value", Tuple.Create(" value=\"", 1355), Tuple.Create("\"", 1375) +WriteAttribute("value", Tuple.Create(" value=\"", 1064), Tuple.Create("\"", 1084) - #line 28 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" - , Tuple.Create(Tuple.Create("", 1363), Tuple.Create(userFlag.Id + #line 24 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" + , Tuple.Create(Tuple.Create("", 1072), Tuple.Create(userFlag.Id #line default #line hidden -, 1363), false) +, 1072), false) ); WriteLiteral(" "); - #line 28 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" + #line 24 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" Write(((bool)Model.Options.UserFlagIds.Contains(userFlag.Id)) ? "checked " : null); @@ -157,31 +153,31 @@ WriteLiteral(" "); #line hidden WriteLiteral(" />\r\n (userFlag.Icon + #line 25 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" +, Tuple.Create(Tuple.Create("", 1221), Tuple.Create(userFlag.Icon #line default #line hidden -, 1512), false) -, Tuple.Create(Tuple.Create(" ", 1528), Tuple.Create("fa-lg", 1529), true) -, Tuple.Create(Tuple.Create(" ", 1534), Tuple.Create("d-", 1535), true) +, 1221), false) +, Tuple.Create(Tuple.Create(" ", 1237), Tuple.Create("fa-lg", 1238), true) +, Tuple.Create(Tuple.Create(" ", 1243), Tuple.Create("d-", 1244), true) - #line 29 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" -, Tuple.Create(Tuple.Create("", 1537), Tuple.Create(userFlag.IconColour + #line 25 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" +, Tuple.Create(Tuple.Create("", 1246), Tuple.Create(userFlag.IconColour #line default #line hidden -, 1537), false) +, 1246), false) ); WriteLiteral(">\r\n "); - #line 30 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" + #line 26 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" Write(userFlag.Name); @@ -191,7 +187,7 @@ WriteLiteral("\r\n \r\n "div>\r\n"); - #line 33 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" + #line 29 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" } @@ -201,7 +197,7 @@ WriteLiteral(" \r\n \r\n " "); - #line 37 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" + #line 33 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" Write(Html.LabelFor(m => m.Options.CurrentOnly)); @@ -212,7 +208,7 @@ WriteLiteral("\r\n \r\n"); WriteLiteral(" "); - #line 39 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" + #line 35 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" Write(Html.CheckBoxFor(m => m.Options.CurrentOnly)); @@ -223,7 +219,7 @@ WriteLiteral("\r\n

Uncheck to include all historical u "\r\n "); - #line 44 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" + #line 40 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" Write(Html.LabelFor(m => m.Options.Format)); @@ -234,7 +230,7 @@ WriteLiteral("\r\n \r\n"); WriteLiteral(" "); - #line 46 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" + #line 42 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" Write(Html.DropDownListFor(m => m.Options.Format, Enum.GetNames(typeof(Disco.Models.Exporting.ExportFormat)).Select(v => new SelectListItem() { Value = v, Text = v }))); @@ -243,372 +239,49 @@ WriteLiteral(" "); WriteLiteral("\r\n \r\n \r\n \r\n " + "

\r\n"); -WriteLiteral(" \r\n

Export Fields (Defaults)

\r\n \r\n"); - - #line 54 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" - + #line 47 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" + #line default #line hidden - #line 54 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" - foreach (var optionGroup in optionGroups) - { - var optionFields = optionGroup.ToList(); - var itemsPerColumn = (int)Math.Ceiling((double)optionFields.Count / 2); + #line 47 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" + Write(Html.Partial(MVC.Shared.Views._ExportFields, Model.Fields.FieldGroups)); #line default #line hidden -WriteLiteral(" \r\n \r\n"); - -WriteLiteral(" "); - - #line 60 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" - Write(optionGroup.Key); + #line 47 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" + #line default #line hidden -WriteLiteral("\r\n"); - - - #line 61 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" - - - #line default - #line hidden - - #line 61 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" - if (optionFields.Count > 2) - { - - - #line default - #line hidden -WriteLiteral(" ALL | NONE\r\n"); - - - #line 64 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" - } - - - #line default - #line hidden -WriteLiteral(" \r\n \r\n " + -" \r\n \r\n"); - - - #line 72 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" - - - #line default - #line hidden - - #line 72 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" - foreach (var optionItem in optionFields.Take(itemsPerColumn)) - { - - - #line default - #line hidden -WriteLiteral(" (optionItem.Description - - #line default - #line hidden -, 3953), false) -); - -WriteLiteral(">\r\n (optionItem.PropertyName - - #line default - #line hidden -, 4071), false) -); - -WriteAttribute("name", Tuple.Create(" name=\"", 4096), Tuple.Create("\"", 4135) -, Tuple.Create(Tuple.Create("", 4103), Tuple.Create("Options.", 4103), true) - - #line 75 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" - , Tuple.Create(Tuple.Create("", 4111), Tuple.Create(optionItem.PropertyName - - #line default - #line hidden -, 4111), false) -); - -WriteLiteral(" value=\"true\""); - -WriteLiteral(" "); - - - #line 75 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" - Write(((bool)optionItem.Model) ? "checked " : null); - - - #line default - #line hidden -WriteLiteral(" />(optionItem.PropertyName - - #line default - #line hidden -, 4220), false) -); - -WriteLiteral(">"); - - - #line 75 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" - Write(optionItem.DisplayName); - - - #line default - #line hidden -WriteLiteral("\r\n \r\n"); - - - #line 77 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" - } - - - #line default - #line hidden -WriteLiteral(" \r\n " + -" \r\n \r\n \r\n"); - - - #line 82 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" - - - #line default - #line hidden - - #line 82 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" - foreach (var optionItem in optionFields.Skip(itemsPerColumn)) - { - - - #line default - #line hidden -WriteLiteral(" (optionItem.Description - - #line default - #line hidden -, 4841), false) -); - -WriteLiteral(">\r\n (optionItem.PropertyName - - #line default - #line hidden -, 4959), false) -); - -WriteAttribute("name", Tuple.Create(" name=\"", 4984), Tuple.Create("\"", 5023) -, Tuple.Create(Tuple.Create("", 4991), Tuple.Create("Options.", 4991), true) - - #line 85 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" - , Tuple.Create(Tuple.Create("", 4999), Tuple.Create(optionItem.PropertyName - - #line default - #line hidden -, 4999), false) -); - -WriteLiteral(" value=\"true\""); - -WriteLiteral(" "); - - - #line 85 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" - Write(((bool)optionItem.Model) ? "checked " : null); - - - #line default - #line hidden -WriteLiteral(" />(optionItem.PropertyName - - #line default - #line hidden -, 5108), false) -); - -WriteLiteral(">"); - - - #line 85 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" - Write(optionItem.DisplayName); - - - #line default - #line hidden -WriteLiteral("\r\n \r\n"); +WriteLiteral(" \r\n"); #line 87 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" - } - - - #line default - #line hidden -WriteLiteral(@" - - -
\r\n " + -" \r\n \r\n
-
- - -"); - - - #line 95 "..\..\Areas\Config\Views\UserFlag\Export.cshtml" - - } - - - #line default - #line hidden -WriteLiteral(" \r\n \r\n"); - -WriteLiteral(" } -
+

Exporting devices...

diff --git a/Disco.Web/Views/Device/Export.generated.cs b/Disco.Web/Views/Device/Export.generated.cs index 342d5ffd..26bd7493 100644 --- a/Disco.Web/Views/Device/Export.generated.cs +++ b/Disco.Web/Views/Device/Export.generated.cs @@ -54,11 +54,7 @@ namespace Disco.Web.Views.Device Authorization.RequireAny(Claims.Device.Actions.Export); - ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Export Devices"); - - var optionsMetadata = ModelMetadata.FromLambdaExpression(m => m.Options, ViewData); - var optionGroups = optionsMetadata.Properties.Where(p => p.ShortDisplayName != null && p.ModelType == typeof(bool)) - .GroupBy(m => m.ShortDisplayName); + ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Export"); #line default @@ -70,13 +66,13 @@ WriteLiteral(" id=\"Devices_Export\""); WriteLiteral(">\r\n"); - #line 13 "..\..\Views\Device\Export.cshtml" + #line 9 "..\..\Views\Device\Export.cshtml" #line default #line hidden - #line 13 "..\..\Views\Device\Export.cshtml" + #line 9 "..\..\Views\Device\Export.cshtml" using (Html.BeginForm(MVC.API.Device.Export(), FormMethod.Post, new { @data_saveaction = Url.Action(MVC.API.Device.SaveExport()) })) { @@ -84,14 +80,14 @@ WriteLiteral(">\r\n"); #line default #line hidden - #line 15 "..\..\Views\Device\Export.cshtml" + #line 11 "..\..\Views\Device\Export.cshtml" Write(Html.AntiForgeryToken()); #line default #line hidden - #line 15 "..\..\Views\Device\Export.cshtml" + #line 11 "..\..\Views\Device\Export.cshtml" @@ -116,7 +112,7 @@ WriteLiteral(">\r\n Type:\r\n \r\ WriteLiteral(" "); - #line 24 "..\..\Views\Device\Export.cshtml" + #line 20 "..\..\Views\Device\Export.cshtml" Write(Html.DropDownListFor(m => m.Options.ExportType, Enum.GetNames(typeof(Disco.Models.Services.Devices.DeviceExportTypes)).Select(t => new SelectListItem() { Text = t, Value = t }))); @@ -133,7 +129,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 26 "..\..\Views\Device\Export.cshtml" + #line 22 "..\..\Views\Device\Export.cshtml" Write(Html.DropDownListFor(m => m.Options.ExportTypeTargetId, Model.DeviceBatches.Select(i => new SelectListItem() { Value = i.Key.ToString(), Text = i.Value }))); @@ -150,7 +146,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 29 "..\..\Views\Device\Export.cshtml" + #line 25 "..\..\Views\Device\Export.cshtml" Write(Html.DropDownListFor(m => m.Options.ExportTypeTargetId, Model.DeviceModels.Select(i => new SelectListItem() { Value = i.Key.ToString(), Text = i.Value }))); @@ -167,7 +163,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 32 "..\..\Views\Device\Export.cshtml" + #line 28 "..\..\Views\Device\Export.cshtml" Write(Html.DropDownListFor(m => m.Options.ExportTypeTargetId, Model.DeviceProfiles.Select(i => new SelectListItem() { Value = i.Key.ToString(), Text = i.Value }))); @@ -177,7 +173,7 @@ WriteLiteral("\r\n
\r\n \r\ ">\r\n \r\n "); - #line 37 "..\..\Views\Device\Export.cshtml" + #line 33 "..\..\Views\Device\Export.cshtml" Write(Html.LabelFor(m => m.Options.Format)); @@ -188,7 +184,7 @@ WriteLiteral("\r\n \r\n"); WriteLiteral(" "); - #line 39 "..\..\Views\Device\Export.cshtml" + #line 35 "..\..\Views\Device\Export.cshtml" Write(Html.DropDownListFor(m => m.Options.Format, Enum.GetNames(typeof(Disco.Models.Exporting.ExportFormat)).Select(v => new SelectListItem() { Value = v, Text = v }))); @@ -197,385 +193,62 @@ WriteLiteral(" "); WriteLiteral("\r\n \r\n \r\n \r\n " + "
\r\n"); -WriteLiteral(" \r\n

Export Fields (Defaults)

\r\n \r\n"); - - #line 47 "..\..\Views\Device\Export.cshtml" - + #line 40 "..\..\Views\Device\Export.cshtml" + #line default #line hidden - #line 47 "..\..\Views\Device\Export.cshtml" - foreach (var optionGroup in optionGroups) - { - var optionFields = optionGroup.ToList(); - var itemsPerColumn = (int)Math.Ceiling((double)optionFields.Count / 2); + #line 40 "..\..\Views\Device\Export.cshtml" + Write(Html.Partial(MVC.Shared.Views._ExportFields, Model.Fields.FieldGroups)); #line default #line hidden -WriteLiteral(" \r\n \r\n"); - -WriteLiteral(" "); - - #line 53 "..\..\Views\Device\Export.cshtml" - Write(optionGroup.Key); + #line 40 "..\..\Views\Device\Export.cshtml" + #line default #line hidden -WriteLiteral("\r\n"); +WriteLiteral(" \r" + +"\n"); - #line 54 "..\..\Views\Device\Export.cshtml" - - - #line default - #line hidden - - #line 54 "..\..\Views\Device\Export.cshtml" - if (optionFields.Count > 2) - { - - - #line default - #line hidden -WriteLiteral(" ALL | NONE\r\n"); - - - #line 57 "..\..\Views\Device\Export.cshtml" - } - - - #line default - #line hidden -WriteLiteral(" \r\n \r\n " + -" \r\n \r\n"); - - - #line 65 "..\..\Views\Device\Export.cshtml" - - - #line default - #line hidden - - #line 65 "..\..\Views\Device\Export.cshtml" - foreach (var optionItem in optionFields.Take(itemsPerColumn)) - { - - - #line default - #line hidden -WriteLiteral(" (optionItem.Description - - #line default - #line hidden -, 4011), false) -); - -WriteLiteral(">\r\n (optionItem.PropertyName - - #line default - #line hidden -, 4129), false) -); - -WriteAttribute("name", Tuple.Create(" name=\"", 4154), Tuple.Create("\"", 4193) -, Tuple.Create(Tuple.Create("", 4161), Tuple.Create("Options.", 4161), true) - - #line 68 "..\..\Views\Device\Export.cshtml" - , Tuple.Create(Tuple.Create("", 4169), Tuple.Create(optionItem.PropertyName - - #line default - #line hidden -, 4169), false) -); - -WriteLiteral(" value=\"true\""); - -WriteLiteral(" "); - - - #line 68 "..\..\Views\Device\Export.cshtml" - Write(((bool)optionItem.Model) ? "checked " : null); - - - #line default - #line hidden -WriteLiteral(" />(optionItem.PropertyName - - #line default - #line hidden -, 4278), false) -); - -WriteLiteral(">"); - - - #line 68 "..\..\Views\Device\Export.cshtml" - Write(optionItem.DisplayName); - - - #line default - #line hidden -WriteLiteral("\r\n \r\n"); - - - #line 70 "..\..\Views\Device\Export.cshtml" - } - - - #line default - #line hidden -WriteLiteral(" \r\n " + -" \r\n \r\n \r\n"); - - - #line 75 "..\..\Views\Device\Export.cshtml" - - - #line default - #line hidden - - #line 75 "..\..\Views\Device\Export.cshtml" - foreach (var optionItem in optionFields.Skip(itemsPerColumn)) - { - - - #line default - #line hidden -WriteLiteral(" (optionItem.Description - - #line default - #line hidden -, 4899), false) -); - -WriteLiteral(">\r\n (optionItem.PropertyName - - #line default - #line hidden -, 5017), false) -); - -WriteAttribute("name", Tuple.Create(" name=\"", 5042), Tuple.Create("\"", 5081) -, Tuple.Create(Tuple.Create("", 5049), Tuple.Create("Options.", 5049), true) - - #line 78 "..\..\Views\Device\Export.cshtml" - , Tuple.Create(Tuple.Create("", 5057), Tuple.Create(optionItem.PropertyName - - #line default - #line hidden -, 5057), false) -); - -WriteLiteral(" value=\"true\""); - -WriteLiteral(" "); - - - #line 78 "..\..\Views\Device\Export.cshtml" - Write(((bool)optionItem.Model) ? "checked " : null); - - - #line default - #line hidden -WriteLiteral(" />(optionItem.PropertyName - - #line default - #line hidden -, 5166), false) -); - -WriteLiteral(">"); - - - #line 78 "..\..\Views\Device\Export.cshtml" - Write(optionItem.DisplayName); - - - #line default - #line hidden -WriteLiteral("\r\n \r\n"); - - - #line 80 "..\..\Views\Device\Export.cshtml" - } - - - #line default - #line hidden -WriteLiteral(@" - - -
\r\n " + -" \r\n \r\n
- - - -"); - - - #line 88 "..\..\Views\Device\Export.cshtml" - - } - - - #line default - #line hidden -WriteLiteral(" \r\n \r\n"); - -WriteLiteral(" \r\n"); - - - #line 180 "..\..\Views\Device\Export.cshtml" + #line 96 "..\..\Views\Device\Export.cshtml" } @@ -584,7 +257,7 @@ WriteLiteral(" } -
+

Exporting jobs...

diff --git a/Disco.Web/Views/Job/Export.generated.cs b/Disco.Web/Views/Job/Export.generated.cs index 8a0241d4..6d5153fc 100644 --- a/Disco.Web/Views/Job/Export.generated.cs +++ b/Disco.Web/Views/Job/Export.generated.cs @@ -936,24 +936,20 @@ WriteLiteral(" \r\n"); - #line 258 "..\..\Views\Job\Export.cshtml" + #line 251 "..\..\Views\Job\Export.cshtml" } @@ -962,7 +958,7 @@ WriteLiteral(" diff --git a/Disco.Web/Views/Shared/_ExportFields.generated.cs b/Disco.Web/Views/Shared/_ExportFields.generated.cs new file mode 100644 index 00000000..d82fac6d --- /dev/null +++ b/Disco.Web/Views/Shared/_ExportFields.generated.cs @@ -0,0 +1,450 @@ +#pragma warning disable 1591 +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Disco.Web.Views.Shared +{ + using System; + + #line 2 "..\..\Views\Shared\_ExportFields.cshtml" + using System.Collections.Generic; + + #line default + #line hidden + using System.IO; + using System.Linq; + using System.Net; + using System.Text; + using System.Web; + using System.Web.Helpers; + using System.Web.Mvc; + using System.Web.Mvc.Ajax; + using System.Web.Mvc.Html; + using System.Web.Routing; + using System.Web.Security; + using System.Web.UI; + using System.Web.WebPages; + using Disco; + using Disco.Models.Repository; + + #line 1 "..\..\Views\Shared\_ExportFields.cshtml" + using Disco.Models.Services.Exporting; + + #line default + #line hidden + using Disco.Services; + using Disco.Services.Authorization; + using Disco.Services.Web; + using Disco.Web; + using Disco.Web.Extensions; + + [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")] + [System.Web.WebPages.PageVirtualPathAttribute("~/Views/Shared/_ExportFields.cshtml")] + public partial class _ExportFields : Disco.Services.Web.WebViewPage> + { + public _ExportFields() + { + } + public override void Execute() + { + + #line 4 "..\..\Views\Shared\_ExportFields.cshtml" + + var optionId = 0; + + + #line default + #line hidden +WriteLiteral("\r\n\r\n

Export Fields (Defaults)

\r\n \r\n"); + + + #line 10 "..\..\Views\Shared\_ExportFields.cshtml" + + + #line default + #line hidden + + #line 10 "..\..\Views\Shared\_ExportFields.cshtml" + foreach (var optionGroup in Model) + { + var optionFields = optionGroup.ToList(); + var itemsPerColumn = (int)Math.Ceiling((double)optionFields.Count / 2); + + + #line default + #line hidden +WriteLiteral(" \r\n \r\n"); + +WriteLiteral(" "); + + + #line 16 "..\..\Views\Shared\_ExportFields.cshtml" + Write(optionGroup.Name); + + + #line default + #line hidden +WriteLiteral("\r\n"); + + + #line 17 "..\..\Views\Shared\_ExportFields.cshtml" + + + #line default + #line hidden + + #line 17 "..\..\Views\Shared\_ExportFields.cshtml" + if (optionFields.Count > 2) + { + + + #line default + #line hidden +WriteLiteral(" ALL | NONE\r\n"); + + + #line 20 "..\..\Views\Shared\_ExportFields.cshtml" + } + + + #line default + #line hidden +WriteLiteral(" \r\n \r\n \r\n \r\n"); + + + #line 28 "..\..\Views\Shared\_ExportFields.cshtml" + + + #line default + #line hidden + + #line 28 "..\..\Views\Shared\_ExportFields.cshtml" + foreach (var optionItem in optionFields.Take(itemsPerColumn)) + { + + + #line default + #line hidden +WriteLiteral(" (optionItem.Description + + #line default + #line hidden +, 1357), false) +); + +WriteLiteral(">\r\n (optionId + + #line default + #line hidden +, 1479), false) +); + +WriteAttribute("name", Tuple.Create(" name=\"", 1489), Tuple.Create("\"", 1546) +, Tuple.Create(Tuple.Create("", 1496), Tuple.Create("Options.", 1496), true) + + #line 31 "..\..\Views\Shared\_ExportFields.cshtml" + , Tuple.Create(Tuple.Create("", 1504), Tuple.Create(optionItem.CustomKey ?? optionItem.Name + + #line default + #line hidden +, 1504), false) +); + +WriteAttribute("value", Tuple.Create(" value=\"", 1547), Tuple.Create("\"", 1590) + + #line 31 "..\..\Views\Shared\_ExportFields.cshtml" + , Tuple.Create(Tuple.Create("", 1555), Tuple.Create(optionItem.CustomValue ?? "true" + + #line default + #line hidden +, 1555), false) +); + +WriteLiteral(" "); + + + #line 31 "..\..\Views\Shared\_ExportFields.cshtml" + Write(optionItem.IsDefault ? " data-default" : null); + + + #line default + #line hidden +WriteLiteral(" "); + + + #line 31 "..\..\Views\Shared\_ExportFields.cshtml" + Write((optionItem.IsChecked) ? " checked " : null); + + + #line default + #line hidden +WriteLiteral(" />(optionId + + #line default + #line hidden +, 1722), false) +); + +WriteLiteral(">"); + + + #line 31 "..\..\Views\Shared\_ExportFields.cshtml" + Write(optionItem.DisplayName); + + + #line default + #line hidden +WriteLiteral("\r\n \r\n"); + + + #line 33 "..\..\Views\Shared\_ExportFields.cshtml" + optionId++; + } + + + #line default + #line hidden +WriteLiteral(" \r\n \r" + +"\n \r\n \r\n"); + + + #line 39 "..\..\Views\Shared\_ExportFields.cshtml" + + + #line default + #line hidden + + #line 39 "..\..\Views\Shared\_ExportFields.cshtml" + foreach (var optionItem in optionFields.Skip(itemsPerColumn)) + { + + + #line default + #line hidden +WriteLiteral(" (optionItem.Description + + #line default + #line hidden +, 2313), false) +); + +WriteLiteral(">\r\n (optionId + + #line default + #line hidden +, 2435), false) +); + +WriteAttribute("name", Tuple.Create(" name=\"", 2445), Tuple.Create("\"", 2502) +, Tuple.Create(Tuple.Create("", 2452), Tuple.Create("Options.", 2452), true) + + #line 42 "..\..\Views\Shared\_ExportFields.cshtml" + , Tuple.Create(Tuple.Create("", 2460), Tuple.Create(optionItem.CustomKey ?? optionItem.Name + + #line default + #line hidden +, 2460), false) +); + +WriteAttribute("value", Tuple.Create(" value=\"", 2503), Tuple.Create("\"", 2546) + + #line 42 "..\..\Views\Shared\_ExportFields.cshtml" + , Tuple.Create(Tuple.Create("", 2511), Tuple.Create(optionItem.CustomValue ?? "true" + + #line default + #line hidden +, 2511), false) +); + +WriteLiteral(" "); + + + #line 42 "..\..\Views\Shared\_ExportFields.cshtml" + Write(optionItem.IsDefault ? " data-default" : null); + + + #line default + #line hidden +WriteLiteral(" "); + + + #line 42 "..\..\Views\Shared\_ExportFields.cshtml" + Write((optionItem.IsChecked) ? " checked " : null); + + + #line default + #line hidden +WriteLiteral(" />(optionId + + #line default + #line hidden +, 2678), false) +); + +WriteLiteral(">"); + + + #line 42 "..\..\Views\Shared\_ExportFields.cshtml" + Write(optionItem.DisplayName); + + + #line default + #line hidden +WriteLiteral("\r\n \r\n"); + + + #line 44 "..\..\Views\Shared\_ExportFields.cshtml" + optionId++; + } + + + #line default + #line hidden +WriteLiteral(" \r\n \r" + +"\n \r\n
\r\n \r\n \r\n
\r\n " + +"
\r\n \r\n \r\n"); + + + #line 53 "..\..\Views\Shared\_ExportFields.cshtml" + + } + + + #line default + #line hidden +WriteLiteral(@" +
+ +"); + + } + } +} +#pragma warning restore 1591 diff --git a/Disco.Web/Views/Shared/_Layout.cshtml b/Disco.Web/Views/Shared/_Layout.cshtml index 2d41b8f5..a536adbb 100644 --- a/Disco.Web/Views/Shared/_Layout.cshtml +++ b/Disco.Web/Views/Shared/_Layout.cshtml @@ -17,7 +17,7 @@
- +
\r\n