Feature #4: Pre-defined/Restricted Locations

Configurable list and location suggestions. Ability to restrict
locations. Shows 'occupied' locations.
This commit is contained in:
Gary Sharp
2014-02-17 21:44:34 +11:00
parent ed7caf8b4a
commit 5be747afbc
35 changed files with 2136 additions and 729 deletions
@@ -18,7 +18,9 @@ namespace Disco.Web.Areas.Config.Controllers
var m = new Models.JobPreferences.IndexModel()
{
LongRunningJobDaysThreshold = Database.DiscoConfiguration.JobPreferences.LongRunningJobDaysThreshold,
StaleJobMinutesThreshold = Database.DiscoConfiguration.JobPreferences.StaleJobMinutesThreshold
StaleJobMinutesThreshold = Database.DiscoConfiguration.JobPreferences.StaleJobMinutesThreshold,
LocationMode = Database.DiscoConfiguration.JobPreferences.LocationMode,
LocationList = Database.DiscoConfiguration.JobPreferences.LocationList
};
// UI Extensions
@@ -1,6 +1,8 @@
using Disco.Models.UI.Config.JobPreferences;
using Disco.Models.BI.Job;
using Disco.Models.UI.Config.JobPreferences;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.Mvc;
@@ -11,6 +13,8 @@ namespace Disco.Web.Areas.Config.Models.JobPreferences
{
public int LongRunningJobDaysThreshold { get; set; }
public int StaleJobMinutesThreshold { get; set; }
public LocationModes LocationMode { get; set; }
public List<string> LocationList { get; set; }
public List<KeyValuePair<int, string>> LongRunningJobDaysThresholdOptions()
{
@@ -76,5 +80,20 @@ namespace Disco.Web.Areas.Config.Models.JobPreferences
return options;
}
public List<KeyValuePair<string, string>> LocationModeOptions()
{
var type = typeof(LocationModes);
var names = Enum.GetNames(type);
return names.Select(n =>
{
var at = type.GetMember(n)[0].GetCustomAttributes(typeof(DisplayAttribute), false);
if (at != null && at.Length > 0)
return new KeyValuePair<string, string>(n, ((DisplayAttribute)at[0]).Name);
else
return new KeyValuePair<string, string>(n, n);
}).OrderBy(i => i.Key).ToList();
}
}
}
@@ -11,65 +11,6 @@
Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers");
Html.BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
}
}
<div class="form" style="width: 530px;">
<h2>General Preferences</h2>
<table>
<tr>
<th style="width: 200px">Long Running Threshold:
</th>
<td>@if (canConfig)
{
@Html.DropDownListFor(model => model.LongRunningJobDaysThreshold, Model.LongRunningJobDaysThresholdOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value }))
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
document.DiscoFunctions.PropertyChangeHelper(
$('#LongRunningJobDaysThreshold'),
null,
'@(Url.Action(MVC.API.JobPreferences.UpdateLongRunningJobDaysThreshold()))',
'LongRunningJobDaysThreshold');
});
</script>
}
else
{
@Model.LongRunningJobDaysThresholdOptions().First(o => o.Key == Model.LongRunningJobDaysThreshold).Value
}
<div class="smallMessage">
Jobs which have been open for longer than the threshold are considered 'long-running' and will appear in the <code>Long Running Jobs</code> list.
</div>
@if (Authorization.Has(Claims.Job.Lists.LongRunningJobs)) { @Html.ActionLinkSmallButton("Show Long Running Jobs", MVC.Job.LongRunning()) }
</td>
</tr>
<tr>
<th style="width: 200px">Stale Threshold:
</th>
<td>@if (canConfig)
{
@Html.DropDownListFor(model => model.StaleJobMinutesThreshold, Model.StaleJobMinutesThresholdOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value }))
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
document.DiscoFunctions.PropertyChangeHelper(
$('#StaleJobMinutesThreshold'),
null,
'@(Url.Action(MVC.API.JobPreferences.UpdateStaleJobMinutesThreshold()))',
'StaleJobMinutesThreshold');
});
</script>
}
else
{
@Model.StaleJobMinutesThresholdOptions().First(o => o.Key == Model.StaleJobMinutesThreshold).Value
}
<div class="smallMessage">
Jobs which have no recoded action for longer than the threshold are considered 'stale' and will appear in the <code>Stale Jobs</code> list.
</div>
@if (Authorization.Has(Claims.Job.Lists.LongRunningJobs)) { @Html.ActionLinkSmallButton("Show Stale Jobs", MVC.Job.Stale()) }
</td>
</tr>
</table>
</div>
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.General);
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Locations);
}
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -58,282 +58,12 @@ namespace Disco.Web.Areas.Config.Views.JobPreferences
Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers");
Html.BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
}
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.General);
Html.RenderPartial(MVC.Config.JobPreferences.Views.Parts.Locations);
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 530px;\"");
WriteLiteral(">\r\n <h2>General Preferences</h2>\r\n <table>\r\n <tr>\r\n <th");
WriteLiteral(" style=\"width: 200px\"");
WriteLiteral(">Long Running Threshold:\r\n </th>\r\n <td>");
#line 21 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
if (canConfig)
{
#line default
#line hidden
#line 23 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(Html.DropDownListFor(model => model.LongRunningJobDaysThreshold, Model.LongRunningJobDaysThresholdOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value })));
#line default
#line hidden
#line 23 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
#line default
#line hidden
#line 24 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(AjaxHelpers.AjaxSave());
#line default
#line hidden
#line 24 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
#line default
#line hidden
#line 25 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
#line 25 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
#line default
#line hidden
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n document.DiscoFun" +
"ctions.PropertyChangeHelper(\r\n $(\'#LongRunningJobDays" +
"Threshold\'),\r\n null,\r\n \'");
#line 31 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(Url.Action(MVC.API.JobPreferences.UpdateLongRunningJobDaysThreshold()));
#line default
#line hidden
WriteLiteral("\',\r\n \'LongRunningJobDaysThreshold\');\r\n " +
" });\r\n </script>\r\n");
#line 35 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
}
else
{
#line default
#line hidden
#line 38 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(Model.LongRunningJobDaysThresholdOptions().First(o => o.Key == Model.LongRunningJobDaysThreshold).Value);
#line default
#line hidden
#line 38 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">\r\n Jobs which have been open for longer than the threshold ar" +
"e considered \'long-running\' and will appear in the <code>Long Running Jobs</code" +
"> list.\r\n </div>\r\n");
#line 43 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
#line default
#line hidden
#line 43 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
if (Authorization.Has(Claims.Job.Lists.LongRunningJobs)) {
#line default
#line hidden
#line 43 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(Html.ActionLinkSmallButton("Show Long Running Jobs", MVC.Job.LongRunning()));
#line default
#line hidden
#line 43 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <th");
WriteLiteral(" style=\"width: 200px\"");
WriteLiteral(">Stale Threshold:\r\n </th>\r\n <td>");
#line 49 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
if (canConfig)
{
#line default
#line hidden
#line 51 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(Html.DropDownListFor(model => model.StaleJobMinutesThreshold, Model.StaleJobMinutesThresholdOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value })));
#line default
#line hidden
#line 51 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
#line default
#line hidden
#line 52 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(AjaxHelpers.AjaxSave());
#line default
#line hidden
#line 52 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
#line default
#line hidden
#line 53 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
#line 53 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
#line default
#line hidden
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n document.DiscoFun" +
"ctions.PropertyChangeHelper(\r\n $(\'#StaleJobMinutesThr" +
"eshold\'),\r\n null,\r\n \'");
#line 59 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(Url.Action(MVC.API.JobPreferences.UpdateStaleJobMinutesThreshold()));
#line default
#line hidden
WriteLiteral("\',\r\n \'StaleJobMinutesThreshold\');\r\n " +
" });\r\n </script>\r\n");
#line 63 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
}
else
{
#line default
#line hidden
#line 66 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(Model.StaleJobMinutesThresholdOptions().First(o => o.Key == Model.StaleJobMinutesThreshold).Value);
#line default
#line hidden
#line 66 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">\r\n Jobs which have no recoded action for longer than the thre" +
"shold are considered \'stale\' and will appear in the <code>Stale Jobs</code> list" +
".\r\n </div>\r\n");
#line 71 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
#line default
#line hidden
#line 71 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
if (Authorization.Has(Claims.Job.Lists.LongRunningJobs)) {
#line default
#line hidden
#line 71 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Write(Html.ActionLinkSmallButton("Show Stale Jobs", MVC.Job.Stale()));
#line default
#line hidden
#line 71 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n </table>\r\n</div>\r\n");
}
}
}
@@ -0,0 +1,67 @@
@model Disco.Web.Areas.Config.Models.JobPreferences.IndexModel
@{
Authorization.Require(Claims.Config.JobPreferences.Show);
var canConfig = Authorization.Has(Claims.Config.JobPreferences.Configure);
}
<div class="form" style="width: 530px;">
<h2>General Preferences</h2>
<table>
<tr>
<th style="width: 200px">Long Running Threshold:
</th>
<td>@if (canConfig)
{
@Html.DropDownListFor(model => model.LongRunningJobDaysThreshold, Model.LongRunningJobDaysThresholdOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value }))
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
document.DiscoFunctions.PropertyChangeHelper(
$('#LongRunningJobDaysThreshold'),
null,
'@(Url.Action(MVC.API.JobPreferences.UpdateLongRunningJobDaysThreshold()))',
'LongRunningJobDaysThreshold');
});
</script>
}
else
{
@Model.LongRunningJobDaysThresholdOptions().First(o => o.Key == Model.LongRunningJobDaysThreshold).Value
}
<div class="smallMessage">
Jobs which have been open for longer than the threshold are considered 'long-running' and will appear in the <code>Long Running Jobs</code> list.
</div>
@if (Authorization.Has(Claims.Job.Lists.LongRunningJobs)) { @Html.ActionLinkSmallButton("Show Long Running Jobs", MVC.Job.LongRunning()) }
</td>
</tr>
<tr>
<th style="width: 200px">Stale Threshold:
</th>
<td>@if (canConfig)
{
@Html.DropDownListFor(model => model.StaleJobMinutesThreshold, Model.StaleJobMinutesThresholdOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value }))
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
document.DiscoFunctions.PropertyChangeHelper(
$('#StaleJobMinutesThreshold'),
null,
'@(Url.Action(MVC.API.JobPreferences.UpdateStaleJobMinutesThreshold()))',
'StaleJobMinutesThreshold');
});
</script>
}
else
{
@Model.StaleJobMinutesThresholdOptions().First(o => o.Key == Model.StaleJobMinutesThreshold).Value
}
<div class="smallMessage">
Jobs which have no recoded action for longer than the threshold are considered 'stale' and will appear in the <code>Stale Jobs</code> list.
</div>
@if (Authorization.Has(Claims.Job.Lists.LongRunningJobs)) { @Html.ActionLinkSmallButton("Show Stale Jobs", MVC.Job.Stale()) }
</td>
</tr>
</table>
</div>
@@ -0,0 +1,332 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.JobPreferences.Parts
{
using System;
using System.Collections.Generic;
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.BI.Extensions;
using Disco.Models.Repository;
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("~/Areas/Config/Views/JobPreferences/Parts/General.cshtml")]
public partial class General : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.JobPreferences.IndexModel>
{
public General()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Authorization.Require(Claims.Config.JobPreferences.Show);
var canConfig = Authorization.Has(Claims.Config.JobPreferences.Configure);
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 530px;\"");
WriteLiteral(">\r\n <h2>General Preferences</h2>\r\n <table>\r\n <tr>\r\n <th");
WriteLiteral(" style=\"width: 200px\"");
WriteLiteral(">Long Running Threshold:\r\n </th>\r\n <td>");
#line 13 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
if (canConfig)
{
#line default
#line hidden
#line 15 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(Html.DropDownListFor(model => model.LongRunningJobDaysThreshold, Model.LongRunningJobDaysThresholdOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value })));
#line default
#line hidden
#line 15 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
#line default
#line hidden
#line 16 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(AjaxHelpers.AjaxSave());
#line default
#line hidden
#line 16 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
#line default
#line hidden
#line 17 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
#line 17 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
#line default
#line hidden
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n document.DiscoFun" +
"ctions.PropertyChangeHelper(\r\n $(\'#LongRunningJobDays" +
"Threshold\'),\r\n null,\r\n \'");
#line 23 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(Url.Action(MVC.API.JobPreferences.UpdateLongRunningJobDaysThreshold()));
#line default
#line hidden
WriteLiteral("\',\r\n \'LongRunningJobDaysThreshold\');\r\n " +
" });\r\n </script>\r\n");
#line 27 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
}
else
{
#line default
#line hidden
#line 30 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(Model.LongRunningJobDaysThresholdOptions().First(o => o.Key == Model.LongRunningJobDaysThreshold).Value);
#line default
#line hidden
#line 30 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
}
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">\r\n Jobs which have been open for longer than the threshold ar" +
"e considered \'long-running\' and will appear in the <code>Long Running Jobs</code" +
"> list.\r\n </div>\r\n");
#line 35 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
#line default
#line hidden
#line 35 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
if (Authorization.Has(Claims.Job.Lists.LongRunningJobs)) {
#line default
#line hidden
#line 35 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(Html.ActionLinkSmallButton("Show Long Running Jobs", MVC.Job.LongRunning()));
#line default
#line hidden
#line 35 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <th");
WriteLiteral(" style=\"width: 200px\"");
WriteLiteral(">Stale Threshold:\r\n </th>\r\n <td>");
#line 41 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
if (canConfig)
{
#line default
#line hidden
#line 43 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(Html.DropDownListFor(model => model.StaleJobMinutesThreshold, Model.StaleJobMinutesThresholdOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value })));
#line default
#line hidden
#line 43 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
#line default
#line hidden
#line 44 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(AjaxHelpers.AjaxSave());
#line default
#line hidden
#line 44 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
#line default
#line hidden
#line 45 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
#line 45 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
#line default
#line hidden
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n document.DiscoFun" +
"ctions.PropertyChangeHelper(\r\n $(\'#StaleJobMinutesThr" +
"eshold\'),\r\n null,\r\n \'");
#line 51 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(Url.Action(MVC.API.JobPreferences.UpdateStaleJobMinutesThreshold()));
#line default
#line hidden
WriteLiteral("\',\r\n \'StaleJobMinutesThreshold\');\r\n " +
" });\r\n </script>\r\n");
#line 55 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
}
else
{
#line default
#line hidden
#line 58 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(Model.StaleJobMinutesThresholdOptions().First(o => o.Key == Model.StaleJobMinutesThreshold).Value);
#line default
#line hidden
#line 58 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
}
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">\r\n Jobs which have no recoded action for longer than the thre" +
"shold are considered \'stale\' and will appear in the <code>Stale Jobs</code> list" +
".\r\n </div>\r\n");
#line 63 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
#line default
#line hidden
#line 63 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
if (Authorization.Has(Claims.Job.Lists.LongRunningJobs)) {
#line default
#line hidden
#line 63 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
Write(Html.ActionLinkSmallButton("Show Stale Jobs", MVC.Job.Stale()));
#line default
#line hidden
#line 63 "..\..\Areas\Config\Views\JobPreferences\Parts\General.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n </table>\r\n</div>");
}
}
}
#pragma warning restore 1591
@@ -0,0 +1,233 @@
@model Disco.Web.Areas.Config.Models.JobPreferences.IndexModel
@{
Authorization.Require(Claims.Config.JobPreferences.Show);
var canConfig = Authorization.Has(Claims.Config.JobPreferences.Configure);
}
<div id="Config_Location" class="form" style="width: 530px;">
<h2>Job Locations</h2>
<table>
<tr>
<th style="width: 200px">Mode:
</th>
<td>@if (canConfig)
{
@Html.DropDownListFor(model => model.LocationMode, Model.LocationModeOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value }))
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<div id="Config_Location_Unrestricted">
<div style="padding: 0.7em 0.7em;" class="ui-state-highlight ui-corner-all">
<i class="fa fa-info-circle information"></i>&nbsp;Technicians will be able to specify <em>any</em> value when entering a location. A selection of locations used historically will be offered.
</div>
</div>
<div id="Config_Location_List">
<a id="Config_Location_List_Button" href="#" class="button small">Update List</a>
<div id="Config_Location_List_Dialog" class="dialog" title="Locations">
<div id="Config_Location_List_Dialog_ListContainer">
<span id="Config_Location_List_Dialog_None" class="smallMessage">The List is Empty</span>
<ul id="Config_Location_List_Dialog_List" class="none">
@foreach (var loc in Model.LocationList)
{
<li data-location="@loc">@loc<i class="fa fa-times-circle remove"></i></li>
}
</ul>
</div>
<div id="Config_Location_List_Dialog_AddContainer">
<input type="text" id="Config_Location_List_Dialog_TextAdd" />
<a id="Config_Location_List_Dialog_Add" href="#" class="button small">Add</a>
</div>
<form id="Config_Location_List_Dialog_Form" action="@(Url.Action(MVC.API.JobPreferences.UpdateLocationList(null, redirect: true)))" method="post"></form>
</div>
</div>
<div id="Config_Location_Optional">
<div style="padding: 0.7em 0.7em;" class="ui-state-highlight ui-corner-all">
<i class="fa fa-info-circle information"></i>&nbsp;Technicians will be able to specify <em>any</em> value when entering a location. A defined list of location options is suggested.
</div>
</div>
<div id="Config_Location_Restricted">
<div style="padding: 0.7em 0.7em;" class="ui-state-highlight ui-corner-all">
<i class="fa fa-info-circle information"></i>&nbsp;Technicians are restricted to select a location from the defined list.
</div>
</div>
<script type="text/javascript">
$(function () {
document.DiscoFunctions.PropertyChangeHelper(
$('#LocationMode'),
null,
'@(Url.Action(MVC.API.JobPreferences.UpdateLocationMode()))',
'LocationMode');
var $locationMode = $('#LocationMode');
function update() {
var $Config_Location_List = $('#Config_Location_List');
var $Config_Location_Unrestricted = $('#Config_Location_Unrestricted');
var $Config_Location_Optional = $('#Config_Location_Optional');
var $Config_Location_Restricted = $('#Config_Location_Restricted');
switch ($locationMode.val()) {
case 'Unrestricted':
$Config_Location_List.hide();
$Config_Location_Optional.hide();
$Config_Location_Restricted.hide();
$Config_Location_Unrestricted.show();
break;
case 'OptionalList':
$Config_Location_Unrestricted.hide();
$Config_Location_Restricted.hide();
$Config_Location_List.show();
$Config_Location_Optional.show();
break;
case 'RestrictedList':
$Config_Location_Unrestricted.hide();
$Config_Location_Optional.hide();
$Config_Location_List.show();
$Config_Location_Restricted.show();
break;
}
}
update();
$locationMode.change(update);
var dialog, textAdd, list, noList, form;
$('#Config_Location_List_Button').click(showDialog);
function showDialog() {
if (!dialog) {
dialog = $('#Config_Location_List_Dialog').dialog({
resizable: false,
modal: true,
autoOpen: false,
width: 350,
height: 420,
buttons: {
"Save Changes": saveChanges,
Cancel: cancel
}
});
dialog.on('click', '.remove', remove);
list = $('#Config_Location_List_Dialog_List');
noList = $('#Config_Location_List_Dialog_None');
textAdd = $('#Config_Location_List_Dialog_TextAdd');
textAdd.watermark('Location');
textAdd.keydown(function (e) {
if (e.keyCode == 13)
add();
});
$('#Config_Location_List_Dialog_Add').click(add);
}
dialog.dialog('open');
updateNoList();
return false;
}
function cancel() {
$(this).dialog("close");
list.find('li').each(function () {
$this = $(this);
if ($this.is('[data-status="new"]')) {
$this.remove();
} else {
if ($this.is('[data-status="removed"]')) {
$this.show();
$this.attr('data-status', '')
}
}
});
}
function remove() {
$this = $(this).closest('li');
if ($this.is('[data-status="new"]')) {
$this.remove();
} else {
$this.attr('data-status', 'removed').hide();
}
updateNoList();
}
function add() {
var value = textAdd.val();
// Trim
value = jQuery.trim(value);
if (!value) {
alert('Enter a location to be added');
return;
}
// Already Exists
var existingValues = list.find('li[data-location]').filter('[data-status!="removed"]').map(function () { return $(this).attr('data-location') }).get();
if (jQuery.inArray(value, existingValues) >= 0) {
alert('That item already exists in the list');
return;
}
// Add Item
var li = $('<li>')
.append($('<span>').text(value))
.append($('<i>').addClass('fa fa-times-circle remove'))
.attr('data-location', value)
.attr('data-status', 'new');
list.append(li);
textAdd.focus();
updateNoList();
}
function updateNoList() {
if (list.find('li:visible').length > 0)
noList.hide();
else
noList.show();
}
function saveChanges() {
var form = $('#Config_Location_List_Dialog_Form').empty();
list.find('li[data-status!="removed"]').each(function () {
var location = $(this).attr('data-location');
form.append($('<input>').attr({
'name': 'LocationList',
'type': 'hidden'
}).val(location));
}).get();
form.submit();
dialog.dialog("disable");
dialog.dialog("option", "buttons", null);
}
});
</script>
}
else
{
@Model.LocationModeOptions().First(o => o.Key == Model.LocationMode.ToString()).Value
}
</td>
</tr>
</table>
</div>
@@ -0,0 +1,435 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.JobPreferences.Parts
{
using System;
using System.Collections.Generic;
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.BI.Extensions;
using Disco.Models.Repository;
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("~/Areas/Config/Views/JobPreferences/Parts/Locations.cshtml")]
public partial class Locations : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.JobPreferences.IndexModel>
{
public Locations()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
Authorization.Require(Claims.Config.JobPreferences.Show);
var canConfig = Authorization.Has(Claims.Config.JobPreferences.Configure);
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" id=\"Config_Location\"");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 530px;\"");
WriteLiteral(">\r\n <h2>Job Locations</h2>\r\n <table>\r\n <tr>\r\n <th");
WriteLiteral(" style=\"width: 200px\"");
WriteLiteral(">Mode:\r\n </th>\r\n <td>");
#line 13 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
if (canConfig)
{
#line default
#line hidden
#line 15 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
Write(Html.DropDownListFor(model => model.LocationMode, Model.LocationModeOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value })));
#line default
#line hidden
#line 15 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
#line default
#line hidden
#line 16 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
Write(AjaxHelpers.AjaxSave());
#line default
#line hidden
#line 16 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
#line default
#line hidden
#line 17 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
#line 17 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"Config_Location_Unrestricted\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" style=\"padding: 0.7em 0.7em;\"");
WriteLiteral(" class=\"ui-state-highlight ui-corner-all\"");
WriteLiteral(">\r\n <i");
WriteLiteral(" class=\"fa fa-info-circle information\"");
WriteLiteral("></i>&nbsp;Technicians will be able to specify <em>any</em> value when entering a" +
" location. A selection of locations used historically will be offered.\r\n " +
" </div>\r\n </div>\r\n");
WriteLiteral(" <div");
WriteLiteral(" id=\"Config_Location_List\"");
WriteLiteral(">\r\n <a");
WriteLiteral(" id=\"Config_Location_List_Button\"");
WriteLiteral(" href=\"#\"");
WriteLiteral(" class=\"button small\"");
WriteLiteral(">Update List</a>\r\n <div");
WriteLiteral(" id=\"Config_Location_List_Dialog\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Locations\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" id=\"Config_Location_List_Dialog_ListContainer\"");
WriteLiteral(">\r\n <span");
WriteLiteral(" id=\"Config_Location_List_Dialog_None\"");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">The List is Empty</span>\r\n <ul");
WriteLiteral(" id=\"Config_Location_List_Dialog_List\"");
WriteLiteral(" class=\"none\"");
WriteLiteral(">\r\n");
#line 29 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
#line default
#line hidden
#line 29 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
foreach (var loc in Model.LocationList)
{
#line default
#line hidden
WriteLiteral(" <li");
WriteLiteral(" data-location=\"");
#line 31 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
Write(loc);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">");
#line 31 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
Write(loc);
#line default
#line hidden
WriteLiteral("<i");
WriteLiteral(" class=\"fa fa-times-circle remove\"");
WriteLiteral("></i></li>\r\n");
#line 32 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
}
#line default
#line hidden
WriteLiteral(" </ul>\r\n </div>\r\n " +
" <div");
WriteLiteral(" id=\"Config_Location_List_Dialog_AddContainer\"");
WriteLiteral(">\r\n <input");
WriteLiteral(" type=\"text\"");
WriteLiteral(" id=\"Config_Location_List_Dialog_TextAdd\"");
WriteLiteral(" />\r\n <a");
WriteLiteral(" id=\"Config_Location_List_Dialog_Add\"");
WriteLiteral(" href=\"#\"");
WriteLiteral(" class=\"button small\"");
WriteLiteral(">Add</a>\r\n </div>\r\n <form");
WriteLiteral(" id=\"Config_Location_List_Dialog_Form\"");
WriteAttribute("action", Tuple.Create(" action=\"", 2359), Tuple.Create("\"", 2446)
#line 39 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
, Tuple.Create(Tuple.Create("", 2368), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.JobPreferences.UpdateLocationList(null, redirect: true))
#line default
#line hidden
, 2368), false)
);
WriteLiteral(" method=\"post\"");
WriteLiteral("></form>\r\n </div>\r\n </div>\r\n");
WriteLiteral(" <div");
WriteLiteral(" id=\"Config_Location_Optional\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" style=\"padding: 0.7em 0.7em;\"");
WriteLiteral(" class=\"ui-state-highlight ui-corner-all\"");
WriteLiteral(">\r\n <i");
WriteLiteral(" class=\"fa fa-info-circle information\"");
WriteLiteral("></i>&nbsp;Technicians will be able to specify <em>any</em> value when entering a" +
" location. A defined list of location options is suggested.\r\n " +
" </div>\r\n </div>\r\n");
WriteLiteral(" <div");
WriteLiteral(" id=\"Config_Location_Restricted\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" style=\"padding: 0.7em 0.7em;\"");
WriteLiteral(" class=\"ui-state-highlight ui-corner-all\"");
WriteLiteral(">\r\n <i");
WriteLiteral(" class=\"fa fa-info-circle information\"");
WriteLiteral("></i>&nbsp;Technicians are restricted to select a location from the defined list." +
"\r\n </div>\r\n </div>\r\n");
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n document.DiscoFun" +
"ctions.PropertyChangeHelper(\r\n $(\'#LocationMode\'),\r\n " +
" null,\r\n \'");
#line 57 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
Write(Url.Action(MVC.API.JobPreferences.UpdateLocationMode()));
#line default
#line hidden
WriteLiteral("\',\r\n \'LocationMode\');\r\n\r\n var $" +
"locationMode = $(\'#LocationMode\');\r\n\r\n function update() " +
"{\r\n var $Config_Location_List = $(\'#Config_Location_L" +
"ist\');\r\n\r\n var $Config_Location_Unrestricted = $(\'#Co" +
"nfig_Location_Unrestricted\');\r\n var $Config_Location_" +
"Optional = $(\'#Config_Location_Optional\');\r\n var $Con" +
"fig_Location_Restricted = $(\'#Config_Location_Restricted\');\r\n\r\n\r\n " +
" switch ($locationMode.val()) {\r\n cas" +
"e \'Unrestricted\':\r\n $Config_Location_List.hid" +
"e();\r\n $Config_Location_Optional.hide();\r\n " +
" $Config_Location_Restricted.hide();\r\n\r\n " +
" $Config_Location_Unrestricted.show();\r\n " +
" break;\r\n case \'OptionalLis" +
"t\':\r\n $Config_Location_Unrestricted.hide();\r\n" +
" $Config_Location_Restricted.hide();\r\n\r\n " +
" $Config_Location_List.show();\r\n " +
" $Config_Location_Optional.show();\r\n " +
" break;\r\n case \'RestrictedList\':\r\n " +
" $Config_Location_Unrestricted.hide();\r\n " +
" $Config_Location_Optional.hide();\r\n\r\n " +
" $Config_Location_List.show();\r\n " +
" $Config_Location_Restricted.show();\r\n bre" +
"ak;\r\n }\r\n }\r\n " +
" update();\r\n $locationMode.change(update);\r\n\r\n " +
" var dialog, textAdd, list, noList, form;\r\n\r\n " +
" $(\'#Config_Location_List_Button\').click(showDialog);\r\n\r\n " +
" function showDialog() {\r\n if (!dialog) {\r\n " +
" dialog = $(\'#Config_Location_List_Dialog\').dialog({\r" +
"\n resizable: false,\r\n " +
" modal: true,\r\n autoOpen: false,\r\n" +
" width: 350,\r\n " +
" height: 420,\r\n buttons: {\r\n " +
" \"Save Changes\": saveChanges,\r\n " +
" Cancel: cancel\r\n }\r\n " +
" });\r\n\r\n dialog.on(\'click\'" +
", \'.remove\', remove);\r\n\r\n list = $(\'#Config_Locat" +
"ion_List_Dialog_List\');\r\n noList = $(\'#Config_Loc" +
"ation_List_Dialog_None\');\r\n\r\n textAdd = $(\'#Confi" +
"g_Location_List_Dialog_TextAdd\');\r\n\r\n textAdd.wat" +
"ermark(\'Location\');\r\n textAdd.keydown(function (e" +
") {\r\n if (e.keyCode == 13)\r\n " +
" add();\r\n });\r\n\r\n " +
" $(\'#Config_Location_List_Dialog_Add\').click(add);\r\n " +
" }\r\n\r\n dialog.dialog(\'open\');\r\n\r\n" +
" updateNoList();\r\n return " +
"false;\r\n }\r\n\r\n function cancel() {" +
"\r\n $(this).dialog(\"close\");\r\n\r\n " +
" list.find(\'li\').each(function () {\r\n $this " +
"= $(this);\r\n if ($this.is(\'[data-status=\"new\"]\'))" +
" {\r\n $this.remove();\r\n " +
" } else {\r\n if ($this.is(\'[data-statu" +
"s=\"removed\"]\')) {\r\n $this.show();\r\n " +
" $this.attr(\'data-status\', \'\')\r\n " +
" }\r\n }\r\n " +
" });\r\n }\r\n\r\n function remove" +
"() {\r\n $this = $(this).closest(\'li\');\r\n\r\n " +
" if ($this.is(\'[data-status=\"new\"]\')) {\r\n " +
" $this.remove();\r\n } else {\r\n " +
" $this.attr(\'data-status\', \'removed\').hide();\r\n " +
" }\r\n\r\n updateNoList();\r\n " +
" }\r\n\r\n function add() {\r\n\r\n " +
"var value = textAdd.val();\r\n\r\n // Trim\r\n " +
" value = jQuery.trim(value);\r\n\r\n if (!v" +
"alue) {\r\n alert(\'Enter a location to be added\');\r" +
"\n return;\r\n }\r\n\r\n " +
" // Already Exists\r\n var existi" +
"ngValues = list.find(\'li[data-location]\').filter(\'[data-status!=\"removed\"]\').map" +
"(function () { return $(this).attr(\'data-location\') }).get();\r\n " +
" if (jQuery.inArray(value, existingValues) >= 0) {\r\n " +
" alert(\'That item already exists in the list\');\r\n " +
" return;\r\n }\r\n\r\n " +
" // Add Item\r\n var li = $(\'<li>\')\r\n " +
" .append($(\'<span>\').text(value))\r\n " +
" .append($(\'<i>\').addClass(\'fa fa-times-circle remove\'))\r\n " +
" .attr(\'data-location\', value)\r\n .attr" +
"(\'data-status\', \'new\');\r\n\r\n list.append(li);\r\n\r\n " +
" textAdd.focus();\r\n\r\n updateNoL" +
"ist();\r\n }\r\n\r\n function updateNoLi" +
"st() {\r\n if (list.find(\'li:visible\').length > 0)\r\n " +
" noList.hide();\r\n else\r\n " +
" noList.show();\r\n }\r\n\r\n " +
" function saveChanges() {\r\n var fo" +
"rm = $(\'#Config_Location_List_Dialog_Form\').empty();\r\n\r\n " +
" list.find(\'li[data-status!=\"removed\"]\').each(function () {\r\n " +
" var location = $(this).attr(\'data-location\');\r\n\r\n " +
" form.append($(\'<input>\').attr({\r\n " +
" \'name\': \'LocationList\',\r\n \'type\': \'hidd" +
"en\'\r\n }).val(location));\r\n\r\n " +
" }).get();\r\n\r\n form.submit();\r\n\r\n " +
" dialog.dialog(\"disable\");\r\n dialog.dial" +
"og(\"option\", \"buttons\", null);\r\n }\r\n }" +
");\r\n </script>\r\n");
#line 225 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
}
else
{
#line default
#line hidden
#line 228 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
Write(Model.LocationModeOptions().First(o => o.Key == Model.LocationMode.ToString()).Value);
#line default
#line hidden
#line 228 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n </table>\r\n</div>\r\n");
}
}
}
#pragma warning restore 1591
@@ -405,6 +405,7 @@
} else {
if ($this.is('[data-subjectstatus="removed"]')) {
$this.show();
$this.attr('data-status', '')
}
}
});
@@ -432,7 +433,7 @@
data: { Id: id }
}).done(function (response) {
if (response) {
if (list.find('li[data-subjectid="' + response.Id + '"]').length == 0) {
if (list.find('li[data-subjectid="' + response.Id + '"]').filter('[data-status!="removed"]').length == 0) {
var liIcon = $('<i>').addClass('fa fa-lg');
if (response.Type === 'user')
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -1352,21 +1352,22 @@ WriteLiteral("\',\r\n minLength:
" $this.remove();\r\n " +
" } else {\r\n if ($this.is(\'[" +
"data-subjectstatus=\"removed\"]\')) {\r\n " +
" $this.show();\r\n }\r\n " +
" }\r\n });\r\n " +
" }\r\n\r\n function remove() {\r\n" +
" $this = $(this).closest(\'li\');\r\n\r\n " +
" if ($this.is(\'[data-subjectstatus=\"new\"]\')) {\r\n " +
" $this.remove();\r\n " +
" } else {\r\n $this.attr(\'data-subject" +
"status\', \'removed\').hide();\r\n }\r\n\r\n " +
" updateNoSubjects();\r\n }" +
"\r\n\r\n function add() {\r\n\r\n " +
" var id = textAdd.val();\r\n\r\n $.aja" +
"x({\r\n url: \'");
" $this.show();\r\n $this.attr(\'d" +
"ata-status\', \'\')\r\n }\r\n " +
" }\r\n });\r\n " +
" }\r\n\r\n function remove() {\r\n " +
" $this = $(this).closest(\'li\');\r\n\r\n " +
" if ($this.is(\'[data-subjectstatus=\"new\"]\')) {\r\n " +
" $this.remove();\r\n " +
" } else {\r\n $this.attr(\'data-subjects" +
"tatus\', \'removed\').hide();\r\n }\r\n\r\n " +
" updateNoSubjects();\r\n }\r" +
"\n\r\n function add() {\r\n\r\n " +
" var id = textAdd.val();\r\n\r\n $.ajax" +
"({\r\n url: \'");
#line 430 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 431 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
Write(Url.Action(MVC.API.JobQueue.Subject()));
@@ -1376,52 +1377,52 @@ WriteLiteral("\',\r\n method: \'get\',\r\
" data: { Id: id }\r\n }).done" +
"(function (response) {\r\n if (response) {\r" +
"\n if (list.find(\'li[data-subjectid=\"\'" +
" + response.Id + \'\"]\').length == 0) {\r\n\r\n " +
" var liIcon = $(\'<i>\').addClass(\'fa fa-lg\');\r\n " +
" if (response.Type === \'user\')\r\n " +
" liIcon.addClass(\'fa-user\');\r\n " +
" else\r\n " +
"liIcon.addClass(\'fa-users\');\r\n\r\n " +
"var li = $(\'<li>\')\r\n .append(" +
"liIcon)\r\n .append($(\'<span>\')" +
".text(response.Id == response.Name ? response.Id : response.Name + \' [\' + respon" +
"se.Id + \']\'))\r\n .append($(\'<i" +
">\').addClass(\'fa fa-times-circle remove\'))\r\n " +
" .addClass(response.Type)\r\n " +
" .attr(\'data-subjectid\', response.Id)\r\n " +
" .attr(\'data-subjectstatus\', \'new\');\r\n\r\n " +
" list.append(li);\r\n\r\n " +
" updateNoSubjects();\r\n " +
" } else {\r\n alert(\'That subjec" +
"t has already been added\');\r\n }\r\n " +
" } else {\r\n " +
" alert(\'Unknown Id\');\r\n }\r\n " +
" }).fail(function (jqXHR, textStatus, errorThrown)" +
" {\r\n alert(\'Error: \' + errorThrown);\r\n " +
" });\r\n }\r\n\r\n " +
" function updateNoSubjects() {\r\n " +
" if (list.find(\'li:visible\').length > 0)\r\n " +
" noSubjects.hide();\r\n else\r" +
"\n noSubjects.show();\r\n " +
" }\r\n\r\n function saveChanges() {\r\n " +
" var form = $(\'#Config_JobQueues_Subjects_Update_" +
"Dialog_Form\').empty();\r\n\r\n list.find(\'li[data" +
"-subjectstatus!=\"removed\"]\').each(function () {\r\n " +
" var subjectId = $(this).attr(\'data-subjectid\');\r\n\r\n " +
" form.append($(\'<input>\').attr({\r\n " +
" \'name\': \'Subjects\',\r\n " +
" \'type\': \'hidden\'\r\n }).val(subjectId));\r" +
"\n\r\n }).get();\r\n\r\n " +
" form.submit();\r\n\r\n dialog.dialog(\"dis" +
"able\");\r\n dialog.dialog(\"option\", \"buttons\", " +
"null);\r\n }\r\n\r\n $(f" +
"unction () {\r\n $(\'#Config_JobQueues_Subjects_" +
"Update\').click(showDialog);\r\n });\r\n\r\n " +
" })();\r\n </script>\r\n </" +
"div>\r\n");
" + response.Id + \'\"]\').filter(\'[data-status!=\"removed\"]\').length == 0) {\r\n\r\n " +
" var liIcon = $(\'<i>\').addClass(\'fa f" +
"a-lg\');\r\n if (response.Type === \'" +
"user\')\r\n liIcon.addClass(\'fa-" +
"user\');\r\n else\r\n " +
" liIcon.addClass(\'fa-users\');\r\n\r\n " +
" var li = $(\'<li>\')\r\n " +
" .append(liIcon)\r\n " +
" .append($(\'<span>\').text(response.Id == response.Name ? response" +
".Id : response.Name + \' [\' + response.Id + \']\'))\r\n " +
" .append($(\'<i>\').addClass(\'fa fa-times-circle remove\'))\r\n " +
" .addClass(response.Type)\r\n " +
" .attr(\'data-subjectid\', respons" +
"e.Id)\r\n .attr(\'data-subjectst" +
"atus\', \'new\');\r\n\r\n list.append(li" +
");\r\n\r\n updateNoSubjects();\r\n " +
" } else {\r\n " +
" alert(\'That subject has already been added\');\r\n " +
" }\r\n } else {\r" +
"\n alert(\'Unknown Id\');\r\n " +
" }\r\n }).fail(functi" +
"on (jqXHR, textStatus, errorThrown) {\r\n a" +
"lert(\'Error: \' + errorThrown);\r\n });\r\n " +
" }\r\n\r\n function updat" +
"eNoSubjects() {\r\n if (list.find(\'li:visible\')" +
".length > 0)\r\n noSubjects.hide();\r\n " +
" else\r\n noSu" +
"bjects.show();\r\n }\r\n\r\n " +
" function saveChanges() {\r\n var form = $(" +
"\'#Config_JobQueues_Subjects_Update_Dialog_Form\').empty();\r\n\r\n " +
" list.find(\'li[data-subjectstatus!=\"removed\"]\').each(function ()" +
" {\r\n var subjectId = $(this).attr(\'data-s" +
"ubjectid\');\r\n\r\n form.append($(\'<input>\')." +
"attr({\r\n \'name\': \'Subjects\',\r\n " +
" \'type\': \'hidden\'\r\n " +
" }).val(subjectId));\r\n\r\n }).get" +
"();\r\n\r\n form.submit();\r\n\r\n " +
" dialog.dialog(\"disable\");\r\n " +
"dialog.dialog(\"option\", \"buttons\", null);\r\n }\r\n\r\n" +
" $(function () {\r\n " +
" $(\'#Config_JobQueues_Subjects_Update\').click(showDialog);\r\n " +
" });\r\n\r\n })();\r\n " +
" </script>\r\n </div>\r\n");
#line 498 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 499 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
}
@@ -1431,13 +1432,13 @@ WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n
" Jobs:</th>\r\n <td>\r\n <div>\r\n");
#line 505 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 506 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line default
#line hidden
#line 505 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 506 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
if (Model.Token.JobQueue.JobSubTypes.Count > 0)
{
@@ -1447,13 +1448,13 @@ WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n
WriteLiteral(" <ul>\r\n");
#line 508 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 509 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line default
#line hidden
#line 508 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 509 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
foreach (var jobType in Model.Token.JobQueue.JobSubTypes.GroupBy(jst => jst.JobType).OrderBy(jtg => jtg.Key.Description))
{
@@ -1465,7 +1466,7 @@ WriteLiteral(" <li>\r\n");
WriteLiteral(" ");
#line 511 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 512 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
Write(jobType.Key.Description);
@@ -1474,13 +1475,13 @@ WriteLiteral(" ");
WriteLiteral("\r\n <ul>\r\n");
#line 513 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 514 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line default
#line hidden
#line 513 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 514 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
if (jobType.Count() == Model.JobTypes.FirstOrDefault(jt => jt.Id == jobType.Key.Id).JobSubTypes.Count)
{
@@ -1494,7 +1495,7 @@ WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">[All Sub Types]</span></li>\r\n");
#line 516 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 517 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
}
else
{
@@ -1507,7 +1508,7 @@ WriteLiteral(">[All Sub Types]</span></li>\r\n");
WriteLiteral(" <li>");
#line 521 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 522 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
Write(jobSubType.Description);
@@ -1516,7 +1517,7 @@ WriteLiteral(" <li>");
WriteLiteral("</li>\r\n");
#line 522 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 523 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
}
}
@@ -1527,7 +1528,7 @@ WriteLiteral(" </ul>\r\n
"\n");
#line 526 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 527 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
}
@@ -1536,7 +1537,7 @@ WriteLiteral(" </ul>\r\n
WriteLiteral(" </ul>\r\n");
#line 528 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 529 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
}
else
{
@@ -1551,7 +1552,7 @@ WriteLiteral("&lt;None&gt;");
WriteLiteral("\r\n");
#line 532 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 533 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
}
@@ -1560,13 +1561,13 @@ WriteLiteral("\r\n");
WriteLiteral(" </div>\r\n");
#line 534 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 535 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line default
#line hidden
#line 534 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 535 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
if (canConfig)
{
@@ -1594,13 +1595,13 @@ WriteLiteral(" title=\"Job Queue Automatic Types\"");
WriteLiteral(">\r\n");
#line 538 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 539 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line default
#line hidden
#line 538 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 539 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
using (Html.BeginForm(MVC.API.JobQueue.UpdateJobSubTypes(Model.Token.JobQueue.Id, null, true)))
{
var selectedTypes = Model.Token.JobQueue.JobSubTypes.Select(jst => jst.JobType).Distinct().ToList();
@@ -1612,15 +1613,15 @@ WriteLiteral(">\r\n");
#line hidden
WriteLiteral(" <div");
WriteAttribute("id", Tuple.Create(" id=\"", 28412), Tuple.Create("\"", 28434)
, Tuple.Create(Tuple.Create("", 28417), Tuple.Create("trJobType", 28417), true)
WriteAttribute("id", Tuple.Create(" id=\"", 28526), Tuple.Create("\"", 28548)
, Tuple.Create(Tuple.Create("", 28531), Tuple.Create("trJobType", 28531), true)
#line 543 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
, Tuple.Create(Tuple.Create("", 28426), Tuple.Create<System.Object, System.Int32>(jt.Id
#line 544 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
, Tuple.Create(Tuple.Create("", 28540), Tuple.Create<System.Object, System.Int32>(jt.Id
#line default
#line hidden
, 28426), false)
, 28540), false)
);
WriteLiteral(" class=\"jobTypes\"");
@@ -1628,35 +1629,35 @@ WriteLiteral(" class=\"jobTypes\"");
WriteLiteral(">\r\n <h4>\r\n <inp" +
"ut");
WriteAttribute("id", Tuple.Create(" id=\"", 28535), Tuple.Create("\"", 28554)
, Tuple.Create(Tuple.Create("", 28540), Tuple.Create("Types_", 28540), true)
WriteAttribute("id", Tuple.Create(" id=\"", 28649), Tuple.Create("\"", 28668)
, Tuple.Create(Tuple.Create("", 28654), Tuple.Create("Types_", 28654), true)
#line 545 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
, Tuple.Create(Tuple.Create("", 28546), Tuple.Create<System.Object, System.Int32>(jt.Id
#line 546 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
, Tuple.Create(Tuple.Create("", 28660), Tuple.Create<System.Object, System.Int32>(jt.Id
#line default
#line hidden
, 28546), false)
, 28660), false)
);
WriteLiteral(" class=\"jobType\"");
WriteLiteral(" type=\"checkbox\"");
WriteAttribute("value", Tuple.Create(" value=\"", 28587), Tuple.Create("\"", 28603)
WriteAttribute("value", Tuple.Create(" value=\"", 28701), Tuple.Create("\"", 28717)
#line 545 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
, Tuple.Create(Tuple.Create("", 28595), Tuple.Create<System.Object, System.Int32>(jt.Id
#line 546 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
, Tuple.Create(Tuple.Create("", 28709), Tuple.Create<System.Object, System.Int32>(jt.Id
#line default
#line hidden
, 28595), false)
, 28709), false)
);
WriteLiteral(" ");
#line 545 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 546 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
Write(selectedTypes.Contains(jt) ? "checked=\"checked\"" : null);
@@ -1664,21 +1665,21 @@ WriteLiteral(" ");
#line hidden
WriteLiteral(" /><label");
WriteAttribute("for", Tuple.Create(" for=\"", 28674), Tuple.Create("\"", 28694)
, Tuple.Create(Tuple.Create("", 28680), Tuple.Create("Types_", 28680), true)
WriteAttribute("for", Tuple.Create(" for=\"", 28788), Tuple.Create("\"", 28808)
, Tuple.Create(Tuple.Create("", 28794), Tuple.Create("Types_", 28794), true)
#line 545 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
, Tuple.Create(Tuple.Create("", 28686), Tuple.Create<System.Object, System.Int32>(jt.Id
#line 546 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
, Tuple.Create(Tuple.Create("", 28800), Tuple.Create<System.Object, System.Int32>(jt.Id
#line default
#line hidden
, 28686), false)
, 28800), false)
);
WriteLiteral(">");
#line 545 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 546 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
Write(jt.Description);
@@ -1686,15 +1687,15 @@ WriteLiteral(">");
#line hidden
WriteLiteral("</label></h4>\r\n <div");
WriteAttribute("id", Tuple.Create(" id=\"", 28762), Tuple.Create("\"", 28784)
, Tuple.Create(Tuple.Create("", 28767), Tuple.Create("SubTypes_", 28767), true)
WriteAttribute("id", Tuple.Create(" id=\"", 28876), Tuple.Create("\"", 28898)
, Tuple.Create(Tuple.Create("", 28881), Tuple.Create("SubTypes_", 28881), true)
#line 546 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
, Tuple.Create(Tuple.Create("", 28776), Tuple.Create<System.Object, System.Int32>(jt.Id
#line 547 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
, Tuple.Create(Tuple.Create("", 28890), Tuple.Create<System.Object, System.Int32>(jt.Id
#line default
#line hidden
, 28776), false)
, 28890), false)
);
WriteLiteral(" class=\"jobSubTypes\"");
@@ -1704,7 +1705,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 547 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 548 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
Write(CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id), "div"));
@@ -1715,7 +1716,7 @@ WriteLiteral("\r\n");
WriteLiteral(" ");
#line 548 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 549 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
Write(CommonHelpers.CheckBoxList("JobSubTypes", jt.JobSubTypes.OrderBy(jst => jst.Description).ToSelectListItems(Model.Token.JobQueue.JobSubTypes), 2));
@@ -1725,7 +1726,7 @@ WriteLiteral("\r\n </div>\r\n
"");
#line 551 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 552 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
}
}
@@ -1773,7 +1774,7 @@ WriteLiteral(" <script>\r\n (function
" })();\r\n </script>\r\n");
#line 616 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 617 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
}
@@ -1794,7 +1795,7 @@ WriteLiteral("></i>&nbsp;When jobs of these types are created, they will automat
" </table>\r\n</div>\r\n");
#line 624 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 625 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
if (canDelete || canShowJobs)
{
@@ -1810,7 +1811,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 627 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 628 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
Write(Html.ActionLinkButton("Delete", MVC.API.JobQueue.Delete(Model.Token.JobQueue.Id, true), "Config_JobQueues_Actions_Delete_Button"));
@@ -1865,7 +1866,7 @@ WriteLiteral(@">
WriteLiteral(" ");
#line 664 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 665 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
Write(Html.ActionLinkButton(string.Format("Show {0} job{1}", Model.OpenJobCount, (Model.OpenJobCount == 1 ? null : "s")), MVC.Job.Queue(Model.Token.JobQueue.Id), "Config_JobQueues_Actions_ShowJobs_Button"));
@@ -1874,7 +1875,7 @@ WriteLiteral(" ");
WriteLiteral("\r\n </div>\r\n");
#line 666 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
#line 667 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
}
#line default