feature: user details are individually exported; shared export field renderer
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user