update: minor changes to document template bulk generation

This commit is contained in:
Gary Sharp
2025-09-07 12:06:23 +10:00
parent ca7193a8fc
commit 36c24542e1
8 changed files with 481 additions and 324 deletions
@@ -882,8 +882,9 @@ namespace Disco.Web.Areas.API.Controllers
results.Add(new BulkGenerateItemModel()
{
Id = user.UserId,
UserEmailAddress = user.EmailAddress,
UserId = user.UserId,
UserDisplayName = user.DisplayName,
UserEmailAddress = user.EmailAddress,
Scope = $"Matched '{dataId}'",
IsError = false,
});
@@ -912,6 +913,7 @@ namespace Disco.Web.Areas.API.Controllers
results.Add(new BulkGenerateItemModel()
{
Id = adUser.Id,
UserId = adUser.Id,
UserDisplayName = adUser.DisplayName,
UserEmailAddress = adUser.Email,
Scope = $"Group Member '{group.Name}'",
@@ -959,8 +961,9 @@ namespace Disco.Web.Areas.API.Controllers
results.Add(new BulkGenerateItemModel()
{
Id = assignment.DeviceSerialNumber,
UserEmailAddress = dbUser.EmailAddress,
UserId = dbUser.UserId,
UserDisplayName = dbUser.DisplayName,
UserEmailAddress = dbUser.EmailAddress,
Scope = $"Matched assigned user '{dataId}'",
IsError = false,
});
@@ -998,8 +1001,9 @@ namespace Disco.Web.Areas.API.Controllers
results.Add(new BulkGenerateItemModel()
{
Id = device.SerialNumber,
UserEmailAddress = user?.EmailAddress,
UserId = user?.UserId,
UserDisplayName = user?.DisplayName,
UserEmailAddress = user?.EmailAddress,
Scope = $"Matched '{deviceSerialNumber}'",
IsError = false,
});
@@ -1048,6 +1052,7 @@ namespace Disco.Web.Areas.API.Controllers
results.Add(new BulkGenerateItemModel()
{
Id = adUser.Id,
UserId = adUser.Id,
UserDisplayName = adUser.DisplayName,
UserEmailAddress = adUser.Email,
Scope = $"Group Member '{group.Name}'",
@@ -1060,6 +1065,7 @@ namespace Disco.Web.Areas.API.Controllers
results.Add(new BulkGenerateItemModel()
{
Id = user.Id,
UserId = user.Id,
UserDisplayName = user.DisplayName,
UserEmailAddress = user.Email,
Scope = $"Matched '{groupId}'",
@@ -1126,8 +1132,9 @@ namespace Disco.Web.Areas.API.Controllers
results.Add(new BulkGenerateItemModel()
{
Id = assignment.UserId,
UserEmailAddress = user?.EmailAddress,
UserId = user?.UserId,
UserDisplayName = user?.DisplayName,
UserEmailAddress = user?.EmailAddress,
Scope = $"Assigned User Flag '{flag.Name}'",
IsError = false,
});
@@ -1184,8 +1191,9 @@ namespace Disco.Web.Areas.API.Controllers
results.Add(new BulkGenerateItemModel()
{
Id = assignment.DeviceSerialNumber,
UserEmailAddress = user?.EmailAddress,
UserId = user?.UserId,
UserDisplayName = user?.DisplayName,
UserEmailAddress = user?.EmailAddress,
Scope = $"Assigned User Flag '{flag.Name}'",
IsError = false,
});
@@ -1250,6 +1258,7 @@ namespace Disco.Web.Areas.API.Controllers
results.Add(new BulkGenerateItemModel()
{
Id = user.UserId,
UserId = user.UserId,
UserDisplayName = user.DisplayName,
UserEmailAddress = user.EmailAddress,
Scope = $"Device Profile '{profile.Name}' Matches Assigned Device '{assignment.SerialNumber}'",
@@ -1284,6 +1293,7 @@ namespace Disco.Web.Areas.API.Controllers
results.Add(new BulkGenerateItemModel()
{
Id = device.SerialNumber,
UserId = user?.UserId,
UserDisplayName = user?.DisplayName,
UserEmailAddress = user?.EmailAddress,
Scope = $"Device Profile '{profile.Name}'",
@@ -1347,6 +1357,7 @@ namespace Disco.Web.Areas.API.Controllers
results.Add(new BulkGenerateItemModel()
{
Id = assignment.AssignedUserId,
UserId = user?.UserId,
UserDisplayName = user.DisplayName,
UserEmailAddress = user.EmailAddress,
Scope = $"Device Batch '{batch.Name}' Matches Assigned Device '{assignment.SerialNumber}'",
@@ -1380,6 +1391,7 @@ namespace Disco.Web.Areas.API.Controllers
results.Add(new BulkGenerateItemModel()
{
Id = device.SerialNumber,
UserId = user?.UserId,
UserDisplayName = user?.DisplayName,
UserEmailAddress = user?.EmailAddress,
Scope = $"Device Batch '{batch.Name}'",
@@ -1439,6 +1451,7 @@ namespace Disco.Web.Areas.API.Controllers
results.Add(new BulkGenerateItemModel()
{
Id = assignment.Device.AssignedUserId,
UserId = user.UserId,
UserDisplayName = user.DisplayName,
UserEmailAddress = user.EmailAddress,
Scope = $"Document Template '{template.Id}' Attachment Matches Assigned Device '{assignment.Device.SerialNumber}'",
@@ -1460,6 +1473,7 @@ namespace Disco.Web.Areas.API.Controllers
results.Add(new BulkGenerateItemModel()
{
Id = assignment.Job.UserId,
UserId = user.UserId,
UserDisplayName = user.DisplayName,
UserEmailAddress = user.EmailAddress,
Scope = $"Document Template '{template.Id}' Attachment Matches Job '{assignment.Job.Id}'",
@@ -1481,6 +1495,7 @@ namespace Disco.Web.Areas.API.Controllers
results.Add(new BulkGenerateItemModel()
{
Id = assignment.UserId,
UserId = user.UserId,
UserDisplayName = user.DisplayName,
UserEmailAddress = user.EmailAddress,
Scope = $"Document Template '{template.Id}' Attachment Matches User",
@@ -1542,6 +1557,7 @@ namespace Disco.Web.Areas.API.Controllers
results.Add(new BulkGenerateItemModel()
{
Id = assignment.DeviceSerialNumber,
UserId = user?.UserId,
UserDisplayName = user?.DisplayName,
UserEmailAddress = user?.EmailAddress,
Scope = $"Document Template '{template.Id}'",
@@ -1563,6 +1579,7 @@ namespace Disco.Web.Areas.API.Controllers
results.Add(new BulkGenerateItemModel()
{
Id = assignment.Job.DeviceSerialNumber,
UserId = user?.UserId,
UserDisplayName = user?.DisplayName,
UserEmailAddress = user?.EmailAddress,
Scope = $"Document Template '{template.Id}' Attachment Matches Job '{assignment.Job.Id}'",
@@ -1589,6 +1606,7 @@ namespace Disco.Web.Areas.API.Controllers
results.Add(new BulkGenerateItemModel()
{
Id = userDeviceAssignment.DeviceSerialNumber,
UserId = user.UserId,
UserDisplayName = user.DisplayName,
UserEmailAddress = user.EmailAddress,
Scope = $"Document Template '{template.Id}' Attachment Matches User '{user.UserId}'",
@@ -1688,6 +1706,7 @@ namespace Disco.Web.Areas.API.Controllers
results.Add(new BulkGenerateItemModel()
{
Id = user.UserId,
UserId = user.UserId,
UserDisplayName = user.DisplayName,
UserEmailAddress = user.EmailAddress,
Scope = $"User Detail '{key}'{(string.IsNullOrWhiteSpace(value) ? null : $" with the value '{value}'")} Matches User",
@@ -1727,6 +1746,7 @@ namespace Disco.Web.Areas.API.Controllers
results.Add(new BulkGenerateItemModel()
{
Id = assignment.DeviceSerialNumber,
UserId = user.UserId,
UserDisplayName = user.DisplayName,
UserEmailAddress = user.EmailAddress,
Scope = $"User Detail '{key}'{(string.IsNullOrWhiteSpace(value) ? null : $" with the value '{value}'")} Matches User '{user.UserId}'",
@@ -3,6 +3,7 @@
public class BulkGenerateItemModel
{
public string Id { get; set; }
public string UserId { get; set; }
public string UserEmailAddress { get; set; }
public string UserDisplayName { get; set; }
public string Scope { get; set; }
@@ -35,7 +35,7 @@
{
<button id="AddDocumentAttachment" class="button small">Add With Document Attachment</button>
}
<button id="AddUsers" class="button small">Add With Assigned User</button>
<button id="AddUsers" class="button small">Add With Assigned Users</button>
@if (Model.UserDetails.Any(b => b.Count > 0))
{
<button id="AddUserDetail" class="button small">Add With Assigned User Detail</button>
@@ -262,7 +262,7 @@ WriteLiteral(" id=\"AddUsers\"");
WriteLiteral(" class=\"button small\"");
WriteLiteral(">Add With Assigned User</button>\r\n");
WriteLiteral(">Add With Assigned Users</button>\r\n");
#line 39 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerateDevice.cshtml"
@@ -1,4 +1,4 @@
@model Disco.Web.Areas.Config.Models.DocumentTemplate.BulkGenerateModel
@model Disco.Models.UI.Config.DocumentTemplate.ConfigDocumentTemplateBulkGenerate
@using Disco.Services.Interop.ActiveDirectory;
@{
if (Model == null)
@@ -24,18 +24,18 @@
<div id="DocumentTemplate_BulkGenerate_Dialog_AddUsers" class="dialog dialog-bulk-generate" title="@(Model.DocumentTemplate.Description): Add by Users">
<div class="brief">
<div>
Enter multiple <span class="scopeDescBulkGenerate">User Ids</span> separated by <code>&lt;new line&gt;</code>, commas (<code>,</code>) or semicolons (<code>;</code>).
Enter multiple <span class="scopeDescBulkGenerate">User Ids</span> separated by <code>&lt;new line&gt;</code>, commas (<code>,</code>) or semicolons (<code>;</code>)
</div>
@if (userModel != null)
{
<div>
Security Groups can also be included. Members will be resolved and added.
Security Groups can also be included. Members will be resolved and added
</div>
}
@if (deviceModel != null)
{
<div>
Devices associated with the users will be added.
Devices associated with the users will be added
</div>
}
<div class="examples clearfix">
@@ -71,7 +71,7 @@
<div id="DocumentTemplate_BulkGenerate_Dialog_AddDevices" class="dialog dialog-bulk-generate" title="@(Model.DocumentTemplate.Description): Add by Devices">
<div class="brief">
<div>
Enter multiple <span class="scopeDescBulkGenerate">Device Serial Numbers</span> separated by <code>&lt;new line&gt;</code>, commas (<code>,</code>) or semicolons (<code>;</code>).
Enter multiple <span class="scopeDescBulkGenerate">Device Serial Numbers</span> separated by <code>&lt;new line&gt;</code>, commas (<code>,</code>) or semicolons (<code>;</code>)
</div>
<div class="examples clearfix">
<h4>Examples:</h4>
@@ -103,7 +103,7 @@
<div id="DocumentTemplate_BulkGenerate_Dialog_AddGroupMembers" class="dialog dialog-bulk-generate" title="@(Model.DocumentTemplate.Description): Add by Group Members">
<div class="brief">
<div>
Add all members of a group (including recursive members) to the bulk generation.
Add all members of a group (including recursive members)
</div>
</div>
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddGroupMembers()))
@@ -130,7 +130,7 @@
<div id="DocumentTemplate_BulkGenerate_Dialog_AddUserFlag" class="dialog dialog-bulk-generate" title="@(Model.DocumentTemplate.Description): Add User Flag">
<div class="brief">
<div>
Add all users associated with the flag to the bulk generation.
Add all users associated with the flag
</div>
</div>
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddUserFlag()))
@@ -155,7 +155,7 @@
<div id="DocumentTemplate_BulkGenerate_Dialog_AddDeviceFlag" class="dialog dialog-bulk-generate" title="@(Model.DocumentTemplate.Description): Add Device Flag">
<div class="brief">
<div>
Add all devices associated with the flag to the bulk generation.
Add all devices associated with the flag
</div>
</div>
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDeviceFlag()))
@@ -178,14 +178,20 @@
@if (Model.DeviceProfiles.Any(b => b.Count > 0))
{
<div id="DocumentTemplate_BulkGenerate_Dialog_AddDeviceProfile" class="dialog dialog-bulk-generate" title="@(Model.DocumentTemplate.Description): Add by Device Profile">
@if (userModel != null)
{
<div class="brief">
<div class="brief">
@if (userModel != null)
{
<div>
Add all users associated with a device in the selected profile to the bulk generation.
Add all users associated with a device in the selected profile
</div>
</div>
}
}
@if (deviceModel != null)
{
<div>
Add all devices in the selected profile
</div>
}
</div>
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDeviceProfile()))
{
<input name="deviceProfileId" type="hidden" required />
@@ -207,9 +213,18 @@
{
<div id="DocumentTemplate_BulkGenerate_Dialog_AddDeviceBatch" class="dialog dialog-bulk-generate" title="@(Model.DocumentTemplate.Description): Add by Device Batch">
<div class="brief">
<div>
Add all users associated with a device in the selected batch to the bulk generation.
</div>
@if (userModel != null)
{
<div>
Add all users associated with a device in the selected batch
</div>
}
@if (deviceModel != null)
{
<div>
Add all devices in the selected batch
</div>
})
</div>
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDeviceBatch()))
{
@@ -232,9 +247,18 @@
{
<div id="DocumentTemplate_BulkGenerate_Dialog_AddDocumentAttachment" class="dialog dialog-bulk-generate" title="@(Model.DocumentTemplate.Description): Add by Document Attachment">
<div class="brief">
<div>
Add all users associated with an attachment of the selected document template to the bulk generation.
</div>
@if (userModel != null)
{
<div>
Add all users associated with an attachment of the selected document template
</div>
}
@if (deviceModel != null)
{
<div>
Add all devices associated with an attachment of the selected document template
</div>
})
</div>
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDocumentAttachment()))
{
@@ -264,13 +288,13 @@
@if (userModel != null)
{
<div>
Add all users with a matching user detail to the bulk generation.
Add all users with a matching user detail
</div>
}
@if (deviceModel != null)
{
<div>
Add all devices assigned to users with a matching user detail to the bulk generation.
Add all devices assigned to users with a matching user detail
</div>
}
</div>
File diff suppressed because it is too large Load Diff
@@ -907,17 +907,17 @@ else
dataType: 'json',
url: url,
data: data,
complete: function (response, result) {
if (result != 'success') {
alert('Unable to change email settings:\nCheck logs for more information');
ajaxLoading.hide();
} else {
complete: function (response) {
if (response.status === 200) {
ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
if (!!$('#EmailSmtpServer').val()) {
testButton.removeAttr('disabled');
} else {
testButton.attr('disabled', 'disabled');
}
} else {
alert('Unable to change email settings:\nCheck logs for more information');
ajaxLoading.hide();
}
}
});
@@ -2753,46 +2753,46 @@ WriteLiteral("\';\r\n var data = {\r\n
" type: \'POST\',\r\n " +
" dataType: \'json\',\r\n url: url,\r\n " +
" data: data,\r\n complet" +
"e: function (response, result) {\r\n if (re" +
"sult != \'success\') {\r\n alert(\'Unable " +
"to change email settings:\\nCheck logs for more information\');\r\n " +
" ajaxLoading.hide();\r\n " +
" } else {\r\n ajaxLoading.hide()" +
"e: function (response) {\r\n if (response.s" +
"tatus === 200) {\r\n ajaxLoading.hide()" +
".next(\'.ajaxOk\').show().delay(\'fast\').fadeOut(\'slow\');\r\n " +
" if (!!$(\'#EmailSmtpServer\').val()) {\r\n " +
" testButton.removeAttr(\'disabled\');\r\n " +
" } else {\r\n " +
" testButton.attr(\'disabled\', \'disabled\');\r\n " +
" }\r\n }\r\n " +
" }\r\n });\r\n " +
"});\r\n\r\n testButton.closest(\'table\').find(\'td>input\')." +
"change(function () {\r\n testButton.attr(\'disabled\'" +
", \'disabled\');\r\n });\r\n tes" +
"tButton.click(function () {\r\n if (!testDialog) {\r" +
"\n testDialog = $(\'#Config_System_Email_Test_D" +
"ialog\')\r\n .dialog({\r\n " +
" resizable: false,\r\n " +
" height: 180,\r\n modal: true,\r\n " +
" autoOpen: false,\r\n " +
" buttons: {\r\n " +
" Send: function () {\r\n va" +
"r $this = $(this);\r\n var reci" +
"pientInput = $(\'#Config_System_Email_Test_Recipient\');\r\n " +
" if (!!recipientInput.val()) {\r\n " +
" $this.dialog(\"disable\");\r\n " +
" $this.dialog(\"option\", \"buttons\", null);\r\n " +
" recipientInput.closest(\'f" +
"orm\').submit()\r\n } else {\r\n " +
" alert(\'Enter the recipient" +
" address for the test email\');\r\n " +
" }\r\n },\r\n " +
" Cancel: function () {\r\n " +
" $(this).dialog(\"close\");\r\n " +
" }\r\n }\r\n " +
" });\r\n }\r\n " +
" testDialog.dialog(\'open\');\r\n });\r\n\r" +
"\n });\r\n </script>\r\n </t" +
"d>\r\n </tr>\r\n </table>\r\n </div>\r\n");
" }\r\n } else {\r\n " +
" alert(\'Unable to change email settings:\\nCheck logs f" +
"or more information\');\r\n ajaxLoading." +
"hide();\r\n }\r\n " +
" }\r\n });\r\n });\r" +
"\n\r\n testButton.closest(\'table\').find(\'td>input\').chan" +
"ge(function () {\r\n testButton.attr(\'disabled\', \'d" +
"isabled\');\r\n });\r\n testBut" +
"ton.click(function () {\r\n if (!testDialog) {\r\n " +
" testDialog = $(\'#Config_System_Email_Test_Dialo" +
"g\')\r\n .dialog({\r\n " +
" resizable: false,\r\n " +
" height: 180,\r\n modal: true,\r\n " +
" autoOpen: false,\r\n " +
" buttons: {\r\n " +
" Send: function () {\r\n var $t" +
"his = $(this);\r\n var recipien" +
"tInput = $(\'#Config_System_Email_Test_Recipient\');\r\n " +
" if (!!recipientInput.val()) {\r\n " +
" $this.dialog(\"disable\");\r\n " +
" $this.dialog(\"option\", \"buttons\", null);\r\n " +
" recipientInput.closest(\'form\'" +
").submit()\r\n } else {\r\n " +
" alert(\'Enter the recipient add" +
"ress for the test email\');\r\n " +
"}\r\n },\r\n " +
" Cancel: function () {\r\n " +
" $(this).dialog(\"close\");\r\n " +
" }\r\n }\r\n " +
" });\r\n }\r\n " +
" testDialog.dialog(\'open\');\r\n });\r\n\r\n " +
" });\r\n </script>\r\n </td>\r\n" +
" </tr>\r\n </table>\r\n </div>\r\n");
#line 964 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"