From e3779a323c2ad1d6ab5dac33399a6c7686706c4c Mon Sep 17 00:00:00 2001 From: James Kolpack Date: Wed, 1 Feb 2017 09:41:08 -0500 Subject: [PATCH] Add priority --- Core/Core.csproj | 8 ++ Core/DAL/DataService.cs | 8 ++ Core/Entities/LeafInput.cs | 81 +++++------ Core/Entities/Priority.cs | 9 ++ ...01701311417095_PendingPriority.Designer.cs | 29 ++++ .../201701311417095_PendingPriority.cs | 18 +++ .../201701311417095_PendingPriority.resx | 126 ++++++++++++++++++ WebCms/App_Data/Models/all.dll.path | 2 +- WebCms/Controllers/QueueController.cs | 35 ++++- WebCms/Controllers/ResultsController.cs | 8 +- WebCms/Models/LeafInputDetails.cs | 3 + .../LeafWebUmbraco - Web Deploy.pubxml | 20 +-- .../PiscalQueue/PiscalQueueManager.cs | 5 +- WebCms/Views/Queue/Index.cshtml | 42 +++--- WebCms/Views/Results/Index.cshtml | 2 +- .../DisplayTemplates/PriorityIcon.cshtml | 12 ++ .../Shared/DisplayTemplates/TimeSpan.cshtml | 13 ++ .../DisplayTemplates/_PriorityForm.cshtml | 24 ++++ WebCms/WebCms.csproj | 3 + 19 files changed, 365 insertions(+), 83 deletions(-) create mode 100644 Core/Entities/Priority.cs create mode 100644 Core/Migrations/201701311417095_PendingPriority.Designer.cs create mode 100644 Core/Migrations/201701311417095_PendingPriority.cs create mode 100644 Core/Migrations/201701311417095_PendingPriority.resx create mode 100644 WebCms/Views/Shared/DisplayTemplates/PriorityIcon.cshtml create mode 100644 WebCms/Views/Shared/DisplayTemplates/TimeSpan.cshtml create mode 100644 WebCms/Views/Shared/DisplayTemplates/_PriorityForm.cshtml diff --git a/Core/Core.csproj b/Core/Core.csproj index 91b3299..c172445 100644 --- a/Core/Core.csproj +++ b/Core/Core.csproj @@ -87,6 +87,7 @@ + @@ -112,6 +113,10 @@ 201605210257006_LeafOutputFileContents.cs + + + 201701311417095_PendingPriority.cs + @@ -172,6 +177,9 @@ 201605210257006_LeafOutputFileContents.cs + + 201701311417095_PendingPriority.cs + diff --git a/Core/DAL/DataService.cs b/Core/DAL/DataService.cs index 6a53e5e..92a8d1f 100644 --- a/Core/DAL/DataService.cs +++ b/Core/DAL/DataService.cs @@ -54,6 +54,14 @@ namespace LeafWeb.Core.DAL return _db.LeafInputs; } + public IQueryable GetLeafInputsOrdered() + { + return _db.LeafInputs + .OrderByDescending(li => li.CurrentStatus == LeafInputStatusType.Pending) + .ThenByDescending(li => li.PendingPriority) + .ThenByDescending(li => li.Id); + } + public LeafInput GetLeafInput(int id) { return _db.LeafInputs.FirstOrDefault(li => li.Id == id); diff --git a/Core/Entities/LeafInput.cs b/Core/Entities/LeafInput.cs index 3d41ad6..dc53d5a 100644 --- a/Core/Entities/LeafInput.cs +++ b/Core/Entities/LeafInput.cs @@ -8,17 +8,53 @@ using System.Linq; namespace LeafWeb.Core.Entities { - public abstract class LeafInputBase + public class LeafInput { + public int Id { get; set; } + + public virtual ICollection InputFiles { get; set; } + public virtual ICollection LeafInputData { get; set; } public virtual ICollection OutputFiles { get; set; } + + [Required(ErrorMessage = "Name required")] + public string Name { get; set; } + + [Required(ErrorMessage = "An email address is required")] + public string Email { get; set; } + + [Required(ErrorMessage = "A unique identifier is required")] + public string Identifier { get; set; } + + [Required(ErrorMessage = "Site Id required")] + public string SiteId { get; set; } + + [Required] + [Column(TypeName = "VARCHAR")] + [StringLength(12)] + [Index("IX_UniqueToken", 1, IsUnique = true)] + public string UniqueToken { get; set; } + + // [Required(ErrorMessage = "PhotosynthesisType required")] + // http://stackoverflow.com/questions/6038541/ef-validation-failing-on-update-when-using-lazy-loaded-required-properties + public virtual PhotosynthesisType PhotosynthesisType { get; set; } + + [DataType(DataType.Date)] + [Required] + public DateTime Added { get; set; } + + public LeafInputStatusType CurrentStatus { get; set; } + + public virtual ICollection StatusHistory { get; set; } + + public Priority PendingPriority { get; set; } + + #region Calculated properties + public LeafOutputFile OutputErrorMessage => OutputFiles?.FirstOrDefault(f => f.IsErrorMessage); public LeafOutputFile OutputWarningMessage => OutputFiles?.FirstOrDefault(f => f.IsWarningMessage); public bool HasOutputFiles => OutputFiles.Any(); public bool HasLeafChart => OutputFiles.Any(f => f.IsLeafChartFile); - public LeafInputStatusType CurrentStatus { get; set; } - public virtual ICollection StatusHistory { get; set; } - public bool IsPending => CurrentStatus == LeafInputStatusType.Pending; public bool IsStarting => CurrentStatus == LeafInputStatusType.Starting; public bool IsRunning => CurrentStatus == LeafInputStatusType.Running; @@ -42,7 +78,6 @@ namespace LeafWeb.Core.Entities public bool IsDeletable => !IsInProgress; public bool IsAtEndState => IsComplete || IsException || IsCancelled; - public DateTime? StartTime { get @@ -71,7 +106,7 @@ namespace LeafWeb.Core.Entities } } - public TimeSpan TotalInProgressTime + public TimeSpan TimeInProgress { get { @@ -90,40 +125,8 @@ namespace LeafWeb.Core.Entities return end.Value - start.Value; } } - } - public class LeafInput : LeafInputBase - { - public int Id { get; set; } - - public virtual ICollection InputFiles { get; set; } - public virtual ICollection LeafInputData { get; set; } - - [Required(ErrorMessage = "Name required")] - public string Name { get; set; } - - [Required(ErrorMessage = "An email address is required")] - public string Email { get; set; } - - [Required(ErrorMessage = "A unique identifier is required")] - public string Identifier { get; set; } - - [Required(ErrorMessage = "Site Id required")] - public string SiteId { get; set; } - - [Required] - [Column(TypeName = "VARCHAR")] - [StringLength(12)] - [Index("IX_UniqueToken", 1, IsUnique = true)] - public string UniqueToken { get; set; } - - // [Required(ErrorMessage = "PhotosynthesisType required")] - // http://stackoverflow.com/questions/6038541/ef-validation-failing-on-update-when-using-lazy-loaded-required-properties - public virtual PhotosynthesisType PhotosynthesisType { get; set; } - - [DataType(DataType.Date)] - [Required] - public DateTime Added { get; set; } + #endregion public override string ToString() { diff --git a/Core/Entities/Priority.cs b/Core/Entities/Priority.cs new file mode 100644 index 0000000..5e4a239 --- /dev/null +++ b/Core/Entities/Priority.cs @@ -0,0 +1,9 @@ +namespace LeafWeb.Core.Entities +{ + public enum Priority + { + Normal = 0, + Low = -1, + High = 1 + } +} \ No newline at end of file diff --git a/Core/Migrations/201701311417095_PendingPriority.Designer.cs b/Core/Migrations/201701311417095_PendingPriority.Designer.cs new file mode 100644 index 0000000..814cc05 --- /dev/null +++ b/Core/Migrations/201701311417095_PendingPriority.Designer.cs @@ -0,0 +1,29 @@ +// +namespace LeafWeb.Core.Migrations +{ + using System.CodeDom.Compiler; + using System.Data.Entity.Migrations; + using System.Data.Entity.Migrations.Infrastructure; + using System.Resources; + + [GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")] + public sealed partial class PendingPriority : IMigrationMetadata + { + private readonly ResourceManager Resources = new ResourceManager(typeof(PendingPriority)); + + string IMigrationMetadata.Id + { + get { return "201701311417095_PendingPriority"; } + } + + string IMigrationMetadata.Source + { + get { return null; } + } + + string IMigrationMetadata.Target + { + get { return Resources.GetString("Target"); } + } + } +} diff --git a/Core/Migrations/201701311417095_PendingPriority.cs b/Core/Migrations/201701311417095_PendingPriority.cs new file mode 100644 index 0000000..c883e76 --- /dev/null +++ b/Core/Migrations/201701311417095_PendingPriority.cs @@ -0,0 +1,18 @@ +namespace LeafWeb.Core.Migrations +{ + using System; + using System.Data.Entity.Migrations; + + public partial class PendingPriority : DbMigration + { + public override void Up() + { + AddColumn("dbo.LeafInput", "PendingPriority", c => c.Int(nullable: false)); + } + + public override void Down() + { + DropColumn("dbo.LeafInput", "PendingPriority"); + } + } +} diff --git a/Core/Migrations/201701311417095_PendingPriority.resx b/Core/Migrations/201701311417095_PendingPriority.resx new file mode 100644 index 0000000..67ab924 --- /dev/null +++ b/Core/Migrations/201701311417095_PendingPriority.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b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ZhnxAVRdA2K5Idnp+Wwy1gCd28pbtvdcN8hR9LVXHSzNfZ3co4lr+Ww8Izilt1dxxCdixWGtQxO03gOdf/WoszjXg8vlUlf0g/H8lhwCU7s1V0DiIL4pgQGlxoR8VXNCEUiDtanZ3GpdyNp0Xc61fVOzltbcG6G6hb4hmm9sjBZxaJDVZpQtsgV0TbJlQG12phpL211Bex90AfSlvqi2ilI/lPFmFH1QlXMd8GafoB/ypoRx0NXxyM2TSdQXzLNKLG2dXuZ3281d00gyRRlrN5RSzf5guzL8ouXFduuxnWmR1wZRk5ch8zGdOTykdDOl/7v2YkAvA3VMVkDdTl0Z1MmJGKxIU4QzDEgCAIPA+cKHBDCe6kkC+2mBhiDAYwbjFl0fQc5GKP1aZHogJjTp7DPIbkgPyj+9iOs1iVTrp2km2Q2mFpsx81n2tduHuD5kkcOSGWhiNoWGly+82qIMkhaQFCoTnm0xfg6JsjnR62axstHI3dw1rOai1kStz6kEJqXCQGMjoM2mMyzZWC1Z8/yGO4mkAHlt3v6EKtl1Av4pBcLbn1yvU+KhQH8dY1m66CBIfL8UzTjbR1uGRBxqzC9Cj5oiYvQnVEZz/IGHeRnfRbMSZ89QUcTpYjz6HCVrRNydb9H8LKVTl4ReWt4m3COYxJRjan9/IvV5/7JyFilCfALuZkycOi7Tb9ZxMm/7faq4u66BIDai2qGGjGVJHGsWTy3Sxyx1BKrJ15q2btBylWCw4jKdRmTHAO/bpwKdo0U0e7qq4xnqQewDwZN9/ziOFnm0LGqMrj7+iXl4vnz86v8X5kcCduwAAA== + + + dbo + + \ No newline at end of file diff --git a/WebCms/App_Data/Models/all.dll.path b/WebCms/App_Data/Models/all.dll.path index cdffceb..c6b3fd4 100644 --- a/WebCms/App_Data/Models/all.dll.path +++ b/WebCms/App_Data/Models/all.dll.path @@ -1 +1 @@ -C:\Users\poprhythm\AppData\Local\Temp\Temporary ASP.NET Files\vs\f80e29bb\faae20bf\App_Web_all.generated.cs.8f9494c4.tezx-cyz.dll \ No newline at end of file +C:\Users\poprhythm\AppData\Local\Temp\Temporary ASP.NET Files\vs\f80e29bb\faae20bf\App_Web_all.generated.cs.8f9494c4.ewo9-3jr.dll \ No newline at end of file diff --git a/WebCms/Controllers/QueueController.cs b/WebCms/Controllers/QueueController.cs index 8ddb862..5053e9e 100644 --- a/WebCms/Controllers/QueueController.cs +++ b/WebCms/Controllers/QueueController.cs @@ -16,9 +16,7 @@ namespace LeafWeb.WebCms.Controllers { public ActionResult Index() { - var resultItems = - DataService.GetLeafInputs() - .OrderByDescending(f => f.Id); + var resultItems = DataService.GetLeafInputsOrdered(); string serviceDescription; try @@ -43,7 +41,10 @@ namespace LeafWeb.WebCms.Controllers var leafInput = DataService.GetLeafInput(id); if (leafInput == null) + { + SetStatusMessage($"LeafInput '${id}' not found, may have been deleted?"); RedirectToUmbracoPage(LeafWebPageIds.ManageQueue); + } var viewModel = new LeafInputDetails(leafInput); return View(viewModel); @@ -150,7 +151,11 @@ namespace LeafWeb.WebCms.Controllers public ActionResult SendUserDownloadLink(int id) { var leafInput = DataService.GetLeafInput(id); - if (!leafInput.IsComplete) + if (leafInput == null) + { + SetStatusMessage($"LeafInput '${id}' not found, may have been deleted?"); + } + else if (!leafInput.IsComplete) { SetStatusMessage($"LeafInput '{leafInput.Identifier}' is not complete!", StatusType.Error); } @@ -164,6 +169,28 @@ namespace LeafWeb.WebCms.Controllers return RedirectToCurrentUmbracoUrl(); } + [ActionLog] + public ActionResult Priority(int id, Priority priority) + { + var leafInput = DataService.GetLeafInput(id); + if (leafInput == null) + { + SetStatusMessage($"LeafInput '${id}' not found, may have been deleted?"); + } + else if (!leafInput.IsPending) + { + SetStatusMessage($"LeafInput '{leafInput.Identifier}' is no longer pending"); + } + else + { + leafInput.PendingPriority = priority; + DataService.UpdateLeafInput(leafInput); + SetStatusMessage($"LeafInput '{leafInput.Identifier}' priority set to '{leafInput.PendingPriority}'", StatusType.Success); + } + + return RedirectToCurrentUmbracoUrl(); + } + [ActionLog] public ActionResult SendUserChartLink(int id) { diff --git a/WebCms/Controllers/ResultsController.cs b/WebCms/Controllers/ResultsController.cs index fcfb7d4..126fb98 100644 --- a/WebCms/Controllers/ResultsController.cs +++ b/WebCms/Controllers/ResultsController.cs @@ -3,7 +3,6 @@ using System.Linq; using System.Web.Mvc; using LeafWeb.Core.Entities; using LeafWeb.Core.Utility; -using LeafWeb.WebCms.Models; namespace LeafWeb.WebCms.Controllers { @@ -13,12 +12,9 @@ namespace LeafWeb.WebCms.Controllers { var dateThreshold = DateTime.Today.Subtract(TimeSpan.FromDays(90)); var viewModel = - ( - from li in DataService.GetLeafInputs() + from li in DataService.GetLeafInputsOrdered() where li.Added >= dateThreshold - orderby li.Id descending - select li - ); + select li; return View(viewModel); } diff --git a/WebCms/Models/LeafInputDetails.cs b/WebCms/Models/LeafInputDetails.cs index 87efdc7..6876201 100644 --- a/WebCms/Models/LeafInputDetails.cs +++ b/WebCms/Models/LeafInputDetails.cs @@ -47,6 +47,9 @@ namespace LeafWeb.WebCms.Models [Display(Name = "Piscal Warning")] public string OutputWarningMessage { get; set; } + [Display(Name = "Time In Progress")] + public TimeSpan TimeInProgress { get; set; } + [UIHint("LeafInputStatusViewModels")] public List StatusHistory { get; set; } diff --git a/WebCms/Properties/PublishProfiles/LeafWebUmbraco - Web Deploy.pubxml b/WebCms/Properties/PublishProfiles/LeafWebUmbraco - Web Deploy.pubxml index 58f8dbd..4c1e0a3 100644 --- a/WebCms/Properties/PublishProfiles/LeafWebUmbraco - Web Deploy.pubxml +++ b/WebCms/Properties/PublishProfiles/LeafWebUmbraco - Web Deploy.pubxml @@ -14,12 +14,12 @@ by editing this MSBuild file. In order to learn more about this please visit htt True False leafwebumbraco.scm.azurewebsites.net:443 - - - Delete - filePath - Media - + + + Delete + filePath + Media + LeafWebUmbraco True @@ -30,7 +30,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt <_DestinationType>AzureWebSite - + @@ -49,9 +49,9 @@ by editing this MSBuild file. In order to learn more about this please visit htt - - true - + + true + Data Source=tcp:leafweb.database.windows.net,1433;Initial Catalog=leafwebUmbraco;User ID=lwadmin@leafweb;Password=j4f1a2e! diff --git a/WebCms/Services/PiscalQueue/PiscalQueueManager.cs b/WebCms/Services/PiscalQueue/PiscalQueueManager.cs index 259440d..cfdf761 100644 --- a/WebCms/Services/PiscalQueue/PiscalQueueManager.cs +++ b/WebCms/Services/PiscalQueue/PiscalQueueManager.cs @@ -185,9 +185,8 @@ namespace LeafWeb.WebCms.Services.PiscalQueue var pendingInput = DataService - .GetLeafInputs(LeafInputStatusType.Pending) - .OrderBy(l => l.StatusHistory.Min(sh => sh.DateTime)) - .FirstOrDefault(); + .GetLeafInputsOrdered() + .FirstOrDefault(li => li.CurrentStatus == LeafInputStatusType.Pending); if (pendingInput == null) { diff --git a/WebCms/Views/Queue/Index.cshtml b/WebCms/Views/Queue/Index.cshtml index fad3c1d..c149475 100644 --- a/WebCms/Views/Queue/Index.cshtml +++ b/WebCms/Views/Queue/Index.cshtml @@ -1,4 +1,5 @@ -@model QueueViewModel +@using LeafWeb.Core.Entities +@model QueueViewModel @{ var grid = new WebGrid(Model.Items, rowsPerPage: 45); @@ -15,7 +16,7 @@ grid.Column("SiteId", "Site Id"), grid.Column("Name", "Submitted By"), //grid.Column("FileCount", "Input files"), - grid.Column("TotalInProgressTime", "In-Progress Time", item => ((TimeSpan)item.TotalInProgressTime).ToRoundedReadableString()), + grid.Column("TimeInProgress", "Time In Progress", item => TimeInProgress(item.TimeInProgress)), grid.Column("CurrentStatus", "Status", item => Html.Partial("DisplayTemplates/_LeafInputStatus", (string)item.CurrentStatus.ToString())), grid.Column("Total Results: " + Model.Items.Count(), format: item => Btns(item))), htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed" } @@ -33,15 +34,19 @@