feature: user flag assignment exporting

This commit is contained in:
Gary Sharp
2023-11-11 20:04:52 +11:00
parent 143dc1b3e6
commit 53e57d4017
25 changed files with 1790 additions and 183 deletions
+3
View File
@@ -158,6 +158,8 @@
<Compile Include="Services\Searching\ISearchResultItem.cs" />
<Compile Include="Services\Searching\JobSearchResultItem.cs" />
<Compile Include="Services\Searching\UserSearchResultItem.cs" />
<Compile Include="Services\Users\UserFlags\UserFlagExportOptions.cs" />
<Compile Include="Services\Users\UserFlags\UserFlagExportRecord.cs" />
<Compile Include="UI\BaseUIModel.cs" />
<Compile Include="UI\Config\AuthorizationRole\ConfigAuthorizationRoleCreateModel.cs" />
<Compile Include="UI\Config\AuthorizationRole\ConfigAuthorizationRoleIndexModel.cs" />
@@ -199,6 +201,7 @@
<Compile Include="UI\Config\UserFlag\ConfigUserFlagCreateModel.cs" />
<Compile Include="UI\Config\UserFlag\ConfigUserFlagIndexModel.cs" />
<Compile Include="UI\Config\UserFlag\ConfigUserFlagShowModel.cs" />
<Compile Include="UI\Config\UserFlag\ConfigUserFlagExportModel.cs" />
<Compile Include="UI\Device\DeviceAddOfflineModel.cs" />
<Compile Include="UI\Device\DeviceExportModel.cs" />
<Compile Include="UI\Device\DeviceImportHeadersModel.cs" />
@@ -0,0 +1,77 @@
using Disco.Models.Exporting;
using Disco.Models.Services.Devices.Exporting;
using Disco.Models.Services.Exporting;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Disco.Models.Services.Users.UserFlags
{
public class UserFlagExportOptions : IExportOptions
{
public ExportFormat Format { get; set; }
public string FilenamePrefix { get; } = "DiscoUserFlagExport";
public string ExcelWorksheetName { get; } = "UserFlagExport";
public string ExcelTableName { get; } = "UserFlags";
[Required]
public List<int> UserFlagIds { get; set; } = new List<int>();
[DisplayAttribute(Name = "Current Only")]
public bool CurrentOnly { get; set; }
// User Flag
[Display(ShortName = "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")]
public bool Name { get; set; }
[Display(ShortName = "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")]
public bool Icon { get; set; }
[Display(ShortName = "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")]
public bool AssignmentId { get; set; }
[Display(ShortName = "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")]
public bool AddedUserId { get; set; }
[Display(ShortName = "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")]
public bool RemovedUserId { get; set; }
[Display(ShortName = "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")]
public bool UserId { get; set; }
[Display(ShortName = "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")]
public bool UserSurname { get; set; }
[Display(ShortName = "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")]
public bool UserPhoneNumber { get; set; }
[Display(ShortName = "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 static UserFlagExportOptions DefaultOptions()
{
return new UserFlagExportOptions()
{
Format = ExportFormat.Xlsx,
CurrentOnly = true,
Name = true,
AddedDate = true,
UserId = true,
UserDisplayName = true,
Comments = true,
};
}
}
}
@@ -0,0 +1,12 @@
using Disco.Models.Exporting;
using Disco.Models.Repository;
using System.Collections.Generic;
namespace Disco.Models.Services.Users.UserFlags
{
public class UserFlagExportRecord : IExportRecord
{
public UserFlagAssignment Assignment { get; set; }
public Dictionary<string, string> UserCustomDetails { get; set; }
}
}
@@ -0,0 +1,17 @@
using Disco.Models.Services.Exporting;
using Disco.Models.Services.Users.UserFlags;
using Disco.Models.UI;
using System.Collections.Generic;
namespace Disco.Models.Areas.Config.UI.UserFlag
{
public interface ConfigUserFlagExportModel : BaseUIModel
{
UserFlagExportOptions Options { get; set; }
string ExportSessionId { get; set; }
ExportResult ExportSessionResult { get; set; }
List<Repository.UserFlag> UserFlags { get; set; }
}
}