Feature #25: Job General Preferences

Initially to make 'long running job threshold' configurable. Updates to
ManagedJobList and fix for missing GetClaimKeys method (#24).
This commit is contained in:
Gary Sharp
2013-10-24 18:19:05 +11:00
parent 0d60fb422c
commit 723eeec91e
31 changed files with 987 additions and 142 deletions
+60 -20
View File
@@ -13,11 +13,15 @@ using Disco.Services.Users;
namespace Disco.BI.JobBI
{
using FilterFunc = Func<IQueryable<Job>, IQueryable<Job>>;
using SortFunc = Func<IEnumerable<Disco.Models.BI.Job.JobTableModel.JobTableItemModel>, IEnumerable<Disco.Models.BI.Job.JobTableModel.JobTableItemModel>>;
using Disco.Services.Logging;
public class ManagedJobList : JobTableModel, IDisposable
{
public string Name { get; set; }
public Func<IQueryable<Job>, IQueryable<Job>> FilterFunction { get; set; }
public Func<IEnumerable<JobTableItemModel>, IEnumerable<JobTableItemModel>> SortFunction { get; set; }
public FilterFunc FilterFunction { get; set; }
public SortFunc SortFunction { get; set; }
private IDisposable unsubscribeToken;
private object updateLock = new object();
@@ -35,29 +39,65 @@ namespace Disco.BI.JobBI
public ManagedJobList Initialize(DiscoDataContext Database)
{
// Initially fill table
base.Items = this.SortFunction(this.DetermineItems(Database, this.FilterFunction(Database.Jobs))).ToList();
// Can only Initialize once
if (base.Items != null)
return ReInitialize(Database);
// Subscribe for Changes
// - Job (or Job Meta) Changes
// - Device Profile Address Changes (for multi-campus Schools)
// - Device Model Description Changes
// - Device's Profile or Model Changes
unsubscribeToken = RepositoryMonitor.StreamAfterCommit
.Where(n => n.EntityType == typeof(Job) ||
n.EntityType == typeof(JobMetaWarranty) ||
n.EntityType == typeof(JobMetaNonWarranty) ||
n.EntityType == typeof(JobMetaInsurance) ||
(n.EventType == RepositoryMonitorEventType.Modified && (
(n.EntityType == typeof(DeviceProfile) && n.ModifiedProperties.Contains("DefaultOrganisationAddress")) ||
(n.EntityType == typeof(DeviceModel) && n.ModifiedProperties.Contains("Description")) ||
(n.EntityType == typeof(Device) && n.ModifiedProperties.Contains("DeviceProfileId") || n.ModifiedProperties.Contains("DeviceModelId"))
)))
.Subscribe(JobNotification);
lock (updateLock)
{
// Subscribe for Changes
// - Job (or Job Meta) Changes
// - Device Profile Address Changes (for multi-campus Schools)
// - Device Model Description Changes
// - Device's Profile or Model Changes
unsubscribeToken = RepositoryMonitor.StreamAfterCommit
.Where(n => n.EntityType == typeof(Job) ||
n.EntityType == typeof(JobMetaWarranty) ||
n.EntityType == typeof(JobMetaNonWarranty) ||
n.EntityType == typeof(JobMetaInsurance) ||
(n.EventType == RepositoryMonitorEventType.Modified && (
(n.EntityType == typeof(DeviceProfile) && n.ModifiedProperties.Contains("DefaultOrganisationAddress")) ||
(n.EntityType == typeof(DeviceModel) && n.ModifiedProperties.Contains("Description")) ||
(n.EntityType == typeof(Device) && n.ModifiedProperties.Contains("DeviceProfileId") || n.ModifiedProperties.Contains("DeviceModelId"))
)))
.Subscribe(JobNotification, NotificationError);
// Initially fill table
base.Items = this.SortFunction(this.DetermineItems(Database, this.FilterFunction(Database.Jobs))).ToList();
}
return this;
}
public ManagedJobList ReInitialize(DiscoDataContext Database)
{
return ReInitialize(Database, null, null);
}
public ManagedJobList ReInitialize(DiscoDataContext Database, FilterFunc FilterFunction)
{
return ReInitialize(Database, FilterFunction, null);
}
public ManagedJobList ReInitialize(DiscoDataContext Database, FilterFunc FilterFunction, SortFunc SortFunction)
{
if (Database == null)
throw new ArgumentNullException("Database");
lock (updateLock)
{
if (FilterFunction != null)
this.FilterFunction = FilterFunction;
if (SortFunction != null)
this.SortFunction = SortFunction;
base.Items = this.SortFunction(this.DetermineItems(Database, this.FilterFunction(Database.Jobs))).ToList();
}
return this;
}
private void NotificationError(Exception ex)
{
SystemLog.LogException(string.Format("Disco.BI.JobBI.ManagedJobList: [{0}]", this.Name), ex);
}
private void JobNotification(RepositoryMonitorEvent e)
{
List<int> jobIds = null;
+1 -1
View File
@@ -254,7 +254,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="False" BuildVersion_BuildAction="Both" BuildVersion_StartDate="2011/7/1" />
<UserProperties BuildVersion_StartDate="2011/7/1" BuildVersion_BuildAction="Both" BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" />
</VisualStudio>
</ProjectExtensions>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
@@ -0,0 +1,31 @@
using Disco.Data.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Disco.Data.Configuration.Modules
{
public class JobPreferencesConfiguration : ConfigurationBase
{
public JobPreferencesConfiguration(DiscoDataContext Database) : base(Database) { }
public override string Scope { get { return "JobPreferences"; } }
/// <summary>
/// Number of days a job is open before it is considered 'Long Running'
/// </summary>
public int LongRunningJobDaysThreshold
{
get { return Get<int>(7); }
set
{
if (value < 0)
throw new ArgumentOutOfRangeException("value", "The Long Running Job Days Threshold cannot be less than zero");
Set(value);
}
}
}
}
@@ -20,6 +20,7 @@ namespace Disco.Data.Configuration
this.moduleBootstrapperConfiguration = new Lazy<Modules.BootstrapperConfiguration>(() => new Modules.BootstrapperConfiguration(Database));
this.moduleDeviceProfilesConfiguration = new Lazy<Modules.DeviceProfilesConfiguration>(() => new Modules.DeviceProfilesConfiguration(Database));
this.moduleOrganisationAddressesConfiguration = new Lazy<Modules.OrganisationAddressesConfiguration>(() => new Modules.OrganisationAddressesConfiguration(Database));
this.moduleJobPreferencesConfiguration = new Lazy<Modules.JobPreferencesConfiguration>(() => new Modules.JobPreferencesConfiguration(Database));
}
#region Configuration Modules
@@ -27,6 +28,7 @@ namespace Disco.Data.Configuration
private Lazy<Modules.BootstrapperConfiguration> moduleBootstrapperConfiguration;
private Lazy<Modules.DeviceProfilesConfiguration> moduleDeviceProfilesConfiguration;
private Lazy<Modules.OrganisationAddressesConfiguration> moduleOrganisationAddressesConfiguration;
private Lazy<Modules.JobPreferencesConfiguration> moduleJobPreferencesConfiguration;
public Modules.BootstrapperConfiguration Bootstrapper
{
@@ -49,6 +51,13 @@ namespace Disco.Data.Configuration
return moduleOrganisationAddressesConfiguration.Value;
}
}
public Modules.JobPreferencesConfiguration JobPreferences
{
get
{
return moduleJobPreferencesConfiguration.Value;
}
}
#endregion
+2 -1
View File
@@ -72,6 +72,7 @@
<Compile Include="Configuration\CommunityHelpers.cs" />
<Compile Include="Configuration\ConfigurationBase.cs" />
<Compile Include="Configuration\ConfigurationCache.cs" />
<Compile Include="Configuration\Modules\JobPreferencesConfiguration.cs" />
<Compile Include="Configuration\SystemConfiguration.cs" />
<Compile Include="Configuration\Modules\BootstrapperConfiguration.cs" />
<Compile Include="Configuration\Modules\DeviceProfileConfiguration.cs" />
@@ -172,7 +173,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties BuildVersion_BuildAction="Both" BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="False" BuildVersion_StartDate="2011/7/1" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" />
<UserProperties BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_StartDate="2011/7/1" BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildAction="Both" />
</VisualStudio>
</ProjectExtensions>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
+2 -1
View File
@@ -131,6 +131,7 @@
<Compile Include="UI\Config\DocumentTemplate\ConfigDocumentTemplateUndetectedPagesModel.cs" />
<Compile Include="UI\Config\Enrolment\ConfigEnrolmentIndexModel.cs" />
<Compile Include="UI\Config\Enrolment\ConfigEnrolmentStatusModel.cs" />
<Compile Include="UI\Config\JobPreferences\ConfigJobPreferencesIndexModel.cs" />
<Compile Include="UI\Config\Logging\ConfigLoggingIndexModel.cs" />
<Compile Include="UI\Config\Logging\ConfigLoggingTaskStatusModel.cs" />
<Compile Include="UI\Config\Organisation\ConfigOrganisationIndexModel.cs" />
@@ -154,7 +155,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties BuildVersion_BuildAction="Both" BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="False" BuildVersion_StartDate="2011/7/1" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" />
<UserProperties BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_StartDate="2011/7/1" BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildAction="Both" />
</VisualStudio>
</ProjectExtensions>
<PropertyGroup>
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Disco.Models.UI.Config.JobPreferences
{
public interface ConfigJobPreferencesIndexModel : BaseUIModel
{
int LongRunningJobDaysThreshold { get; set; }
List<KeyValuePair<int, string>> LongRunningJobDaysThresholdOptions();
}
}
+1
View File
@@ -9,6 +9,7 @@ namespace Disco.Models.UI.Job
public interface JobShowModel : BaseUIModel
{
Repository.Job Job { get; set; }
bool IsLongRunning { get; set; }
List<Repository.DocumentTemplate> AvailableDocumentTemplates { get; set; }
List<Repository.JobSubType> UpdatableJobSubTypes { get; set; }
}
+26 -1
View File
@@ -66,6 +66,8 @@ namespace Disco.Services.Authorization
{ "Config.Organisation.ConfigureMultiSiteMode", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.Organisation.ConfigureMultiSiteMode, (c, v) => c.Config.Organisation.ConfigureMultiSiteMode = v, "Configure Multi-Site Mode", "Can configure multi-site mode", false) },
{ "Config.Organisation.ConfigureName", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.Organisation.ConfigureName, (c, v) => c.Config.Organisation.ConfigureName = v, "Configure Name", "Can configure the organisation name", false) },
{ "Config.Organisation.Show", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.Organisation.Show, (c, v) => c.Config.Organisation.Show = v, "Show Organisation Details", "Can show the organisation details", false) },
{ "Config.JobPreferences.Configure", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.JobPreferences.Configure, (c, v) => c.Config.JobPreferences.Configure = v, "Configure Job Preferences", "Can configure job preferences", false) },
{ "Config.JobPreferences.Show", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.JobPreferences.Show, (c, v) => c.Config.JobPreferences.Show = v, "Show Job Preferences", "Can show job preferences", false) },
{ "Config.Show", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.Show, (c, v) => c.Config.Show = v, "Show Configuration", "Can show the configuration menu", false) },
{ "Job.Lists.AllOpen", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Lists.AllOpen, (c, v) => c.Job.Lists.AllOpen = v, "All Open List", "Can show list", false) },
{ "Job.Lists.AwaitingFinanceAgreementBreach", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Job.Lists.AwaitingFinanceAgreementBreach, (c, v) => c.Job.Lists.AwaitingFinanceAgreementBreach = v, "Awaiting Finance Agreement Breach List", "Can show list (NOTE: Requires Awaiting Finance List)", false) },
@@ -248,6 +250,10 @@ namespace Disco.Services.Authorization
new ClaimNavigatorItem("Config.Organisation.ConfigureName", false),
new ClaimNavigatorItem("Config.Organisation.Show", false)
}),
new ClaimNavigatorItem("Config.JobPreferences", "Job Preferences", "Permissions related to Job Preferences", false, new List<IClaimNavigatorItem>() {
new ClaimNavigatorItem("Config.JobPreferences.Configure", false),
new ClaimNavigatorItem("Config.JobPreferences.Show", false)
}),
new ClaimNavigatorItem("Config.Show", false)
}),
new ClaimNavigatorItem("Job", "Job", "Permissions related to Jobs", false, new List<IClaimNavigatorItem>() {
@@ -439,7 +445,7 @@ namespace Disco.Services.Authorization
return c;
}
public static List<string> GetClaimKeys(RoleClaims Claims)
public static List<string> GetClaimKeys(RoleClaims Claims)
{
var claims = Claims;
return _roleClaims.Where(rc => rc.Value.Item1(claims)).Select(rc => rc.Key).ToList();
@@ -490,6 +496,8 @@ namespace Disco.Services.Authorization
c.Config.Organisation.ConfigureMultiSiteMode = true;
c.Config.Organisation.ConfigureName = true;
c.Config.Organisation.Show = true;
c.Config.JobPreferences.Configure = true;
c.Config.JobPreferences.Show = true;
c.Config.Show = true;
c.Job.Lists.AllOpen = true;
c.Job.Lists.AwaitingFinanceAgreementBreach = true;
@@ -900,6 +908,23 @@ namespace Disco.Services.Authorization
public const string Show = "Config.Organisation.Show";
}
/// <summary>Job Preferences
/// <para>Permissions related to Job Preferences</para>
/// </summary>
public static class JobPreferences
{
/// <summary>Configure Job Preferences
/// <para>Can configure job preferences</para>
/// </summary>
public const string Configure = "Config.JobPreferences.Configure";
/// <summary>Show Job Preferences
/// <para>Can show job preferences</para>
/// </summary>
public const string Show = "Config.JobPreferences.Show";
}
/// <summary>Show Configuration
/// <para>Can show the configuration menu</para>
/// </summary>
+7
View File
@@ -58,6 +58,7 @@ using Disco.Models.Repository;
using Disco.Services.Authorization.Roles;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Disco.Services.Authorization
{
@@ -130,6 +131,12 @@ namespace Disco.Services.Authorization
return c;
}
public static List<string> GetClaimKeys(RoleClaims Claims)
{
var claims = Claims;
return _roleClaims.Where(rc => rc.Value.Item1(claims)).Select(rc => rc.Key).ToList();
}
public static RoleClaims AdministratorClaims() {
var c = new RoleClaims();
#region Set All Administrator Claims
@@ -4,15 +4,11 @@ using Disco.Services.Authorization.Roles.ClaimGroups.Configuration.DeviceModel;
using Disco.Services.Authorization.Roles.ClaimGroups.Configuration.DeviceProfile;
using Disco.Services.Authorization.Roles.ClaimGroups.Configuration.DocumentTemplate;
using Disco.Services.Authorization.Roles.ClaimGroups.Configuration.Enrolment;
using Disco.Services.Authorization.Roles.ClaimGroups.Configuration.JobPreferences;
using Disco.Services.Authorization.Roles.ClaimGroups.Configuration.Logging;
using Disco.Services.Authorization.Roles.ClaimGroups.Configuration.Origanisation;
using Disco.Services.Authorization.Roles.ClaimGroups.Configuration.Plugin;
using Disco.Services.Authorization.Roles.ClaimGroups.Configuration.System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration
{
@@ -31,6 +27,7 @@ namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration
this.Plugin = new PluginClaims();
this.System = new SystemClaims();
this.Organisation = new OrganisationClaims();
this.JobPreferences = new JobPreferencesClaims();
}
[ClaimDetails("Show Configuration", "Can show the configuration menu")]
@@ -55,5 +52,7 @@ namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration
public SystemClaims System { get; set; }
public OrganisationClaims Organisation { get; set; }
public JobPreferencesClaims JobPreferences { get; set; }
}
}
@@ -0,0 +1,12 @@
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.JobPreferences
{
[ClaimDetails("Job Preferences", "Permissions related to Job Preferences")]
public class JobPreferencesClaims
{
[ClaimDetails("Show Job Preferences", "Can show job preferences")]
public bool Show { get; set; }
[ClaimDetails("Configure Job Preferences", "Can configure job preferences")]
public bool Configure { get; set; }
}
}
+2 -1
View File
@@ -105,6 +105,7 @@
<Compile Include="Authorization\Roles\ClaimGroups\Configuration\DeviceProfile\DeviceProfileClaims.cs" />
<Compile Include="Authorization\Roles\ClaimGroups\Configuration\DocumentTemplate\DocumentTemplateClaims.cs" />
<Compile Include="Authorization\Roles\ClaimGroups\Configuration\Enrolment\EnrolmentClaims.cs" />
<Compile Include="Authorization\Roles\ClaimGroups\Configuration\JobPreferences\JobPreferencesClaims.cs" />
<Compile Include="Authorization\Roles\ClaimGroups\Configuration\Logging\LoggingClaims.cs" />
<Compile Include="Authorization\Roles\ClaimGroups\Configuration\Origanisation\OrganisationClaims.cs" />
<Compile Include="Authorization\Roles\ClaimGroups\Configuration\Plugin\PluginClaims.cs" />
@@ -225,7 +226,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_StartDate="2011/7/1" BuildVersion_BuildAction="Both" BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="False" />
<UserProperties BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="False" BuildVersion_BuildAction="Both" BuildVersion_StartDate="2011/7/1" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" />
</VisualStudio>
</ProjectExtensions>
<PropertyGroup>
@@ -0,0 +1,30 @@
using Disco.Services.Authorization;
using Disco.Services.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Disco.Web.Areas.API.Controllers
{
public partial class JobPreferencesController : AuthorizedDatabaseController
{
const string pLongRunningJobDaysThreshold = "longrunningjobdaysthreshold";
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
public virtual ActionResult UpdateLongRunningJobDaysThreshold(int LongRunningJobDaysThreshold, bool redirect = false)
{
Database.DiscoConfiguration.JobPreferences.LongRunningJobDaysThreshold = LongRunningJobDaysThreshold;
Database.SaveChanges();
Disco.Web.Controllers.JobController.ReInitializeLongRunningJobList(Database);
if (redirect)
return RedirectToAction(MVC.Config.JobPreferences.Index());
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
}
}
@@ -0,0 +1,29 @@
using Disco.Models.UI.Config.JobPreferences;
using Disco.Services.Authorization;
using Disco.Services.Plugins.Features.UIExtension;
using Disco.Services.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Disco.Web.Areas.Config.Controllers
{
public partial class JobPreferencesController : AuthorizedDatabaseController
{
[DiscoAuthorize(Claims.Config.JobPreferences.Show)]
public virtual ActionResult Index()
{
var m = new Models.JobPreferences.IndexModel()
{
LongRunningJobDaysThreshold = Database.DiscoConfiguration.JobPreferences.LongRunningJobDaysThreshold
};
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigJobPreferencesIndexModel>(this.ControllerContext, m);
return View(m);
}
}
}
@@ -0,0 +1,43 @@
using Disco.Models.UI.Config.JobPreferences;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Disco.Web.Areas.Config.Models.JobPreferences
{
public class IndexModel : ConfigJobPreferencesIndexModel
{
public int LongRunningJobDaysThreshold { get; set; }
public List<KeyValuePair<int, string>> LongRunningJobDaysThresholdOptions()
{
var options = new List<KeyValuePair<int, string>>() {
new KeyValuePair<int, string>(1, "1 Day"),
new KeyValuePair<int, string>(2, "2 Days"),
new KeyValuePair<int, string>(3, "3 Days"),
new KeyValuePair<int, string>(4, "4 Days"),
new KeyValuePair<int, string>(5, "5 Days"),
new KeyValuePair<int, string>(6, "6 Days"),
new KeyValuePair<int, string>(7, "1 Week"),
new KeyValuePair<int, string>(14, "2 Weeks"),
new KeyValuePair<int, string>(21, "3 Weeks"),
new KeyValuePair<int, string>(28, "4 Weeks"),
new KeyValuePair<int, string>(35, "5 Weeks"),
new KeyValuePair<int, string>(42, "6 Weeks"),
new KeyValuePair<int, string>(49, "7 Weeks"),
new KeyValuePair<int, string>(56, "8 Weeks")
};
var current = this.LongRunningJobDaysThreshold;
if (!options.Any(o => o.Key == current))
{
options.Add(new KeyValuePair<int, string>(current, string.Format("{0} Days", current)));
options = options.OrderBy(o => o.Key).ToList();
}
return options;
}
}
}
@@ -78,27 +78,44 @@
</div>
</td>
}
@if (Authorization.HasAny(Claims.Config.DocumentTemplate.Show, Claims.Config.Plugin.Show))
@if (Authorization.HasAny(Claims.Config.JobPreferences.Show, Claims.Config.DocumentTemplate.Show, Claims.Config.Plugin.Show))
{
<td>
<div class="pageMenuArea">
<h2>Features</h2>
@if (Authorization.Has(Claims.Config.DocumentTemplate.Show))
{
@Html.ActionLinkClass("Document Templates", MVC.Config.DocumentTemplate.Index(), "config")
<div class="pageMenuBlurb">
Create, Update and Bulk Generate documents based on PDF Templates for Jobs, Devices
@if (Authorization.HasAny(Claims.Config.JobPreferences.Show))
{
<div class="pageMenuArea noSeperator">
<h2>Jobs</h2>
@if (Authorization.Has(Claims.Config.JobPreferences.Show))
{
@Html.ActionLinkClass("General Preferences", MVC.Config.JobPreferences.Index(), "config")
<div class="pageMenuBlurb">
Configure general preferences related to jobs.
</div>
}
</div>
}
@if (Authorization.HasAny(Claims.Config.DocumentTemplate.Show, Claims.Config.Plugin.Show))
{
<div class="pageMenuArea">
<h2>Features</h2>
@if (Authorization.Has(Claims.Config.DocumentTemplate.Show))
{
@Html.ActionLinkClass("Document Templates", MVC.Config.DocumentTemplate.Index(), "config")
<div class="pageMenuBlurb">
Create, Update and Bulk Generate documents based on PDF Templates for Jobs, Devices
and Users.
</div>
}
@if (Authorization.Has(Claims.Config.Plugin.Show))
{
@Html.ActionLinkClass("Plugins", MVC.Config.Plugins.Index(), "config")
<div class="pageMenuBlurb">
Manage extensions to the Disco platform.
</div>
}
</div>
</div>
}
@if (Authorization.Has(Claims.Config.Plugin.Show))
{
@Html.ActionLinkClass("Plugins", MVC.Config.Plugins.Index(), "config")
<div class="pageMenuBlurb">
Manage extensions to the Disco platform.
</div>
}
</div>
}
</td>
}
</tr>
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18051
// Runtime Version:4.0.30319.34003
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -428,103 +428,201 @@ WriteLiteral(" ");
#line 81 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.HasAny(Claims.Config.DocumentTemplate.Show, Claims.Config.Plugin.Show))
if (Authorization.HasAny(Claims.Config.JobPreferences.Show, Claims.Config.DocumentTemplate.Show, Claims.Config.Plugin.Show))
{
#line default
#line hidden
WriteLiteral(" <td>\r\n <div");
WriteLiteral(" class=\"pageMenuArea\"");
WriteLiteral(">\r\n <h2>Features</h2>\r\n");
WriteLiteral(" <td>\r\n");
#line 86 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 84 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
#line 86 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.Has(Claims.Config.DocumentTemplate.Show))
{
#line 84 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.HasAny(Claims.Config.JobPreferences.Show))
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"pageMenuArea noSeperator\"");
WriteLiteral(">\r\n <h2>Jobs</h2>\r\n");
#line 88 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
#line 88 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Document Templates", MVC.Config.DocumentTemplate.Index(), "config"));
if (Authorization.Has(Claims.Config.JobPreferences.Show))
{
#line default
#line hidden
#line 88 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 90 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("General Preferences", MVC.Config.JobPreferences.Index(), "config"));
#line default
#line hidden
#line 90 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Create, Update and Bulk Generate documents based o" +
"n PDF Templates for Jobs, Devices\r\n and Users.\r\n " +
" </div>\r\n");
#line 93 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral(">\r\n Configure general preferences related to jobs." +
"\r\n </div>\r\n");
#line 94 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.Has(Claims.Config.Plugin.Show))
{
}
#line default
#line hidden
WriteLiteral(" </div>\r\n");
#line 96 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Plugins", MVC.Config.Plugins.Index(), "config"));
}
#line default
#line hidden
WriteLiteral("\r\n");
#line 98 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
#line 96 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 98 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.HasAny(Claims.Config.DocumentTemplate.Show, Claims.Config.Plugin.Show))
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"pageMenuArea\"");
WriteLiteral(">\r\n <h2>Features</h2>\r\n");
#line 102 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
#line 102 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.Has(Claims.Config.DocumentTemplate.Show))
{
#line default
#line hidden
#line 104 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Document Templates", MVC.Config.DocumentTemplate.Index(), "config"));
#line default
#line hidden
#line 104 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Manage extensions to the Disco platform.\r\n " +
" </div>\r\n");
WriteLiteral(">\r\n Create, Update and Bulk Generate documents bas" +
"ed on PDF Templates for Jobs, Devices\r\n and Users.\r\n " +
" </div>\r\n");
#line 100 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
#line 109 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n </td>\r\n");
WriteLiteral(" ");
#line 103 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 110 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.Has(Claims.Config.Plugin.Show))
{
#line default
#line hidden
#line 112 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Plugins", MVC.Config.Plugins.Index(), "config"));
#line default
#line hidden
#line 112 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Manage extensions to the Disco platform.\r\n " +
" </div>\r\n");
#line 116 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n");
#line 118 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n");
#line 120 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
@@ -533,7 +631,7 @@ WriteLiteral(" </div>\r\n </td>\r\n");
WriteLiteral(" </tr>\r\n</table>\r\n");
#line 106 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 123 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Model.UpdateAvailable)
{
@@ -547,14 +645,14 @@ WriteLiteral(" id=\"updateAvailableContainer\"");
WriteLiteral(">\r\n <div>An updated version of Disco is available</div>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 5401), Tuple.Create("\"", 5437)
WriteAttribute("href", Tuple.Create(" href=\"", 6326), Tuple.Create("\"", 6362)
#line 111 "..\..\Areas\Config\Views\Config\Index.cshtml"
, Tuple.Create(Tuple.Create("", 5408), Tuple.Create<System.Object, System.Int32>(Model.UpdateResponse.UrlLink
#line 128 "..\..\Areas\Config\Views\Config\Index.cshtml"
, Tuple.Create(Tuple.Create("", 6333), Tuple.Create<System.Object, System.Int32>(Model.UpdateResponse.UrlLink
#line default
#line hidden
, 5408), false)
, 6333), false)
);
WriteLiteral(" target=\"_blank\"");
@@ -562,7 +660,7 @@ WriteLiteral(" target=\"_blank\"");
WriteLiteral(">Download Disco v");
#line 111 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 128 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Model.UpdateResponse.Version);
@@ -579,13 +677,13 @@ WriteLiteral(@" <script>
");
#line 119 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 136 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
#line 119 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 136 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Model.UpdateResponse.VersionReleasedTimestamp < DateTime.Now.AddDays(-7))
{
@@ -601,7 +699,7 @@ WriteLiteral("\r\n updateAvailableContainer.effect(\"shake\", { t
WriteLiteral("\r\n");
#line 125 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 142 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
@@ -610,7 +708,7 @@ WriteLiteral("\r\n");
WriteLiteral("\r\n });\r\n })();\r\n </script>\r\n");
#line 130 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 147 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
@@ -0,0 +1,46 @@
@model Disco.Web.Areas.Config.Models.JobPreferences.IndexModel
@{
Authorization.Require(Claims.Config.JobPreferences.Show);
var canConfig = Authorization.Has(Claims.Config.JobPreferences.Configure);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Job Preferences");
if (canConfig)
{
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>
</td>
</tr>
</table>
</div>
@@ -0,0 +1,179 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
//
// 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
{
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.BI.Extensions;
using Disco.Models.Repository;
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/Index.cshtml")]
public partial class Index : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.JobPreferences.IndexModel>
{
public Index()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\JobPreferences\Index.cshtml"
Authorization.Require(Claims.Config.JobPreferences.Show);
var canConfig = Authorization.Has(Claims.Config.JobPreferences.Configure);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Job Preferences");
if (canConfig)
{
Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers");
Html.BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
}
#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 </td>\r\n </tr>\r\n </table>\r" +
"\n</div>\r\n");
}
}
}
#pragma warning restore 1591
@@ -2099,6 +2099,9 @@ div.form > table table.sub > tbody > tr > th.name {
#pageMenu td .pageMenuArea:not(:last-child) {
border-bottom: 1px dashed #aaa;
}
#pageMenu td .pageMenuArea.noSeperator {
border-bottom: none;
}
#pageMenu td:first-child {
padding-left: 0;
}
File diff suppressed because one or more lines are too long
+3
View File
@@ -921,6 +921,9 @@ div.form > table table.sub > tbody > tr > th.name {
#pageMenu td .pageMenuArea:not(:last-child) {
border-bottom: 1px dashed #aaa;
}
#pageMenu td .pageMenuArea.noSeperator {
border-bottom: none;
}
#pageMenu td:first-child {
padding-left: 0;
}
+4
View File
@@ -883,6 +883,10 @@ div.form {
.pageMenuArea:not(:last-child) {
border-bottom: 1px dashed #aaa;
}
.pageMenuArea.noSeperator {
border-bottom: none;
}
}
td:first-child {
File diff suppressed because one or more lines are too long
+48 -19
View File
@@ -1,5 +1,6 @@
using Disco.BI.Extensions;
using Disco.BI.JobBI;
using Disco.Data.Repository;
using Disco.Models.Repository;
using Disco.Models.UI.Job;
using Disco.Services.Authorization;
@@ -19,15 +20,49 @@ namespace Disco.Web.Controllers
{
#region Index
#region Managed Job Lists
private static object jobListCreationLock = new object();
private static ManagedJobList jobList_OpenJobs;
private static ManagedJobList jobList_LongRunning;
public virtual ActionResult Index()
internal static ManagedJobList ReInitializeLongRunningJobList(DiscoDataContext Database)
{
var m = new Models.Job.IndexModel();
if (jobList_LongRunning == null)
return InitializeLongRunningJobList(Database);
else
{
var longRunningThreshold = DateTime.Today.AddDays(Database.DiscoConfiguration.JobPreferences.LongRunningJobDaysThreshold * -1);
return jobList_LongRunning.ReInitialize(Database, q => q.Where(j => j.ClosedDate == null && j.OpenedDate < longRunningThreshold));
}
}
internal static ManagedJobList InitializeLongRunningJobList(DiscoDataContext Database)
{
if (jobList_LongRunning == null)
{
lock (jobListCreationLock)
{
if (jobList_LongRunning == null)
{
var longRunningThreshold = DateTime.Today.AddDays(Database.DiscoConfiguration.JobPreferences.LongRunningJobDaysThreshold * -1);
jobList_LongRunning = new ManagedJobList()
{
Name = "Long Running Jobs",
FilterFunction = q => q.Where(j => j.ClosedDate == null && j.OpenedDate < longRunningThreshold),
SortFunction = q => q.OrderBy(j => j.Id),
ShowStatus = true
}.Initialize(Database);
}
}
}
return jobList_LongRunning;
}
internal static ManagedJobList InitializeOpenJobList(DiscoDataContext Database)
{
if (jobList_OpenJobs == null)
{
lock (jobListCreationLock)
@@ -49,24 +84,16 @@ namespace Disco.Web.Controllers
}
}
}
if (jobList_LongRunning == null)
{
lock (jobListCreationLock)
{
if (jobList_LongRunning == null)
{
var longRunningThreshold = DateTime.Today.AddDays(-7);
return jobList_OpenJobs;
}
#endregion
jobList_LongRunning = new ManagedJobList()
{
Name = "Long Running Jobs",
FilterFunction = q => q.Where(j => j.ClosedDate == null && j.OpenedDate < longRunningThreshold),
SortFunction = q => q.OrderBy(j => j.Id),
ShowStatus = true
}.Initialize(Database);
}
}
}
public virtual ActionResult Index()
{
var m = new Models.Job.IndexModel();
InitializeOpenJobList(Database);
InitializeLongRunningJobList(Database);
if (Authorization.Has(Claims.Job.Lists.AwaitingTechnicianAction))
m.OpenJobs = jobList_OpenJobs;
@@ -317,6 +344,8 @@ namespace Disco.Web.Controllers
throw new InvalidOperationException("Unknown JobType");
}
m.IsLongRunning = (m.Job.OpenedDate < DateTime.Today.AddDays(Database.DiscoConfiguration.JobPreferences.LongRunningJobDaysThreshold * -1));
if (Authorization.Has(Claims.Job.Actions.UpdateSubTypes))
m.UpdatableJobSubTypes = m.Job.JobType.JobSubTypes.OrderBy(jst => jst.Description).ToList();
+20 -7
View File
@@ -191,9 +191,11 @@
<DependentUpon>CommonHelpers.cshtml</DependentUpon>
</Compile>
<Compile Include="Areas\API\Controllers\AuthorizationRoleController.cs" />
<Compile Include="Areas\API\Controllers\JobPreferencesController.cs" />
<Compile Include="Areas\API\Controllers\PluginController.cs" />
<Compile Include="Areas\API\Models\AuthorizationRole\SubjectItem.cs" />
<Compile Include="Areas\Config\Controllers\AuthorizationRoleController.cs" />
<Compile Include="Areas\Config\Controllers\JobPreferencesController.cs" />
<Compile Include="Areas\Config\Models\AuthorizationRole\CreateModel.cs" />
<Compile Include="Areas\Config\Models\AuthorizationRole\IndexModel.cs" />
<Compile Include="Areas\Config\Models\AuthorizationRole\ShowModel.cs" />
@@ -204,6 +206,7 @@
<Compile Include="Areas\Config\Models\DeviceProfile\CreateModel.cs" />
<Compile Include="Areas\Config\Models\DocumentTemplate\ImportStatusModel.cs" />
<Compile Include="Areas\Config\Models\Enrolment\StatusModel.cs" />
<Compile Include="Areas\Config\Models\JobPreferences\IndexModel.cs" />
<Compile Include="Areas\Config\Models\Plugins\InstallModel.cs" />
<Compile Include="Areas\Config\Views\AuthorizationRole\Create.generated.cs">
<DependentUpon>Create.cshtml</DependentUpon>
@@ -220,6 +223,11 @@
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Areas\Config\Views\JobPreferences\Index.generated.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Index.cshtml</DependentUpon>
</Compile>
<Compile Include="Areas\Config\Views\Plugins\Install.generated.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@@ -557,9 +565,10 @@
<Compile Include="Models\User\ShowModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="T4MVC.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>T4MVC.tt</DependentUpon>
<SubType>Code</SubType>
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
</Compile>
<Compile Include="Views\Device\AddOffline.generated.cs">
<DependentUpon>AddOffline.cshtml</DependentUpon>
@@ -877,6 +886,10 @@
<Generator>RazorGenerator</Generator>
<LastGenOutput>Show.generated.cs</LastGenOutput>
</None>
<None Include="Areas\Config\Views\JobPreferences\Index.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>Index.generated.cs</LastGenOutput>
</None>
<None Include="Areas\Config\Views\Plugins\Install.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>Install.generated.cs</LastGenOutput>
@@ -1496,10 +1509,6 @@
<None Include="ClientSource\Scripts\Modules\Highcharts\highcharts.src.js" />
<None Include="ClientSource\Scripts\Modules\jQuery-SignalR\jquery.signalR-1.1.2.js" />
<None Include="T4MVC.tt.hooks.t4" />
<Content Include="T4MVC.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>T4MVC.cs</LastGenOutput>
</Content>
<None Include="Views\Device\AddOffline.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>AddOffline.generated.cs</LastGenOutput>
@@ -1921,6 +1930,10 @@
<None Include="_bin_deployableAssemblies\amd64\Microsoft.VC90.CRT\msvcr90.dll" />
<None Include="ClientSource\Scripts\Core\modernizr-2.6.2.js" />
<None Include="T4MVC.tt.settings.xml" />
<Content Include="T4MVC.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>T4MVC.cs</LastGenOutput>
</Content>
<Content Include="Web.config">
<SubType>Designer</SubType>
</Content>
@@ -2007,7 +2020,7 @@
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
<UserProperties BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildAction="Both" BuildVersion_StartDate="2011/7/1" />
<UserProperties BuildVersion_StartDate="2011/7/1" BuildVersion_BuildAction="Both" BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="False" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" />
</VisualStudio>
</ProjectExtensions>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
+2
View File
@@ -13,6 +13,8 @@ namespace Disco.Web.Models.Job
{
public Disco.Models.Repository.Job Job { get; set; }
public bool IsLongRunning { get; set; }
public List<Disco.Models.Repository.DocumentTemplate> AvailableDocumentTemplates { get; set; }
public List<Disco.Models.Repository.JobSubType> UpdatableJobSubTypes { get; set; }
+184
View File
@@ -58,6 +58,7 @@ namespace T4MVC
public Disco.Web.Areas.API.Controllers.DocumentTemplateController DocumentTemplate = new Disco.Web.Areas.API.Controllers.T4MVC_DocumentTemplateController();
public Disco.Web.Areas.API.Controllers.ExpressionsController Expressions = new Disco.Web.Areas.API.Controllers.T4MVC_ExpressionsController();
public Disco.Web.Areas.API.Controllers.JobController Job = new Disco.Web.Areas.API.Controllers.T4MVC_JobController();
public Disco.Web.Areas.API.Controllers.JobPreferencesController JobPreferences = new Disco.Web.Areas.API.Controllers.T4MVC_JobPreferencesController();
public Disco.Web.Areas.API.Controllers.LoggingController Logging = new Disco.Web.Areas.API.Controllers.T4MVC_LoggingController();
public Disco.Web.Areas.API.Controllers.PluginController Plugin = new Disco.Web.Areas.API.Controllers.T4MVC_PluginController();
public Disco.Web.Areas.API.Controllers.SystemController System = new Disco.Web.Areas.API.Controllers.T4MVC_SystemController();
@@ -75,6 +76,7 @@ namespace T4MVC
public Disco.Web.Areas.Config.Controllers.DocumentTemplateController DocumentTemplate = new Disco.Web.Areas.Config.Controllers.T4MVC_DocumentTemplateController();
public Disco.Web.Areas.Config.Controllers.EnrolmentController Enrolment = new Disco.Web.Areas.Config.Controllers.T4MVC_EnrolmentController();
public Disco.Web.Areas.Config.Controllers.ExpressionsController Expressions = new Disco.Web.Areas.Config.Controllers.T4MVC_ExpressionsController();
public Disco.Web.Areas.Config.Controllers.JobPreferencesController JobPreferences = new Disco.Web.Areas.Config.Controllers.T4MVC_JobPreferencesController();
public Disco.Web.Areas.Config.Controllers.LoggingController Logging = new Disco.Web.Areas.Config.Controllers.T4MVC_LoggingController();
public Disco.Web.Areas.Config.Controllers.OrganisationController Organisation = new Disco.Web.Areas.Config.Controllers.T4MVC_OrganisationController();
public Disco.Web.Areas.Config.Controllers.PluginsController Plugins = new Disco.Web.Areas.Config.Controllers.T4MVC_PluginsController();
@@ -758,6 +760,7 @@ namespace Links
private const string URLPATH = "~/ClientSource/Style/Fancytree";
public static string Url() { return T4MVCHelpers.ProcessVirtualPath(URLPATH); }
public static string Url(string fileName) { return T4MVCHelpers.ProcessVirtualPath(URLPATH + "/" + fileName); }
public static readonly string icons_DiscoMod_png = Url("icons-DiscoMod.png");
public static readonly string icons_gif = Url("icons.gif");
public static readonly string loading_gif = Url("loading.gif");
public static readonly string ui_fancytree_css = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/ui.fancytree.min.css") ? Url("ui.fancytree.min.css") : Url("ui.fancytree.css");
@@ -7735,6 +7738,104 @@ namespace Disco.Web.Areas.API.Controllers
}
}
namespace Disco.Web.Areas.API.Controllers
{
public partial class JobPreferencesController
{
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public JobPreferencesController() { }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected JobPreferencesController(Dummy d) { }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected RedirectToRouteResult RedirectToAction(ActionResult result)
{
var callInfo = result.GetT4MVCResult();
return RedirectToRoute(callInfo.RouteValueDictionary);
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected RedirectToRouteResult RedirectToActionPermanent(ActionResult result)
{
var callInfo = result.GetT4MVCResult();
return RedirectToRoutePermanent(callInfo.RouteValueDictionary);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult UpdateLongRunningJobDaysThreshold()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateLongRunningJobDaysThreshold);
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public JobPreferencesController Actions { get { return MVC.API.JobPreferences; } }
[GeneratedCode("T4MVC", "2.0")]
public readonly string Area = "API";
[GeneratedCode("T4MVC", "2.0")]
public readonly string Name = "JobPreferences";
[GeneratedCode("T4MVC", "2.0")]
public const string NameConst = "JobPreferences";
static readonly ActionNamesClass s_actions = new ActionNamesClass();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionNamesClass ActionNames { get { return s_actions; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionNamesClass
{
public readonly string UpdateLongRunningJobDaysThreshold = "UpdateLongRunningJobDaysThreshold";
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionNameConstants
{
public const string UpdateLongRunningJobDaysThreshold = "UpdateLongRunningJobDaysThreshold";
}
static readonly ActionParamsClass_UpdateLongRunningJobDaysThreshold s_params_UpdateLongRunningJobDaysThreshold = new ActionParamsClass_UpdateLongRunningJobDaysThreshold();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_UpdateLongRunningJobDaysThreshold UpdateLongRunningJobDaysThresholdParams { get { return s_params_UpdateLongRunningJobDaysThreshold; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_UpdateLongRunningJobDaysThreshold
{
public readonly string LongRunningJobDaysThreshold = "LongRunningJobDaysThreshold";
public readonly string redirect = "redirect";
}
static readonly ViewsClass s_views = new ViewsClass();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ViewsClass Views { get { return s_views; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ViewsClass
{
static readonly _ViewNamesClass s_ViewNames = new _ViewNamesClass();
public _ViewNamesClass ViewNames { get { return s_ViewNames; } }
public class _ViewNamesClass
{
}
}
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public partial class T4MVC_JobPreferencesController : Disco.Web.Areas.API.Controllers.JobPreferencesController
{
public T4MVC_JobPreferencesController() : base(Dummy.Instance) { }
partial void UpdateLongRunningJobDaysThresholdOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int LongRunningJobDaysThreshold, bool redirect);
public override System.Web.Mvc.ActionResult UpdateLongRunningJobDaysThreshold(int LongRunningJobDaysThreshold, bool redirect)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateLongRunningJobDaysThreshold);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "LongRunningJobDaysThreshold", LongRunningJobDaysThreshold);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateLongRunningJobDaysThresholdOverride(callInfo, LongRunningJobDaysThreshold, redirect);
return callInfo;
}
}
}
namespace Disco.Web.Areas.API.Controllers
{
public partial class LoggingController
@@ -9629,6 +9730,89 @@ namespace Disco.Web.Areas.Config.Controllers
}
}
namespace Disco.Web.Areas.Config.Controllers
{
public partial class JobPreferencesController
{
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public JobPreferencesController() { }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected JobPreferencesController(Dummy d) { }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected RedirectToRouteResult RedirectToAction(ActionResult result)
{
var callInfo = result.GetT4MVCResult();
return RedirectToRoute(callInfo.RouteValueDictionary);
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected RedirectToRouteResult RedirectToActionPermanent(ActionResult result)
{
var callInfo = result.GetT4MVCResult();
return RedirectToRoutePermanent(callInfo.RouteValueDictionary);
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public JobPreferencesController Actions { get { return MVC.Config.JobPreferences; } }
[GeneratedCode("T4MVC", "2.0")]
public readonly string Area = "Config";
[GeneratedCode("T4MVC", "2.0")]
public readonly string Name = "JobPreferences";
[GeneratedCode("T4MVC", "2.0")]
public const string NameConst = "JobPreferences";
static readonly ActionNamesClass s_actions = new ActionNamesClass();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionNamesClass ActionNames { get { return s_actions; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionNamesClass
{
public readonly string Index = "Index";
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionNameConstants
{
public const string Index = "Index";
}
static readonly ViewsClass s_views = new ViewsClass();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ViewsClass Views { get { return s_views; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ViewsClass
{
static readonly _ViewNamesClass s_ViewNames = new _ViewNamesClass();
public _ViewNamesClass ViewNames { get { return s_ViewNames; } }
public class _ViewNamesClass
{
public readonly string Index = "Index";
}
public readonly string Index = "~/Areas/Config/Views/JobPreferences/Index.cshtml";
}
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public partial class T4MVC_JobPreferencesController : Disco.Web.Areas.Config.Controllers.JobPreferencesController
{
public T4MVC_JobPreferencesController() : base(Dummy.Instance) { }
partial void IndexOverride(T4MVC_System_Web_Mvc_ActionResult callInfo);
public override System.Web.Mvc.ActionResult Index()
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Index);
IndexOverride(callInfo);
return callInfo;
}
}
}
namespace Disco.Web.Areas.Config.Controllers
{
public partial class LoggingController
+2 -1
View File
@@ -14,7 +14,8 @@
<div id="Job_Show">
<div id="Job_Show_Status">
@{ var jobStatusInfo = Model.Job.Status();}
<span class="icon JobStatus@(jobStatusInfo.Item1)"></span>@jobStatusInfo.Item2
<span class="icon JobStatus@(jobStatusInfo.Item1)"></span>@jobStatusInfo.Item2 @if (Model.IsLongRunning)
{<span class="smallMessage">(Long Running)</span>}
<script type="text/javascript">
$(function () {
$('#Job_Show_Status').appendTo('#layout_PageHeading')
+35 -13
View File
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18051
// Runtime Version:4.0.30319.34003
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -104,7 +104,29 @@ WriteLiteral("></span>");
#line default
#line hidden
WriteLiteral("\r\n <script");
WriteLiteral(" ");
#line 17 "..\..\Views\Job\Show.cshtml"
if (Model.IsLongRunning)
{
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">(Long Running)</span>");
#line 18 "..\..\Views\Job\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
@@ -114,7 +136,7 @@ WriteLiteral(">\r\n $(function () {\r\n $(\'#Job_Show_
WriteLiteral(" ");
#line 24 "..\..\Views\Job\Show.cshtml"
#line 25 "..\..\Views\Job\Show.cshtml"
Write(Html.Partial(MVC.Job.Views.JobParts._Subject, Model));
@@ -154,13 +176,13 @@ WriteLiteral(" id=\"jobDetailTabItems\"");
WriteLiteral(">\r\n");
#line 60 "..\..\Views\Job\Show.cshtml"
#line 61 "..\..\Views\Job\Show.cshtml"
#line default
#line hidden
#line 60 "..\..\Views\Job\Show.cshtml"
#line 61 "..\..\Views\Job\Show.cshtml"
if (Authorization.HasAll(Claims.Job.ShowLogs, Claims.Job.ShowAttachments))
{
@@ -174,7 +196,7 @@ WriteLiteral(" href=\"#jobDetailTab-Resources\"");
WriteLiteral(">Log and Attachments</a></li>\r\n");
#line 63 "..\..\Views\Job\Show.cshtml"
#line 64 "..\..\Views\Job\Show.cshtml"
}
else if (Authorization.Has(Claims.Job.ShowLogs))
{
@@ -189,7 +211,7 @@ WriteLiteral(" href=\"#jobDetailTab-Resources\"");
WriteLiteral(">Log</a></li>\r\n");
#line 67 "..\..\Views\Job\Show.cshtml"
#line 68 "..\..\Views\Job\Show.cshtml"
}
else if (Authorization.Has(Claims.Job.ShowLogs))
{
@@ -204,7 +226,7 @@ WriteLiteral(" href=\"#jobDetailTab-Resources\"");
WriteLiteral(">Attachments</a></li>\r\n");
#line 71 "..\..\Views\Job\Show.cshtml"
#line 72 "..\..\Views\Job\Show.cshtml"
}
@@ -213,13 +235,13 @@ WriteLiteral(">Attachments</a></li>\r\n");
WriteLiteral(" </ul>\r\n");
#line 73 "..\..\Views\Job\Show.cshtml"
#line 74 "..\..\Views\Job\Show.cshtml"
#line default
#line hidden
#line 73 "..\..\Views\Job\Show.cshtml"
#line 74 "..\..\Views\Job\Show.cshtml"
if (Authorization.HasAny(Claims.Job.ShowLogs, Claims.Job.ShowAttachments))
{
@@ -237,7 +259,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 76 "..\..\Views\Job\Show.cshtml"
#line 77 "..\..\Views\Job\Show.cshtml"
Write(Html.Partial(MVC.Job.Views.JobParts.Resources, Model));
@@ -246,7 +268,7 @@ WriteLiteral(" ");
WriteLiteral("\r\n </div>\r\n");
#line 78 "..\..\Views\Job\Show.cshtml"
#line 79 "..\..\Views\Job\Show.cshtml"
}
@@ -255,7 +277,7 @@ WriteLiteral("\r\n </div>\r\n");
WriteLiteral(" ");
#line 79 "..\..\Views\Job\Show.cshtml"
#line 80 "..\..\Views\Job\Show.cshtml"
Write(Html.Partial(MVC.Job.Views.JobParts.JobMetaAdditions, Model));