Add "show only completed" to query

This commit is contained in:
2020-07-11 21:07:43 -04:00
parent 1760870219
commit f1691f3d53
4 changed files with 48 additions and 27 deletions
+5 -3
View File
@@ -1,6 +1,4 @@
using System.Collections.Specialized;
using System.ComponentModel.DataAnnotations;
using System.Runtime.CompilerServices;
using System.ComponentModel.DataAnnotations;
namespace LeafWeb.WebCms.Models
{
@@ -58,6 +56,9 @@ namespace LeafWeb.WebCms.Models
[RegularExpression(FloatingPointRegex, ErrorMessage = "Must be numeric")]
public string phips2 { get; set; }
[Display(Name = "Show Only Successfully Completed")]
public bool completed { get; set; }
public bool HasExtendedParameters =>
!(
string.IsNullOrEmpty(siteid)
@@ -70,6 +71,7 @@ namespace LeafWeb.WebCms.Models
&& string.IsNullOrEmpty(pari)
&& string.IsNullOrEmpty(tleaf)
&& string.IsNullOrEmpty(phips2)
&& !completed
);
}
}
+8 -5
View File
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Collections.Specialized;
using System.Linq;
using System.Web;
using System.Web.Routing;
namespace LeafWeb.WebCms.Utility
@@ -21,9 +18,15 @@ namespace LeafWeb.WebCms.Utility
foreach (var pi in obj.GetType().GetProperties().Where(p => p.CanWrite))
{
var value = pi.GetValue(obj, null);
if (value == null)
switch (value)
{
case null:
case bool b when b == false:
continue;
default:
nvs.Add(prefix + pi.Name, value.ToString());
break;
}
}
return nvs;
+9
View File
@@ -143,6 +143,15 @@ namespace LeafWeb.WebCms.Utility
select li;
}
if (query.completed)
{
resultItems =
from li in resultItems
where
li.CurrentStatus == LeafInputStatusType.Complete
select li;
}
return resultItems;
}
}
+21 -14
View File
@@ -15,7 +15,7 @@
@using (Html.BeginUmbracoForm("Search", "Queue", null, new { @action = "/leaf-data/manage-queue/" }))
{
<div class="row">
<div class="row align-items-start">
<div class="col font-italic font-weight-light">
@Model.Items.Count() results<br />
Service description: @Model.ServerDescription
@@ -24,10 +24,6 @@
<i class="fa fa-file-o"></i> 10: <strong>@Model.TimeInProgressEstimater.EstimateTimeInProgress(10).ToRoundedReadableString()</strong>
<i class="fa fa-file-o"></i> 100: <strong>@Model.TimeInProgressEstimater.EstimateTimeInProgress(100).ToRoundedReadableString()</strong>*@
</div>
<div class="col-lg-3">
@DownloadResultsInput()
@DownloadResultsOutput_ToUser()
</div>
<div class="col">
<div class="input-group">
<input name="Q.q" type="text" class="form-control" placeholder="Search for..." value="@Model.Q.q">
@@ -77,7 +73,7 @@
</div>
<hr />
<div class="text-body font-weight-bold pb-3">Curve Variation range minimum</div>
<div class="row">
<div class="row align-items-end">
<div class="col-md-6">
@Html.EditorFor(m => m.Q.co2s, new { size = "small", append = "umol/m", prepend = ">" })
</div>
@@ -91,6 +87,12 @@
@Html.EditorFor(m => m.Q.phips2, new { size = "small", prepend = ">" })
</div>
</div>
<hr />
<div class="row">
<div class="col">
@Html.EditorFor(m => m.Q.completed)
</div>
</div>
</div>
</div>
}
@@ -109,7 +111,13 @@
grid.Column("", format: item => Actions(item.Value), canSort: false)),
htmlAttributes: new { @class = "table table-sm table-striped table-bordered table-hover" }
)
@grid.PagerList()
</div>
<div class="row justify-content-end">
<div class="col-sm">@grid.PagerList()</div>
<div class="col-sm col-lg-5 pl-4 pt-3 pt-sm-0" >
<span class="pr-2">Download Results</span>
@DownloadResults()
</div>
</div>
}
else
@@ -263,16 +271,15 @@ else
}
@helper DownloadResultsInput()
@helper DownloadResults()
{
<a class="btn btn-outline-secondary" role="button" href="@Url.Action("DownloadResultsInputZip", "Queue", Model.Q.GetNameValueCollection().ToRouteValueDictionary())">
<div class="btn-group" role="group" aria-label="Download">
<a class="btn btn-outline-secondary small" role="button" href="@Url.Action("DownloadResultsInputZip", "Queue", Model.Q.GetNameValueCollection().ToRouteValueDictionary())">
<span class="fa fa-download"></span> Input
</a>
}
@helper DownloadResultsOutput_ToUser()
{
<a class="btn btn-outline-secondary" role="button" href="@Url.Action("DownloadResultsOutputZip", "Queue", Model.Q.GetNameValueCollection().ToRouteValueDictionary())">
<a class="btn btn-outline-secondary small" role="button" href="@Url.Action("DownloadResultsOutputZip", "Queue", Model.Q.GetNameValueCollection().ToRouteValueDictionary())">
<span class="fa fa-download"></span> Output
</a>
</div>
}