Details and queue management

This commit is contained in:
2017-01-06 08:43:22 -05:00
parent d14e40a36b
commit 42ac27e16f
24 changed files with 260 additions and 51 deletions
+20 -1
View File
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web.Mvc;
using AutoMapper;
using LeafWeb.Core.Entities;
using LeafWeb.Core.Utility;
@@ -9,6 +11,9 @@ namespace LeafWeb.WebCms.Models
{
public class LeafInputDetails
{
[HiddenInput(DisplayValue = false)]
public int LeafInputId { get; set; }
[Display(Name = "Name")]
[Required(ErrorMessage = "Name required")]
[RegularExpression(@"[A-Za-z().]+(\s+[A-Za-z().]+)+", ErrorMessage = "Please provide full name")]
@@ -48,6 +53,18 @@ namespace LeafWeb.WebCms.Models
[UIHint("LeafInputStatusViewModels")]
public List<LeafInputStatusViewModel> StatusHistory { get; set; }
[HiddenInput(DisplayValue = false)]
public bool HasLeafChart { get; set; }
[HiddenInput(DisplayValue = false)]
public bool IsRunning { get; set; }
[HiddenInput(DisplayValue = false)]
public bool IsComplete { get; set; }
[HiddenInput(DisplayValue = false)]
public bool IsDeletable { get; set; }
static LeafInputDetails()
{
Mapper.CreateMap<LeafInputFile, string>().ConvertUsing(file => file?.Contents.GetString());
@@ -55,7 +72,9 @@ namespace LeafWeb.WebCms.Models
Mapper.CreateMap<LeafInputStatusType, string>().ConvertUsing(st => st.ToString());
Mapper.CreateMap<LeafInputStatusType, LeafInputStatus>().ConvertUsing(st => new LeafInputStatus());
Mapper.CreateMap<LeafInputStatus, LeafInputStatusViewModel>();
Mapper.CreateMap<LeafInput, LeafInputDetails>();
Mapper.CreateMap<LeafInput, LeafInputDetails>()
.ForMember(dest => dest.LeafInputId, opt => opt.MapFrom(src => src.Id))
.ForMember(dest => dest.HasLeafChart, opt => opt.ResolveUsing(src => src.OutputFiles.Any(o => o.IsLeafChartFile)));
}
public LeafInputDetails(LeafInput leafInput)