Add run time to queue

This commit is contained in:
2017-01-27 14:07:36 -05:00
parent 4338b4fee5
commit 0711ae0ac8
24 changed files with 198 additions and 209 deletions
-62
View File
@@ -1,62 +0,0 @@
using System.Linq;
using AutoMapper;
using LeafWeb.Core.Entities;
namespace LeafWeb.WebCms.Models
{
public class QueueItemViewModel
{
public int LeafInputId { get; set; }
public string LeafInputName { get; set; }
public string LeafInputIdentifier { get; set; }
public string LeafInputSiteId { get; set; }
public string LeafInputPhotosynthesisType { get; set; }
public bool HasLeafChart { get; set; }
public bool IsRunning { get; set; }
public bool IsComplete { get; set; }
public bool IsDeletable { get; set; }
public bool IsCancellable { get; set; }
public bool IsPending { get; set; }
public bool HasOutputFiles { get; set; }
public string CurrentStatus { get; set; }
//public string[] ErrorMessages { get; set; }
//public string[] LeafOutputFilenames { get; set; }
//public bool HasLeafChartOutputFile { get; set; }
static QueueItemViewModel()
{
Mapper.CreateMap<LeafInput, QueueItemViewModel>()
.ForMember(dest => dest.LeafInputId, opt => opt.MapFrom(src => src.Id))
.ForMember(dest => dest.HasLeafChart, opt => opt.ResolveUsing(src => src.OutputFiles.Any(o => o.IsLeafChartFile)))
//.ForMember(dest => dest.LeafOutputFilenames,
// opt => opt.ResolveUsing(
// src =>
// src.OutputFiles?
// .Select(o => o.Filename)
// .ToArray()
// ?? new string[] {}))
//.ForMember(dest => dest.HasLeafChartOutputFile,
// opt => opt.ResolveUsing(
// file => file.OutputFiles?.Any(o => o.IsLeafChartFile)))
.ForMember(dest => dest.LeafInputName, opt => opt.MapFrom(src => src.Name))
.ForMember(dest => dest.LeafInputIdentifier, opt => opt.MapFrom(src => src.Identifier))
.ForMember(dest => dest.LeafInputSiteId, opt => opt.MapFrom(src => src.SiteId))
.ForMember(dest => dest.LeafInputPhotosynthesisType, opt => opt.MapFrom(src => src.PhotosynthesisType.Name))
//.ForMember(dest => dest.ErrorMessages,
// opt => opt.ResolveUsing(
// src =>
// src.StatusHistory?
// .Where(sh => sh.Status == LeafInputStatusType.Exception)
// .Select(sh => sh.Description)
// .ToArray()
// ?? new string[] {}))
;
}
public QueueItemViewModel(LeafInput leafInput)
{
Mapper.Map(leafInput, this);
}
}
}
+2 -1
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using LeafWeb.Core.Entities;
namespace LeafWeb.WebCms.Models
{
@@ -6,6 +7,6 @@ namespace LeafWeb.WebCms.Models
{
public string ServerDescription { get; set; }
public string ServerStatus { get; set; }
public IEnumerable<QueueItemViewModel> Items { get; set; }
public IEnumerable<LeafInput> Items { get; set; }
}
}