Leaf Input Details
This commit is contained in:
@@ -12,5 +12,10 @@ namespace LeafWeb.Core.Entities
|
|||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
public int SortOrder { get; set; }
|
public int SortOrder { get; set; }
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core.Tests", "Core.Tests\Co
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebCms", "WebCms\WebCms.csproj", "{63D7EBED-ECF5-4227-B2D3-B77FBE4C3B3A}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebCms", "WebCms\WebCms.csproj", "{63D7EBED-ECF5-4227-B2D3-B77FBE4C3B3A}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebCms.Tests", "WebCms.Tests\WebCms.Tests.csproj", "{D46179A2-58D6-46A3-9C5E-53D143A15277}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -39,6 +41,10 @@ Global
|
|||||||
{63D7EBED-ECF5-4227-B2D3-B77FBE4C3B3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{63D7EBED-ECF5-4227-B2D3-B77FBE4C3B3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{63D7EBED-ECF5-4227-B2D3-B77FBE4C3B3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{63D7EBED-ECF5-4227-B2D3-B77FBE4C3B3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{63D7EBED-ECF5-4227-B2D3-B77FBE4C3B3A}.Release|Any CPU.Build.0 = Release|Any CPU
|
{63D7EBED-ECF5-4227-B2D3-B77FBE4C3B3A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{D46179A2-58D6-46A3-9C5E-53D143A15277}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{D46179A2-58D6-46A3-9C5E-53D143A15277}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{D46179A2-58D6-46A3-9C5E-53D143A15277}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{D46179A2-58D6-46A3-9C5E-53D143A15277}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -44,7 +44,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="ViewModels\ResultStatus\ResultStatusViewModelTests.cs" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="app.config" />
|
<None Include="app.config" />
|
||||||
|
|||||||
@@ -0,0 +1,92 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using LeafWeb.Core.Entities;
|
||||||
|
using LeafWeb.WebCms.Models;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace LeafWeb.WebCms.Tests.Models
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class LeafInputDetailsTests
|
||||||
|
{
|
||||||
|
private LeafInput GetLeafInput()
|
||||||
|
{
|
||||||
|
return new LeafInput
|
||||||
|
{
|
||||||
|
CurrentStatus = LeafInputStatusType.Complete,
|
||||||
|
OutputFiles = new[] { new LeafOutputFile { Filename = "OutputFilename.txt" } },
|
||||||
|
Added = DateTime.Today,
|
||||||
|
Email = "test@email.com",
|
||||||
|
Identifier = "Ident I Fier",
|
||||||
|
Name = "My Name",
|
||||||
|
PhotosynthesisType = new PhotosynthesisType { Id = "1", Name = "1", SortOrder = 1 },
|
||||||
|
InputFiles = new[]
|
||||||
|
{
|
||||||
|
new LeafInputFile
|
||||||
|
{
|
||||||
|
Filename = "MyFilename.ext",
|
||||||
|
Id = 3
|
||||||
|
}
|
||||||
|
},
|
||||||
|
StatusHistory = new List<LeafInputStatus> {
|
||||||
|
new LeafInputStatus
|
||||||
|
{
|
||||||
|
DateTime = DateTime.Today.Subtract(new TimeSpan(4,0,0)),
|
||||||
|
Description = "Added",
|
||||||
|
Details = "Uploaded from Web",
|
||||||
|
Id = 1,
|
||||||
|
Status = LeafInputStatusType.Pending
|
||||||
|
},
|
||||||
|
new LeafInputStatus
|
||||||
|
{
|
||||||
|
DateTime = DateTime.Today.Subtract(new TimeSpan(3,0,0)),
|
||||||
|
Description = "Uploading input data",
|
||||||
|
Id = 2,
|
||||||
|
Status = LeafInputStatusType.Starting
|
||||||
|
},
|
||||||
|
new LeafInputStatus
|
||||||
|
{
|
||||||
|
DateTime = DateTime.Today.Subtract(new TimeSpan(2,12,0)),
|
||||||
|
Description = "Running on server",
|
||||||
|
Id = 3,
|
||||||
|
Status = LeafInputStatusType.Running
|
||||||
|
},
|
||||||
|
new LeafInputStatus
|
||||||
|
{
|
||||||
|
DateTime = DateTime.Today.Subtract(new TimeSpan(1,0,0)),
|
||||||
|
Description = "Downloading results",
|
||||||
|
Id = 4,
|
||||||
|
Status = LeafInputStatusType.Finishing
|
||||||
|
},
|
||||||
|
new LeafInputStatus
|
||||||
|
{
|
||||||
|
DateTime = DateTime.Today.Subtract(new TimeSpan(0,12,0)),
|
||||||
|
Description = "All done",
|
||||||
|
Id = 5,
|
||||||
|
Status = LeafInputStatusType.Complete
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CanConstructFromLeafInputFile()
|
||||||
|
{
|
||||||
|
var leafInput = GetLeafInput();
|
||||||
|
var viewModel = new LeafInputDetails(leafInput);
|
||||||
|
|
||||||
|
Assert.That(viewModel.CurrentStatus, Is.EqualTo(leafInput.CurrentStatus.ToString()));
|
||||||
|
Assert.That(viewModel.StatusHistory, Has.Count.EqualTo(5));
|
||||||
|
Assert.That(viewModel.StatusHistory[0].Status, Is.EqualTo("Pending"));
|
||||||
|
Assert.That(viewModel.StatusHistory[1].Status, Is.EqualTo("Starting"));
|
||||||
|
Assert.That(viewModel.StatusHistory[4].Status, Is.EqualTo("Complete"));
|
||||||
|
//Assert.That(viewModel., Is.EqualTo(leafInput.Id));
|
||||||
|
//Assert.That(viewModel.LeafOutputFilenames, Has.Length.EqualTo(1));
|
||||||
|
//Assert.That(viewModel., Is.EqualTo(leafInput.Identifier));
|
||||||
|
Assert.That(viewModel.SiteId, Is.EqualTo(leafInput.SiteId));
|
||||||
|
//Assert.That(viewModel.LeafInputPhotosynthesisType, Is.EqualTo(leafInput.PhotosynthesisType.Name));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-3
@@ -1,10 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using LeafWeb.Core.Entities;
|
using LeafWeb.Core.Entities;
|
||||||
using LeafWeb.Web.ViewModels.Results;
|
using LeafWeb.WebCms.Models;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace LeafWeb.Web.Tests.ViewModels.ResultStatus
|
namespace LeafWeb.WebCms.Tests.Models
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class ResultStatusViewModelTests
|
public class ResultStatusViewModelTests
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("WebCms.Tests")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("WebCms.Tests")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("d46179a2-58d6-46a3-9c5e-53d143a15277")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{D46179A2-58D6-46A3-9C5E-53D143A15277}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>LeafWeb.WebCms.Tests</RootNamespace>
|
||||||
|
<AssemblyName>WebCms.Tests</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="nunit.framework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\NUnit.3.5.0\lib\net45\nunit.framework.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Models\LeafInputDetailsTests.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Models\ResultStatusViewModelTests.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Core\Core.csproj">
|
||||||
|
<Project>{25baed75-7e75-4d11-90d9-358472054df6}</Project>
|
||||||
|
<Name>Core</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\WebCms\WebCms.csproj">
|
||||||
|
<Project>{63d7ebed-ecf5-4227-b2d3-b77fbe4c3b3a}</Project>
|
||||||
|
<Name>WebCms</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="NUnit" version="3.5.0" targetFramework="net452" />
|
||||||
|
</packages>
|
||||||
@@ -1 +1 @@
|
|||||||
C:\Users\poprhythm\AppData\Local\Temp\Temporary ASP.NET Files\vs\f80e29bb\faae20bf\App_Web_all.generated.cs.8f9494c4.agsib7ro.dll
|
C:\Users\poprhythm\AppData\Local\Temp\Temporary ASP.NET Files\vs\f80e29bb\faae20bf\App_Web_all.generated.cs.8f9494c4.ymeptwl9.dll
|
||||||
@@ -21,7 +21,7 @@ namespace LeafWeb.WebCms.Controllers
|
|||||||
public ActionResult Details(int id)
|
public ActionResult Details(int id)
|
||||||
{
|
{
|
||||||
var leafInput = DataService.GetLeafInput(id);
|
var leafInput = DataService.GetLeafInput(id);
|
||||||
var viewModel = new LeafInputCreate();
|
var viewModel = new LeafInputDetails(leafInput);
|
||||||
return View(viewModel);
|
return View(viewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using LeafWeb.Core.DAL;
|
using LeafWeb.Core.DAL;
|
||||||
|
using LeafWeb.Core.Entities;
|
||||||
|
|
||||||
namespace LeafWeb.WebCms.Models
|
namespace LeafWeb.WebCms.Models
|
||||||
{
|
{
|
||||||
@@ -36,18 +37,20 @@ namespace LeafWeb.WebCms.Models
|
|||||||
|
|
||||||
static LeafInputCreate()
|
static LeafInputCreate()
|
||||||
{
|
{
|
||||||
Mapper.CreateMap<LeafInputCreate, Core.Entities.LeafInput>()
|
Mapper.CreateMap<LeafInputCreate, LeafInput>()
|
||||||
|
.ForMember(dest => dest.PhotosynthesisType, opt => opt.Ignore());
|
||||||
|
Mapper.CreateMap<LeafInput, LeafInputCreate>()
|
||||||
.ForMember(dest => dest.PhotosynthesisType, opt => opt.Ignore());
|
.ForMember(dest => dest.PhotosynthesisType, opt => opt.Ignore());
|
||||||
}
|
}
|
||||||
|
|
||||||
public LeafInputCreate()
|
public LeafInputCreate()
|
||||||
{
|
{
|
||||||
//PhotosynthesisType = new SelectListViewModel();
|
PhotosynthesisType = new SelectListViewModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Core.Entities.LeafInput GetLeafInput(DataService db)
|
public LeafInput GetLeafInput(DataService db)
|
||||||
{
|
{
|
||||||
var leafInput = new Core.Entities.LeafInput();
|
var leafInput = new LeafInput();
|
||||||
Mapper.Map(this, leafInput);
|
Mapper.Map(this, leafInput);
|
||||||
|
|
||||||
leafInput.PhotosynthesisType = db.GetPhotosynthesisType(PhotosynthesisType.Selected);
|
leafInput.PhotosynthesisType = db.GetPhotosynthesisType(PhotosynthesisType.Selected);
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using AutoMapper;
|
||||||
|
using LeafWeb.Core.Entities;
|
||||||
|
|
||||||
|
namespace LeafWeb.WebCms.Models
|
||||||
|
{
|
||||||
|
public class LeafInputDetails
|
||||||
|
{
|
||||||
|
[Display(Name = "Name")]
|
||||||
|
[Required(ErrorMessage = "Name required")]
|
||||||
|
[RegularExpression(@"[A-Za-z().]+(\s+[A-Za-z().]+)+", ErrorMessage = "Please provide full name")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[Display(Name = "Email address")]
|
||||||
|
[Required(ErrorMessage = "An email address is required")]
|
||||||
|
[DataType(DataType.EmailAddress)]
|
||||||
|
[RegularExpression(@"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}", ErrorMessage = "Must be an email address")]
|
||||||
|
public string Email { get; set; }
|
||||||
|
|
||||||
|
[Display(Name = "Identifier")]
|
||||||
|
[Required(ErrorMessage = "A unique identifier is required")]
|
||||||
|
public string Identifier { get; set; }
|
||||||
|
|
||||||
|
[Display(Name = "Site Id")]
|
||||||
|
[Required(ErrorMessage = "The site's name is required")]
|
||||||
|
public string SiteId { get; set; }
|
||||||
|
|
||||||
|
[Display(Name = "Photosyn. Pathway")]
|
||||||
|
[Required(ErrorMessage = "A Photosynthetic pathway must be chosen")]
|
||||||
|
public string PhotosynthesisType { get; set; }
|
||||||
|
|
||||||
|
[DataType(DataType.Date)]
|
||||||
|
[Required]
|
||||||
|
public DateTime Added { get; set; }
|
||||||
|
|
||||||
|
[UIHint("Status")]
|
||||||
|
public string CurrentStatus { get; set; }
|
||||||
|
|
||||||
|
[UIHint("LeafInputStatusViewModels")]
|
||||||
|
public List<LeafInputStatusViewModel> StatusHistory { get; set; }
|
||||||
|
|
||||||
|
static LeafInputDetails()
|
||||||
|
{
|
||||||
|
Mapper.CreateMap<LeafInputStatusType, string>().ConvertUsing(st => st.ToString());
|
||||||
|
Mapper.CreateMap<LeafInputStatusType, LeafInputStatus>().ConvertUsing(st => new LeafInputStatus());
|
||||||
|
Mapper.CreateMap<LeafInputStatus, LeafInputStatusViewModel>();
|
||||||
|
Mapper.CreateMap<LeafInput, LeafInputDetails>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LeafInputDetails(LeafInput leafInput)
|
||||||
|
{
|
||||||
|
Mapper.Map(leafInput, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using AutoMapper;
|
||||||
|
using LeafWeb.Core.Entities;
|
||||||
|
|
||||||
|
namespace LeafWeb.WebCms.Models
|
||||||
|
{
|
||||||
|
public class LeafInputStatusViewModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
[UIHint("Status")]
|
||||||
|
public string Status { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public string Details { get; set; }
|
||||||
|
public DateTime DateTime { get; set; }
|
||||||
|
|
||||||
|
static LeafInputStatusViewModel()
|
||||||
|
{
|
||||||
|
Mapper.CreateMap<LeafInputStatus, LeafInputStatusViewModel>()
|
||||||
|
.ForMember(dest => dest.Status, opt => opt.MapFrom(li => li.Status.ToString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public LeafInputStatusViewModel() { }
|
||||||
|
|
||||||
|
public LeafInputStatusViewModel(LeafInputStatus status)
|
||||||
|
{
|
||||||
|
Mapper.Map(status, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
@model LeafWeb.WebCms.Models.LeafInputCreate
|
@model LeafWeb.WebCms.Models.LeafInputDetails
|
||||||
|
|
||||||
@Html.DisplayForModel()
|
@Html.DisplayForModel()
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
grid.Column("LeafInputIdentifier", "Identifier"),
|
grid.Column("LeafInputIdentifier", "Identifier"),
|
||||||
grid.Column("LeafInputSiteId", "Site Id"),
|
grid.Column("LeafInputSiteId", "Site Id"),
|
||||||
grid.Column("LeafInputName", "Submitted By"),
|
grid.Column("LeafInputName", "Submitted By"),
|
||||||
grid.Column("CurrentStatus", "Status", item => StatusFormat(item)),
|
grid.Column("CurrentStatus", "Status", item => Html.Partial("DisplayTemplates/_LeafInputStatus", (string)item.CurrentStatus)),
|
||||||
grid.Column("Total Results: " + Model.Count(), format: item => Btns(item))),
|
grid.Column("Total Results: " + Model.Count(), format: item => Btns(item))),
|
||||||
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed" }
|
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed" }
|
||||||
)
|
)
|
||||||
@@ -24,9 +24,15 @@
|
|||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li>@DetailsLink(item)</li>
|
<li>@DetailsLink(item)</li>
|
||||||
<li @if(!item.HasLeafChart) { <text>class="disabled"</text> }>@ChartLink(item)</li>
|
<li @if (!item.HasLeafChart)
|
||||||
<li><a href="@Url.Action("DownloadOutputToUser", "Queue", new {id = item.LeafInputId})"><span class="glyphicon glyphicon-download"></span> Download ToUser</a></li>
|
{
|
||||||
<li><a href="@Url.Action("DownloadInput", "Queue", new {id = item.LeafInputId})"><span class="glyphicon glyphicon-download"></span> Download Input</a></li>
|
<text>class="disabled"</text>
|
||||||
|
}>@ChartLink(item)</li>
|
||||||
|
<li role="separator" class="divider"></li>
|
||||||
|
<li class="dropdown-header">Download</li>
|
||||||
|
<li><a href="@Url.Action("DownloadOutputToUser", "Queue", new {id = item.LeafInputId})"><span class="glyphicon glyphicon-download"></span> ToUser</a></li>
|
||||||
|
<li><a href="@Url.Action("DownloadInput", "Queue", new {id = item.LeafInputId})"><span class="glyphicon glyphicon-download"></span> Input</a></li>
|
||||||
|
<li role="separator" class="divider"></li>
|
||||||
<li><a href="@Url.Action("Delete", "Queue", new {id = item.LeafInputId})"><span class="glyphicon glyphicon-remove"></span> Delete</a></li>
|
<li><a href="@Url.Action("Delete", "Queue", new {id = item.LeafInputId})"><span class="glyphicon glyphicon-remove"></span> Delete</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -35,15 +41,13 @@
|
|||||||
|
|
||||||
@helper DetailsLink(dynamic item)
|
@helper DetailsLink(dynamic item)
|
||||||
{
|
{
|
||||||
<a href="@UmbracoContext.Current.UrlProvider.GetUrl(1111)?id=@item.LeafInputId"><span class="glyphicon glyphicon-edit"></span> Details</a>
|
@Html.Partial("DisplayTemplates/_DetailsLink", (int)item.LeafInputId)
|
||||||
}
|
}
|
||||||
|
|
||||||
@helper ChartLink(dynamic item)
|
@helper ChartLink(dynamic item)
|
||||||
{
|
{
|
||||||
<a href="@UmbracoContext.Current.UrlProvider.GetUrl(1100)?leafInputId=@item.LeafInputId"><span class="glyphicon glyphicon-stats"></span> Chart</a>
|
if (item.HasLeafChart)
|
||||||
}
|
|
||||||
|
|
||||||
@helper StatusFormat(dynamic item)
|
|
||||||
{
|
{
|
||||||
<span class="status status-@item.CurrentStatus.ToLower()">@item.CurrentStatus</span>
|
@Html.Partial("DisplayTemplates/_ChartLink", (int)item.LeafInputId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -9,24 +9,16 @@
|
|||||||
grid.Column("LeafInputIdentifier", "Identifier"),
|
grid.Column("LeafInputIdentifier", "Identifier"),
|
||||||
grid.Column("LeafInputSiteId", "Site Id"),
|
grid.Column("LeafInputSiteId", "Site Id"),
|
||||||
grid.Column("LeafInputName", "Submitted By"),
|
grid.Column("LeafInputName", "Submitted By"),
|
||||||
grid.Column("CurrentStatus", "Status", item => statusFormat(item)),
|
grid.Column("CurrentStatus", "Status", item => Html.Partial("DisplayTemplates/_LeafInputStatus", (string)item.CurrentStatus)),
|
||||||
grid.Column("Chart", "Chart", item => chartLink(item))
|
grid.Column("Chart", "Chart", item => ChartLink(item))
|
||||||
),
|
),
|
||||||
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed" }
|
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed" }
|
||||||
)
|
)
|
||||||
|
|
||||||
@helper chartLink(dynamic item)
|
@helper ChartLink(dynamic item)
|
||||||
{
|
{
|
||||||
if (item.HasLeafChart)
|
if (item.HasLeafChart)
|
||||||
{
|
{
|
||||||
<a href="@UmbracoContext.Current.UrlProvider.GetUrl(1100)?leafInputId=@item.LeafInputId" class="btn btn-default btn-xs" role="button">
|
@Html.Partial("DisplayTemplates/_ChartLink", (int)item.LeafInputId)
|
||||||
<span class="glyphicon glyphicon-stats"></span>
|
|
||||||
Chart
|
|
||||||
</a>
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@helper statusFormat(dynamic item)
|
|
||||||
{
|
|
||||||
<span class="status status-@item.CurrentStatus.ToLower()">@item.CurrentStatus</span>
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
@{
|
||||||
|
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||||
|
}
|
||||||
|
@Html.Encode(Model)
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
@using System.Globalization
|
||||||
|
@model DateTime
|
||||||
|
@{
|
||||||
|
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||||
|
var val =
|
||||||
|
ViewData.ModelMetadata.DisplayFormatString != null
|
||||||
|
?string.Format(ViewData.ModelMetadata.DisplayFormatString, Model)
|
||||||
|
: Model.ToString(CultureInfo.InvariantCulture);
|
||||||
|
}
|
||||||
|
@Html.Encode(val)
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
@using System.Globalization
|
||||||
|
@model DateTime?
|
||||||
|
@{
|
||||||
|
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||||
|
var val =
|
||||||
|
Model.HasValue
|
||||||
|
?
|
||||||
|
ViewData.ModelMetadata.DisplayFormatString != null
|
||||||
|
? string.Format(ViewData.ModelMetadata.DisplayFormatString, Model)
|
||||||
|
: Model.Value.ToString(CultureInfo.InvariantCulture)
|
||||||
|
: string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
@(Model == null ? Html.Encode(ViewData.ModelMetadata.NullDisplayText) : Html.Encode(val))
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
@{
|
||||||
|
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||||
|
}
|
||||||
|
@Html.Encode(Model)
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
@{
|
||||||
|
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||||
|
}
|
||||||
|
<a href="mailto:@Model">@Html.Encode(Model)</a>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
@{
|
||||||
|
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||||
|
}
|
||||||
|
@Html.Encode(Model)
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
@model IEnumerable<LeafWeb.WebCms.Models.LeafInputStatusViewModel>
|
||||||
|
@{
|
||||||
|
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||||
|
var grid = new WebGrid(Model, rowsPerPage: 45);
|
||||||
|
grid.SortColumn = "DateTime";
|
||||||
|
grid.SortDirection = SortDirection.Descending;
|
||||||
|
}
|
||||||
|
|
||||||
|
@grid.GetHtml(columns:
|
||||||
|
grid.Columns(
|
||||||
|
grid.Column("DateTime", "Time"),
|
||||||
|
grid.Column("Status"),
|
||||||
|
grid.Column("Description"),
|
||||||
|
grid.Column("Details")
|
||||||
|
),
|
||||||
|
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed" }
|
||||||
|
)
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
@{
|
||||||
|
Layout = null;
|
||||||
|
}
|
||||||
|
@foreach (var prop in ViewData.ModelMetadata.Properties.Where(
|
||||||
|
pm => pm.ShowForDisplay
|
||||||
|
&& !pm.HideSurroundingHtml
|
||||||
|
//&& !pm.ModelType.IsCollection()
|
||||||
|
))
|
||||||
|
{
|
||||||
|
@Html.Display(prop.PropertyName)
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
@model LeafWeb.WebCms.Models.SelectListViewModel
|
||||||
|
@{
|
||||||
|
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||||
|
}
|
||||||
|
|
||||||
|
@(!string.IsNullOrEmpty(Model.Selected) ? Model.ListItems.FirstOrDefault(i => i.Value == Model.Selected.ToString()).Text : string.Empty)
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
@model string
|
||||||
|
@{
|
||||||
|
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||||
|
}
|
||||||
|
@if (Model == null)
|
||||||
|
{
|
||||||
|
@Html.Encode(ViewData.ModelMetadata.NullDisplayText)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<span class="status status-@Model.ToFirstLower()">@Html.Encode(Model)</span>
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
@{
|
||||||
|
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||||
|
}
|
||||||
|
@if (Model == null)
|
||||||
|
{
|
||||||
|
@Html.Encode(ViewData.ModelMetadata.NullDisplayText)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
@Html.Encode(Model)
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
@model int
|
||||||
|
<a href="@UmbracoContext.Current.UrlProvider.GetUrl(1100)?leafInputId=@Model" class="btn btn-default btn-xs" role="button">
|
||||||
|
<span class="glyphicon glyphicon-stats"></span>
|
||||||
|
Chart
|
||||||
|
</a>
|
||||||
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
@model int
|
||||||
|
<a href="@UmbracoContext.Current.UrlProvider.GetUrl(1111)?id=@Model">
|
||||||
|
<span class="glyphicon glyphicon-edit"></span> Details
|
||||||
|
</a>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
@using LeafWeb.Core.Utility
|
||||||
|
@{
|
||||||
|
Layout = null;
|
||||||
|
var lowerPropertyName = ViewData.ModelMetadata.PropertyName.ToFirstLower();
|
||||||
|
var displayName =
|
||||||
|
string.IsNullOrEmpty(ViewData.ModelMetadata.DisplayName)
|
||||||
|
? ViewData.ModelMetadata.PropertyName.SplitCamelCase()
|
||||||
|
: ViewData.ModelMetadata.DisplayName;
|
||||||
|
// string units = (string)ViewData.ModelMetadata.AdditionalValues.ContainsKey("Units") ? ["Units"];
|
||||||
|
}
|
||||||
|
|
||||||
|
<dl class="dl-horizontal @lowerPropertyName">
|
||||||
|
<dt>
|
||||||
|
@displayName
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@RenderBody()
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
@model string
|
||||||
|
<span class="status status-@Model.ToLower()">@Model</span>
|
||||||
@@ -775,6 +775,21 @@
|
|||||||
<Content Include="Views\Partials\Grid\Bootstrap3-Fluid.cshtml" />
|
<Content Include="Views\Partials\Grid\Bootstrap3-Fluid.cshtml" />
|
||||||
<Content Include="Views\Partials\Grid\Bootstrap2-Fluid.cshtml" />
|
<Content Include="Views\Partials\Grid\Bootstrap2-Fluid.cshtml" />
|
||||||
<Content Include="Views\MacroPartials\LeafInputQueueDetails.cshtml" />
|
<Content Include="Views\MacroPartials\LeafInputQueueDetails.cshtml" />
|
||||||
|
<Content Include="Views\Shared\DisplayTemplates\Boolean.cshtml" />
|
||||||
|
<Content Include="Views\Shared\DisplayTemplates\Date.cshtml" />
|
||||||
|
<Content Include="Views\Shared\DisplayTemplates\DateTime.cshtml" />
|
||||||
|
<Content Include="Views\Shared\DisplayTemplates\Decimal.cshtml" />
|
||||||
|
<Content Include="Views\Shared\DisplayTemplates\EmailAddress.cshtml" />
|
||||||
|
<Content Include="Views\Shared\DisplayTemplates\HiddenInput.cshtml" />
|
||||||
|
<Content Include="Views\Shared\DisplayTemplates\Object.cshtml" />
|
||||||
|
<Content Include="Views\Shared\DisplayTemplates\SelectListViewModel.cshtml" />
|
||||||
|
<Content Include="Views\Shared\DisplayTemplates\String.cshtml" />
|
||||||
|
<Content Include="Views\Shared\DisplayTemplates\_FieldLayout.cshtml" />
|
||||||
|
<Content Include="Views\Shared\DisplayTemplates\Status.cshtml" />
|
||||||
|
<Content Include="Views\Shared\DisplayTemplates\LeafInputStatusViewModels.cshtml" />
|
||||||
|
<Content Include="Views\Shared\DisplayTemplates\_ChartLink.cshtml" />
|
||||||
|
<Content Include="Views\Shared\DisplayTemplates\_LeafInputStatus.cshtml" />
|
||||||
|
<Content Include="Views\Shared\DisplayTemplates\_DetailsLink.cshtml" />
|
||||||
<None Include="Web.Debug.config">
|
<None Include="Web.Debug.config">
|
||||||
<DependentUpon>Web.config</DependentUpon>
|
<DependentUpon>Web.config</DependentUpon>
|
||||||
</None>
|
</None>
|
||||||
@@ -806,7 +821,9 @@
|
|||||||
<Compile Include="Controllers\QueueController.cs" />
|
<Compile Include="Controllers\QueueController.cs" />
|
||||||
<Compile Include="Controllers\ResultsController.cs" />
|
<Compile Include="Controllers\ResultsController.cs" />
|
||||||
<Compile Include="Models\ChartViewModel.cs" />
|
<Compile Include="Models\ChartViewModel.cs" />
|
||||||
|
<Compile Include="Models\LeafInputDetails.cs" />
|
||||||
<Compile Include="Models\LeafInputCreate.cs" />
|
<Compile Include="Models\LeafInputCreate.cs" />
|
||||||
|
<Compile Include="Models\LeafInputStatusViewModel.cs" />
|
||||||
<Compile Include="Models\ResultStatusViewModel.cs" />
|
<Compile Include="Models\ResultStatusViewModel.cs" />
|
||||||
<Compile Include="Models\SelectListViewModel.cs" />
|
<Compile Include="Models\SelectListViewModel.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
|||||||
Vendored
+11
-7
@@ -22,10 +22,13 @@
|
|||||||
var $chart = $("#chart");
|
var $chart = $("#chart");
|
||||||
$chart.removeAttr('src');
|
$chart.removeAttr('src');
|
||||||
|
|
||||||
var curveId = $("option:selected", this).text();
|
// this is the "Select CurveId" instruction
|
||||||
if (curveId === "@Html.Raw(selectText)") {
|
if (this.selectedIndex === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var curveId = $("option:selected", this).text();
|
||||||
|
|
||||||
var $spinner = $chart.after('<span class="glyphicon glyphicon-refresh gly-spin" style="font-size: 3em"></span>').next('span');
|
var $spinner = $chart.after('<span class="glyphicon glyphicon-refresh gly-spin" style="font-size: 3em"></span>').next('span');
|
||||||
|
|
||||||
var leafInputId = getUrlParameter("leafInputId");
|
var leafInputId = getUrlParameter("leafInputId");
|
||||||
@@ -33,11 +36,12 @@
|
|||||||
$chart.load(function () {
|
$chart.load(function () {
|
||||||
$spinner.remove();
|
$spinner.remove();
|
||||||
})
|
})
|
||||||
.error(function () {
|
.error(function () {
|
||||||
$chart.removeAttr('src');
|
//$chart.removeAttr('src');
|
||||||
$spinner.remove();
|
$spinner.remove();
|
||||||
$('#chart-error').addClass('text-danger').text('A problem was encountered loading this chart.');
|
$('#chart-error').addClass('text-danger').text('A problem was encountered loading this chart.');
|
||||||
|
return;
|
||||||
})
|
})
|
||||||
.attr('src', url);
|
.attr('src', url);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user