security: use more antiforgery tokens
This commit is contained in:
@@ -4,10 +4,8 @@
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Job Queues", MVC.Config.JobQueue.Index(null), "Create");
|
||||
}
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.HiddenFor(m => m.JobQueue.Icon)
|
||||
@Html.HiddenFor(m => m.JobQueue.IconColour)
|
||||
@Html.HiddenFor(m => m.JobQueue.Priority)
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
<div class="form" style="width: 450px">
|
||||
<table>
|
||||
<tr>
|
||||
@@ -15,7 +13,7 @@
|
||||
Name:
|
||||
</th>
|
||||
<td>
|
||||
@Html.EditorFor(model => model.JobQueue.Name)<br />@Html.ValidationMessageFor(model => model.JobQueue.Name)
|
||||
@Html.EditorFor(model => model.Name)<br />@Html.ValidationMessageFor(model => model.Name)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -23,7 +21,7 @@
|
||||
Description:
|
||||
</th>
|
||||
<td>
|
||||
@Html.EditorFor(model => model.JobQueue.Description)<br />@Html.ValidationMessageFor(model => model.JobQueue.Description)
|
||||
@Html.EditorFor(model => model.Description)<br />@Html.ValidationMessageFor(model => model.Description)
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -33,7 +31,7 @@
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$('#JobQueue_Name').focus().select();
|
||||
$('#Name').focus().select();
|
||||
});
|
||||
</script>
|
||||
}
|
||||
@@ -57,49 +57,21 @@ WriteLiteral("\r\n");
|
||||
|
||||
#line 6 "..\..\Areas\Config\Views\JobQueue\Create.cshtml"
|
||||
using (Html.BeginForm())
|
||||
{
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 8 "..\..\Areas\Config\Views\JobQueue\Create.cshtml"
|
||||
Write(Html.HiddenFor(m => m.JobQueue.Icon));
|
||||
Write(Html.AntiForgeryToken());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 8 "..\..\Areas\Config\Views\JobQueue\Create.cshtml"
|
||||
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 9 "..\..\Areas\Config\Views\JobQueue\Create.cshtml"
|
||||
Write(Html.HiddenFor(m => m.JobQueue.IconColour));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 9 "..\..\Areas\Config\Views\JobQueue\Create.cshtml"
|
||||
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 10 "..\..\Areas\Config\Views\JobQueue\Create.cshtml"
|
||||
Write(Html.HiddenFor(m => m.JobQueue.Priority));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 10 "..\..\Areas\Config\Views\JobQueue\Create.cshtml"
|
||||
|
||||
|
||||
|
||||
|
||||
#line default
|
||||
@@ -116,8 +88,8 @@ WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 18 "..\..\Areas\Config\Views\JobQueue\Create.cshtml"
|
||||
Write(Html.EditorFor(model => model.JobQueue.Name));
|
||||
#line 16 "..\..\Areas\Config\Views\JobQueue\Create.cshtml"
|
||||
Write(Html.EditorFor(model => model.Name));
|
||||
|
||||
|
||||
#line default
|
||||
@@ -125,8 +97,8 @@ WriteLiteral(" ");
|
||||
WriteLiteral("<br />");
|
||||
|
||||
|
||||
#line 18 "..\..\Areas\Config\Views\JobQueue\Create.cshtml"
|
||||
Write(Html.ValidationMessageFor(model => model.JobQueue.Name));
|
||||
#line 16 "..\..\Areas\Config\Views\JobQueue\Create.cshtml"
|
||||
Write(Html.ValidationMessageFor(model => model.Name));
|
||||
|
||||
|
||||
#line default
|
||||
@@ -138,8 +110,8 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 26 "..\..\Areas\Config\Views\JobQueue\Create.cshtml"
|
||||
Write(Html.EditorFor(model => model.JobQueue.Description));
|
||||
#line 24 "..\..\Areas\Config\Views\JobQueue\Create.cshtml"
|
||||
Write(Html.EditorFor(model => model.Description));
|
||||
|
||||
|
||||
#line default
|
||||
@@ -147,8 +119,8 @@ WriteLiteral(" ");
|
||||
WriteLiteral("<br />");
|
||||
|
||||
|
||||
#line 26 "..\..\Areas\Config\Views\JobQueue\Create.cshtml"
|
||||
Write(Html.ValidationMessageFor(model => model.JobQueue.Description));
|
||||
#line 24 "..\..\Areas\Config\Views\JobQueue\Create.cshtml"
|
||||
Write(Html.ValidationMessageFor(model => model.Description));
|
||||
|
||||
|
||||
#line default
|
||||
@@ -171,11 +143,11 @@ WriteLiteral(" <script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(">\r\n $(function () {\r\n $(\'#JobQueue_Name\').focus().select();\r\n " +
|
||||
" });\r\n </script>\r\n");
|
||||
WriteLiteral(">\r\n $(function () {\r\n $(\'#Name\').focus().select();\r\n });" +
|
||||
"\r\n </script>\r\n");
|
||||
|
||||
|
||||
#line 39 "..\..\Areas\Config\Views\JobQueue\Create.cshtml"
|
||||
#line 37 "..\..\Areas\Config\Views\JobQueue\Create.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</th>
|
||||
<td>
|
||||
@if (canConfig)
|
||||
{@Html.EditorFor(model => model.Token.JobQueue.Name)
|
||||
{@Html.EditorFor(model => model.Token.JobQueue.Name)
|
||||
@AjaxHelpers.AjaxSave()
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script type="text/javascript">
|
||||
@@ -45,18 +45,18 @@
|
||||
{
|
||||
@Model.Token.JobQueue.Name
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Description:
|
||||
</th>
|
||||
<td>
|
||||
@if (canConfig)
|
||||
{@Html.EditorFor(model => model.Token.JobQueue.Description)
|
||||
@AjaxHelpers.AjaxSave()
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script type="text/javascript">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Description:
|
||||
</th>
|
||||
<td>
|
||||
@if (canConfig)
|
||||
{@Html.EditorFor(model => model.Token.JobQueue.Description)
|
||||
@AjaxHelpers.AjaxSave()
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
document.DiscoFunctions.PropertyChangeHelper(
|
||||
$('#Token_JobQueue_Description'),
|
||||
@@ -65,11 +65,11 @@
|
||||
'Description'
|
||||
);
|
||||
});
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
<pre>@if (string.IsNullOrEmpty(Model.Token.JobQueue.Description))
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
<pre>@if (string.IsNullOrEmpty(Model.Token.JobQueue.Description))
|
||||
{
|
||||
<text><None></text>
|
||||
}
|
||||
@@ -78,139 +78,140 @@
|
||||
@Model.Token.JobQueue.Description.ToHtmlComment()
|
||||
}
|
||||
</pre>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Statistics:
|
||||
</th>
|
||||
<td>
|
||||
<div><strong>@Model.OpenJobCount job@(Model.OpenJobCount != 1 ? "s" : null) open</strong></div>
|
||||
<div>@Model.TotalJobCount total job@(Model.TotalJobCount != 1 ? "s" : null)</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Icon:
|
||||
</th>
|
||||
<td>
|
||||
<i id="Config_JobQueues_Icon" data-icon="@(Model.Token.JobQueue.Icon)" data-colour="@(Model.Token.JobQueue.IconColour)" class="fa fa-@(Model.Token.JobQueue.Icon) fa-4x d-@(Model.Token.JobQueue.IconColour)"></i>
|
||||
@if (canConfig)
|
||||
{
|
||||
<div>
|
||||
<a id="Config_JobQueues_Icon_Update" href="#" class="button small">Update</a>
|
||||
<div id="Config_JobQueues_Icon_Update_Dialog" class="dialog" title="Job Queue Icon">
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Statistics:
|
||||
</th>
|
||||
<td>
|
||||
<div><strong>@Model.OpenJobCount job@(Model.OpenJobCount != 1 ? "s" : null) open</strong></div>
|
||||
<div>@Model.TotalJobCount total job@(Model.TotalJobCount != 1 ? "s" : null)</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Icon:
|
||||
</th>
|
||||
<td>
|
||||
<i id="Config_JobQueues_Icon" data-icon="@(Model.Token.JobQueue.Icon)" data-colour="@(Model.Token.JobQueue.IconColour)" class="fa fa-@(Model.Token.JobQueue.Icon) fa-4x d-@(Model.Token.JobQueue.IconColour)"></i>
|
||||
@if (canConfig)
|
||||
{
|
||||
<div>
|
||||
<div class="icons">
|
||||
@foreach (var icon in Model.Icons)
|
||||
<a id="Config_JobQueues_Icon_Update" href="#" class="button small">Update</a>
|
||||
<div id="Config_JobQueues_Icon_Update_Dialog" class="dialog" title="Job Queue Icon">
|
||||
@using (Html.BeginForm(MVC.API.JobQueue.UpdateIconAndColour(id: Model.Token.JobQueue.Id, redirect: true)))
|
||||
{
|
||||
<i data-icon="@(icon.Key)" class="fa fa-@(icon.Key)" title="@icon.Value"></i>
|
||||
@Html.AntiForgeryToken()
|
||||
<input type="hidden" name="icon" />
|
||||
<input type="hidden" name="iconColour" />
|
||||
}
|
||||
</div>
|
||||
<div class="colours">
|
||||
@foreach (var colour in Model.ThemeColours)
|
||||
{
|
||||
<i data-colour="@(colour.Key)" class="fa fa-square d-@(colour.Key)" title="@colour.Value"></i>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function () {
|
||||
var dialog, icon, colours, icons;
|
||||
|
||||
function showDialog() {
|
||||
if (!dialog) {
|
||||
dialog = $('#Config_JobQueues_Icon_Update_Dialog').dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
width: 780,
|
||||
height: 540,
|
||||
buttons: {
|
||||
"Save": save,
|
||||
Cancel: cancel
|
||||
<div>
|
||||
<div class="colours">
|
||||
@foreach (var colour in Model.ThemeColours)
|
||||
{
|
||||
<i data-colour="@(colour.Key)" class="fa fa-square d-@(colour.Key)" title="@colour.Value"></i>
|
||||
}
|
||||
</div>
|
||||
<div class="icons">
|
||||
@foreach (var icon in Model.Icons)
|
||||
{
|
||||
<i data-icon="@(icon.Key)" class="fa fa-@(icon.Key)" title="@icon.Value"></i>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function () {
|
||||
var dialog, icon, colours, icons;
|
||||
|
||||
function showDialog() {
|
||||
if (!dialog) {
|
||||
dialog = $('#Config_JobQueues_Icon_Update_Dialog').dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
width: 1000,
|
||||
buttons: {
|
||||
"Save": save,
|
||||
Cancel: cancel
|
||||
}
|
||||
});
|
||||
|
||||
colours = dialog.find('.colours');
|
||||
icons = dialog.find('.icons');
|
||||
|
||||
colours.on('click', 'i', selectColour);
|
||||
icons.on('click', 'i', selectIcon);
|
||||
}
|
||||
|
||||
colours.find('i[data-colour="' + icon.attr('data-colour') + '"]').each(selectColour);
|
||||
icons.find('i[data-icon="' + icon.attr('data-icon') + '"]').each(selectIcon);
|
||||
|
||||
dialog.dialog('open');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function selectColour() {
|
||||
var $this = $(this),
|
||||
colourCode = $this.attr('data-colour'),
|
||||
previousColourCode = icons.attr('data-colour');
|
||||
|
||||
|
||||
colours.find('i').removeClass('selected fa-check-square').addClass('fa-square');
|
||||
$this.removeClass('fa-square').addClass('fa-check-square selected');
|
||||
|
||||
if (previousColourCode)
|
||||
icons.removeClass('d-' + previousColourCode);
|
||||
icons.attr('data-colour', colourCode)
|
||||
icons.addClass('d-' + colourCode);
|
||||
}
|
||||
function selectIcon() {
|
||||
var $this = $(this),
|
||||
iconCode = $this.attr('data-icon');
|
||||
|
||||
icons.find('i').removeClass('selected');
|
||||
$this.addClass('selected');
|
||||
}
|
||||
|
||||
function save() {
|
||||
const $form = dialog.find('form');
|
||||
$form.find('input[name="icon"]').val(icons.find('i.selected').attr('data-icon'));
|
||||
$form.find('input[name="iconColour"]').val(colours.find('i.selected').attr('data-colour'));
|
||||
$form.trigger('submit');
|
||||
dialog.dialog("option", "buttons", null);
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
|
||||
$(function () {
|
||||
icon = $('#Config_JobQueues_Icon');
|
||||
$('#Config_JobQueues_Icon_Update').click(showDialog);
|
||||
});
|
||||
|
||||
colours = dialog.find('.colours');
|
||||
icons = dialog.find('.icons');
|
||||
|
||||
colours.on('click', 'i', selectColour);
|
||||
icons.on('click', 'i', selectIcon);
|
||||
}
|
||||
|
||||
colours.find('i[data-colour="' + icon.attr('data-colour') + '"]').each(selectColour);
|
||||
icons.find('i[data-icon="' + icon.attr('data-icon') + '"]').each(selectIcon);
|
||||
|
||||
dialog.dialog('open');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function selectColour() {
|
||||
var $this = $(this),
|
||||
colourCode = $this.attr('data-colour'),
|
||||
previousColourCode = icons.attr('data-colour');
|
||||
|
||||
|
||||
colours.find('i').removeClass('selected fa-check-square').addClass('fa-square');
|
||||
$this.removeClass('fa-square').addClass('fa-check-square selected');
|
||||
|
||||
if (previousColourCode)
|
||||
icons.removeClass('d-' + previousColourCode);
|
||||
icons.attr('data-colour', colourCode)
|
||||
icons.addClass('d-' + colourCode);
|
||||
}
|
||||
function selectIcon() {
|
||||
var $this = $(this),
|
||||
iconCode = $this.attr('data-icon');
|
||||
|
||||
icons.find('i').removeClass('selected');
|
||||
$this.addClass('selected');
|
||||
}
|
||||
|
||||
function save() {
|
||||
var url = '@(Url.Action(MVC.API.JobQueue.UpdateIconAndColour(id: Model.Token.JobQueue.Id, redirect: true)))',
|
||||
data = {
|
||||
Icon: icons.find('i.selected').attr('data-icon'),
|
||||
IconColour: colours.find('i.selected').attr('data-colour')
|
||||
};
|
||||
window.location.href = url + '&' + $.param(data);
|
||||
|
||||
dialog.dialog("disable");
|
||||
dialog.dialog("option", "buttons", null);
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
|
||||
$(function () {
|
||||
icon = $('#Config_JobQueues_Icon');
|
||||
$('#Config_JobQueues_Icon_Update').click(showDialog);
|
||||
});
|
||||
}());
|
||||
</script>
|
||||
</div>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Priority:
|
||||
</th>
|
||||
<td>
|
||||
@if (canConfig)
|
||||
{
|
||||
var priorityValue = Model.Token.JobQueue.Priority.ToString();
|
||||
var priorityItems = Enum.GetNames(typeof(JobQueuePriority)).Select(i => new SelectListItem() { Text = i, Value = i, Selected = (i == priorityValue) }).ToList();
|
||||
<i class="fa d-priority-@(priorityValue.ToLower())" title="@(priorityValue) Priority"></i>
|
||||
@Html.DropDownListFor(m => m.Token.JobQueue.Priority, priorityItems)
|
||||
@AjaxHelpers.AjaxSave()
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script type="text/javascript">
|
||||
}());
|
||||
</script>
|
||||
</div>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Priority:
|
||||
</th>
|
||||
<td>
|
||||
@if (canConfig)
|
||||
{
|
||||
var priorityValue = Model.Token.JobQueue.Priority.ToString();
|
||||
var priorityItems = Enum.GetNames(typeof(JobQueuePriority)).Select(i => new SelectListItem() { Text = i, Value = i, Selected = (i == priorityValue) }).ToList();
|
||||
<i class="fa d-priority-@(priorityValue.ToLower())" title="@(priorityValue) Priority"></i>
|
||||
@Html.DropDownListFor(m => m.Token.JobQueue.Priority, priorityItems)
|
||||
@AjaxHelpers.AjaxSave()
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var element = $('#Token_JobQueue_Priority');
|
||||
|
||||
@@ -227,47 +228,47 @@
|
||||
icon.addClass('fa d-priority-' + element.val().toLowerCase()).attr('title', element.val() + ' Priority');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
@Model.Token.JobQueue.Priority.ToString()
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Default SLA:
|
||||
</th>
|
||||
<td>
|
||||
@if (canConfig)
|
||||
{
|
||||
var slaOptions = JobQueueService.SlaOptions.Select(o => new SelectListItem() { Text = o.Value, Value = o.Key.ToString() }).ToList();
|
||||
|
||||
if (this.Model.Token.JobQueue.DefaultSLAExpiry.HasValue)
|
||||
{
|
||||
var slaValue = this.Model.Token.JobQueue.DefaultSLAExpiry.Value;
|
||||
if (JobQueueService.SlaOptions.Where(o => o.Key == slaValue).Count() == 0)
|
||||
{
|
||||
string slaValueText;
|
||||
if (slaValue % (60 * 24 * 7 * 4) == 0)
|
||||
{ slaValueText = string.Format("{0} months", slaValue / (60 * 24 * 7 * 4)); }
|
||||
else if (slaValue % (60 * 24 * 7) == 0)
|
||||
{ slaValueText = string.Format("{0} weeks", slaValue / (60 * 24 * 7)); }
|
||||
else if (slaValue % (60 * 24) == 0)
|
||||
{ slaValueText = string.Format("{0} days", slaValue / (60 * 24)); }
|
||||
else if (slaValue % (60) == 0)
|
||||
{ slaValueText = string.Format("{0} hours", slaValue / 60); }
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{ slaValueText = string.Format("{0} minutes", slaValue); }
|
||||
{
|
||||
@Model.Token.JobQueue.Priority.ToString()
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Default SLA:
|
||||
</th>
|
||||
<td>
|
||||
@if (canConfig)
|
||||
{
|
||||
var slaOptions = JobQueueService.SlaOptions.Select(o => new SelectListItem() { Text = o.Value, Value = o.Key.ToString() }).ToList();
|
||||
|
||||
slaOptions.Insert(0, new SelectListItem() { Text = string.Format("{0} <Custom>", slaValueText), Value = slaValue.ToString() });
|
||||
}
|
||||
}
|
||||
@Html.DropDownListFor(m => m.Token.JobQueue.DefaultSLAExpiry, slaOptions)
|
||||
@AjaxHelpers.AjaxSave()
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script type="text/javascript">
|
||||
if (this.Model.Token.JobQueue.DefaultSLAExpiry.HasValue)
|
||||
{
|
||||
var slaValue = this.Model.Token.JobQueue.DefaultSLAExpiry.Value;
|
||||
if (JobQueueService.SlaOptions.Where(o => o.Key == slaValue).Count() == 0)
|
||||
{
|
||||
string slaValueText;
|
||||
if (slaValue % (60 * 24 * 7 * 4) == 0)
|
||||
{ slaValueText = string.Format("{0} months", slaValue / (60 * 24 * 7 * 4)); }
|
||||
else if (slaValue % (60 * 24 * 7) == 0)
|
||||
{ slaValueText = string.Format("{0} weeks", slaValue / (60 * 24 * 7)); }
|
||||
else if (slaValue % (60 * 24) == 0)
|
||||
{ slaValueText = string.Format("{0} days", slaValue / (60 * 24)); }
|
||||
else if (slaValue % (60) == 0)
|
||||
{ slaValueText = string.Format("{0} hours", slaValue / 60); }
|
||||
else
|
||||
{ slaValueText = string.Format("{0} minutes", slaValue); }
|
||||
|
||||
slaOptions.Insert(0, new SelectListItem() { Text = string.Format("{0} <Custom>", slaValueText), Value = slaValue.ToString() });
|
||||
}
|
||||
}
|
||||
@Html.DropDownListFor(m => m.Token.JobQueue.DefaultSLAExpiry, slaOptions)
|
||||
@AjaxHelpers.AjaxSave()
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
document.DiscoFunctions.PropertyChangeHelper(
|
||||
$('#Token_JobQueue_DefaultSLAExpiry'),
|
||||
@@ -276,89 +277,93 @@
|
||||
'DefaultSLAExpiry'
|
||||
);
|
||||
});
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.Model.Token.JobQueue.DefaultSLAExpiry.HasValue)
|
||||
{
|
||||
var slaValue = this.Model.Token.JobQueue.DefaultSLAExpiry.Value;
|
||||
var slaOption = JobQueueService.SlaOptions.Where(o => o.Key == slaValue).ToArray();
|
||||
if (slaOption.Length > 0)
|
||||
{
|
||||
@slaOption[0].Value
|
||||
}
|
||||
else
|
||||
{
|
||||
<text><None></text>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<text><None></text>
|
||||
}
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Member Groups/Users:</th>
|
||||
<td>
|
||||
@if (Model.Token.SubjectIds.Count == 0)
|
||||
{
|
||||
<span class="smallMessage">None Associated</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ul id="Config_JobQueues_Subjects" class="none">
|
||||
@foreach (var sg in Model.Subjects)
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
var displayName = sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id);
|
||||
<li class="@(sg.IsGroup ? "group" : "user")">
|
||||
@if (sg.IsGroup)
|
||||
if (this.Model.Token.JobQueue.DefaultSLAExpiry.HasValue)
|
||||
{
|
||||
<i class="fa fa-users fa-lg"></i>@displayName
|
||||
var slaValue = this.Model.Token.JobQueue.DefaultSLAExpiry.Value;
|
||||
var slaOption = JobQueueService.SlaOptions.Where(o => o.Key == slaValue).ToArray();
|
||||
if (slaOption.Length > 0)
|
||||
{
|
||||
@slaOption[0].Value
|
||||
}
|
||||
else
|
||||
{
|
||||
<text><None></text>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<a href="@(Url.Action(MVC.User.Show(sg.Id)))"><i class="fa fa-user fa-lg"></i>@displayName</a>
|
||||
<text><None></text>
|
||||
}
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
@if (canConfig)
|
||||
{
|
||||
<div>
|
||||
<a id="Config_JobQueues_Subjects_Update" href="#" class="button small">Update</a>
|
||||
<div id="Config_JobQueues_Subjects_Update_Dialog" class="dialog" title="Job Queue Member Groups/Users">
|
||||
<div id="Config_JobQueues_Subjects_Update_Dialog_ListContainer">
|
||||
<span id="Config_JobQueues_Subjects_Update_Dialog_None" class="smallMessage">None Associated</span>
|
||||
<ul id="Config_JobQueues_Subjects_Update_Dialog_List" class="none">
|
||||
@foreach (var sg in Model.Subjects)
|
||||
{
|
||||
var displayName = sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id);
|
||||
<li class="@(sg.IsGroup ? "group" : "user")" data-subjectid="@sg.Id">
|
||||
@if (sg.IsGroup)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Member Groups/Users:</th>
|
||||
<td>
|
||||
@if (Model.Token.SubjectIds.Count == 0)
|
||||
{
|
||||
<span class="smallMessage">None Associated</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ul id="Config_JobQueues_Subjects" class="none">
|
||||
@foreach (var sg in Model.Subjects)
|
||||
{
|
||||
var displayName = sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id);
|
||||
<li class="@(sg.IsGroup ? "group" : "user")">
|
||||
@if (sg.IsGroup)
|
||||
{
|
||||
<i class="fa fa-users fa-lg"></i>@displayName
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="fa fa-user fa-lg"></i>@displayName
|
||||
}<i class="fa fa-times-circle remove"></i>
|
||||
<a href="@(Url.Action(MVC.User.Show(sg.Id)))"><i class="fa fa-user fa-lg"></i>@displayName</a>
|
||||
}
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
@if (canConfig)
|
||||
{
|
||||
<div>
|
||||
<a id="Config_JobQueues_Subjects_Update" href="#" class="button small">Update</a>
|
||||
<div id="Config_JobQueues_Subjects_Update_Dialog" class="dialog" title="Job Queue Member Groups/Users">
|
||||
@using (Html.BeginForm(MVC.API.JobQueue.UpdateSubjects(Model.Token.JobQueue.Id, null, true)))
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
<div id="Config_JobQueues_Subjects_Update_Dialog_ListContainer">
|
||||
<span id="Config_JobQueues_Subjects_Update_Dialog_None" class="smallMessage">None Associated</span>
|
||||
<ul id="Config_JobQueues_Subjects_Update_Dialog_List" class="none">
|
||||
@foreach (var sg in Model.Subjects)
|
||||
{
|
||||
var displayName = sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id);
|
||||
<li class="@(sg.IsGroup ? "group" : "user")" data-subjectid="@sg.Id">
|
||||
<input type="hidden" name="subjects" value="@sg.Id" />
|
||||
@if (sg.IsGroup)
|
||||
{
|
||||
<i class="fa fa-users fa-lg"></i>@displayName
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="fa fa-user fa-lg"></i>@displayName
|
||||
}<i class="fa fa-times-circle remove"></i>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
<div id="Config_JobQueues_Subjects_Update_Dialog_AddContainer">
|
||||
<input type="text" id="Config_JobQueues_Subjects_Update_Dialog_TextAdd" />
|
||||
<a id="Config_JobQueues_Subjects_Update_Dialog_Add" href="#" class="button small">Add</a>
|
||||
</div>
|
||||
<form id="Config_JobQueues_Subjects_Update_Dialog_Form" action="@(Url.Action(MVC.API.JobQueue.UpdateSubjects(Model.Token.JobQueue.Id, null, true)))" method="post"></form>
|
||||
</div>
|
||||
<script>
|
||||
<div id="Config_JobQueues_Subjects_Update_Dialog_AddContainer">
|
||||
<input type="text" id="Config_JobQueues_Subjects_Update_Dialog_TextAdd" />
|
||||
<a id="Config_JobQueues_Subjects_Update_Dialog_Add" href="#" class="button small">Add</a>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function () {
|
||||
var dialog, textAdd, list, noSubjects, form;
|
||||
var dialog, textAdd, list, originalList, noSubjects, form;
|
||||
|
||||
function showDialog() {
|
||||
if (!dialog) {
|
||||
@@ -367,7 +372,6 @@
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
width: 350,
|
||||
height: 420,
|
||||
buttons: {
|
||||
"Save Changes": saveChanges,
|
||||
Cancel: cancel
|
||||
@@ -377,6 +381,7 @@
|
||||
dialog.on('click', '.remove', remove);
|
||||
|
||||
list = $('#Config_JobQueues_Subjects_Update_Dialog_List');
|
||||
originalList = list.html();
|
||||
noSubjects = $('#Config_JobQueues_Subjects_Update_Dialog_None');
|
||||
|
||||
textAdd = $('#Config_JobQueues_Subjects_Update_Dialog_TextAdd');
|
||||
@@ -412,27 +417,11 @@
|
||||
function cancel() {
|
||||
$(this).dialog("close");
|
||||
|
||||
list.find('li').each(function () {
|
||||
$this = $(this);
|
||||
if ($this.is('[data-subjectstatus="new"]')) {
|
||||
$this.remove();
|
||||
} else {
|
||||
if ($this.is('[data-subjectstatus="removed"]')) {
|
||||
$this.show();
|
||||
$this.attr('data-status', '')
|
||||
}
|
||||
}
|
||||
});
|
||||
list.html(originalList);
|
||||
}
|
||||
|
||||
function remove() {
|
||||
$this = $(this).closest('li');
|
||||
|
||||
if ($this.is('[data-subjectstatus="new"]')) {
|
||||
$this.remove();
|
||||
} else {
|
||||
$this.attr('data-subjectstatus', 'removed').hide();
|
||||
}
|
||||
$(this).closest('li').remove();
|
||||
|
||||
updateNoSubjects();
|
||||
|
||||
@@ -450,7 +439,7 @@
|
||||
}).done(function (response) {
|
||||
if (response) {
|
||||
if (response.IsGroup || response.IsUserAccount) {
|
||||
if (list.find('li[data-subjectid="' + response.Id + '"]').filter('[data-status!="removed"]').length == 0) {
|
||||
if (list.find('li[data-subjectid="' + response.Id + '"]').length == 0) {
|
||||
|
||||
var liIcon = $('<i>').addClass('fa fa-lg');
|
||||
if (response.Type === 'user')
|
||||
@@ -459,6 +448,7 @@
|
||||
liIcon.addClass('fa-users');
|
||||
|
||||
var li = $('<li>')
|
||||
.append($('<input>').attr({ type: 'hidden', name: 'subjects', value: response.Id }))
|
||||
.append(liIcon)
|
||||
.append($('<span>').text(response.Id == response.Name ? response.Id : response.Name + ' [' + response.Id + ']'))
|
||||
.append($('<i>').addClass('fa fa-times-circle remove'))
|
||||
@@ -493,73 +483,60 @@
|
||||
}
|
||||
|
||||
function saveChanges() {
|
||||
var form = $('#Config_JobQueues_Subjects_Update_Dialog_Form').empty();
|
||||
|
||||
list.find('li[data-subjectstatus!="removed"]').each(function () {
|
||||
var subjectId = $(this).attr('data-subjectid');
|
||||
|
||||
form.append($('<input>').attr({
|
||||
'name': 'Subjects',
|
||||
'type': 'hidden'
|
||||
}).val(subjectId));
|
||||
|
||||
}).get();
|
||||
|
||||
form.submit();
|
||||
|
||||
dialog.dialog("disable");
|
||||
dialog.find('form').trigger('submit');
|
||||
dialog.dialog("option", "buttons", null);
|
||||
}
|
||||
|
||||
$(function () {
|
||||
$('#Config_JobQueues_Subjects_Update').click(showDialog);
|
||||
$('#Config_JobQueues_Subjects_Update').on('click', showDialog);
|
||||
});
|
||||
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Automatically Add Jobs:</th>
|
||||
<td>
|
||||
<div>
|
||||
@if (Model.Token.JobQueue.JobSubTypes.Count > 0)
|
||||
{
|
||||
<ul>
|
||||
@foreach (var jobType in Model.Token.JobQueue.JobSubTypes.GroupBy(jst => jst.JobType).OrderBy(jtg => jtg.Key.Description))
|
||||
</script>
|
||||
</div>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Automatically Add Jobs:</th>
|
||||
<td>
|
||||
<div>
|
||||
@if (Model.Token.JobQueue.JobSubTypes.Count > 0)
|
||||
{
|
||||
<li>
|
||||
@jobType.Key.Description
|
||||
<ul>
|
||||
@if (jobType.Count() == Model.JobTypes.FirstOrDefault(jt => jt.Id == jobType.Key.Id).JobSubTypes.Count)
|
||||
{
|
||||
<li><span class="smallMessage">[All Sub Types]</span></li>
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var jobSubType in jobType)
|
||||
{
|
||||
<li>@jobSubType.Description</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
</li>
|
||||
<ul>
|
||||
@foreach (var jobType in Model.Token.JobQueue.JobSubTypes.GroupBy(jst => jst.JobType).OrderBy(jtg => jtg.Key.Description))
|
||||
{
|
||||
<li>
|
||||
@jobType.Key.Description
|
||||
<ul>
|
||||
@if (jobType.Count() == Model.JobTypes.FirstOrDefault(jt => jt.Id == jobType.Key.Id).JobSubTypes.Count)
|
||||
{
|
||||
<li><span class="smallMessage">[All Sub Types]</span></li>
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var jobSubType in jobType)
|
||||
{
|
||||
<li>@jobSubType.Description</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
else
|
||||
{
|
||||
<text><None></text>
|
||||
}
|
||||
</div>
|
||||
@if (canConfig)
|
||||
{
|
||||
<a id="Config_JobQueues_JobSubTypes_Update" href="#" class="button small">Update</a>
|
||||
else
|
||||
{
|
||||
<text><None></text>
|
||||
}
|
||||
</div>
|
||||
@if (canConfig)
|
||||
{
|
||||
<a id="Config_JobQueues_JobSubTypes_Update" href="#" class="button small">Update</a>
|
||||
<div id="Config_JobQueues_JobSubTypes_Update_Dialog" class="dialog" title="Job Queue Automatic Types">
|
||||
@using (Html.BeginForm(MVC.API.JobQueue.UpdateJobSubTypes(Model.Token.JobQueue.Id, null, true)))
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
var selectedTypes = Model.Token.JobQueue.JobSubTypes.Select(jst => jst.JobType).Distinct().ToList();
|
||||
foreach (var jt in Model.JobTypes)
|
||||
{
|
||||
@@ -637,23 +614,27 @@
|
||||
|
||||
})();
|
||||
</script>
|
||||
}
|
||||
<div class="info-box">
|
||||
<p class="fa-p">
|
||||
<i class="fa fa-info-circle"></i>When jobs of these types are created, they will automatically be added into this queue.
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
}
|
||||
<div class="info-box">
|
||||
<p class="fa-p">
|
||||
<i class="fa fa-info-circle"></i>When jobs of these types are created, they will automatically be added into this queue.
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@if (canDelete || canShowJobs)
|
||||
{
|
||||
<div class="actionBar">
|
||||
@if (canDelete)
|
||||
{
|
||||
@Html.ActionLinkButton("Delete", MVC.API.JobQueue.Delete(Model.Token.JobQueue.Id, true), "Config_JobQueues_Actions_Delete_Button")
|
||||
<div id="Config_JobQueues_Actions_Delete_Dialog" title="Delete this Job Queue?">
|
||||
<button id="Config_JobQueues_Actions_Delete_Button" class="button" type="button">Delete</button>
|
||||
<div id="Config_JobQueues_Actions_Delete_Dialog" class="dialog" title="Delete this Job Queue?">
|
||||
@using (Html.BeginForm(MVC.API.JobQueue.Delete(Model.Token.JobQueue.Id, true)))
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
}
|
||||
<p>
|
||||
<i class="fa fa-exclamation-triangle fa-lg warning"></i>
|
||||
This item will be permanently deleted and cannot be recovered.<br />
|
||||
@@ -663,29 +644,29 @@
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var button = $('#Config_JobQueues_Actions_Delete_Button');
|
||||
var buttonDialog = $('#Config_JobQueues_Actions_Delete_Dialog');
|
||||
var buttonLink = button.attr('href');
|
||||
button.attr('href', '#');
|
||||
button.click(function () {
|
||||
buttonDialog.dialog('open');
|
||||
return false;
|
||||
});
|
||||
buttonDialog.dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
buttons: {
|
||||
"Delete": function () {
|
||||
var $this = $(this);
|
||||
$this.dialog("disable");
|
||||
$this.dialog("option", "buttons", null);
|
||||
window.location.href = buttonLink;
|
||||
},
|
||||
Cancel: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
const $button = $('#Config_JobQueues_Actions_Delete_Button');
|
||||
let $buttonDialog = null;
|
||||
$button.on('click', function () {
|
||||
if (!$buttonDialog) {
|
||||
$buttonDialog = $('#Config_JobQueues_Actions_Delete_Dialog').dialog({
|
||||
resizable: false,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
buttons: {
|
||||
"Delete": function () {
|
||||
var $this = $(this);
|
||||
$this.dialog("option", "buttons", null);
|
||||
$this.find('form').trigger('submit');
|
||||
},
|
||||
Cancel: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$buttonDialog.dialog('open');
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user