First Pass at LeafDataQuery for Queue

This commit is contained in:
2020-06-17 15:26:31 -04:00
parent 5ac9291518
commit d09f84b47d
9 changed files with 169 additions and 29 deletions
+18 -10
View File
@@ -19,15 +19,15 @@ namespace LeafWeb.WebCms.Controllers
{
private const int TimeSamples = 40;
public ActionResult Index(string query)
public ActionResult Index(LeafDataQuery query)
{
var resultItems =
DataService.GetLeafInputsOrdered() ;
DataService.GetLeafInputsOrdered();
// search functionality
if (!string.IsNullOrEmpty(query))
if (!string.IsNullOrEmpty(query.Query))
{
foreach (var piece in query.Split(' ').Select(p => p.Trim()))
foreach (var piece in query.Query.Split(' ').Select(p => p.Trim()))
{
resultItems =
from li in resultItems
@@ -44,7 +44,12 @@ namespace LeafWeb.WebCms.Controllers
var queueViewModel = new QueueViewModel
{
Items = resultItems, ServerDescription = serviceDescription, Query = query,
Items = resultItems,
ServerDescription = serviceDescription,
Query = new LeafDataQuery
{
Query = query.Query
},
TimeInProgressEstimater = timeInProgressEstimater
};
@@ -53,6 +58,8 @@ namespace LeafWeb.WebCms.Controllers
private TimeInProgressEstimater TimeInProgressEstimater()
{
// TODO: move this to a background process
var estimater = HttpRuntime.Cache["TimeInProgressEstimater"];
if (estimater == null)
{
@@ -73,11 +80,12 @@ namespace LeafWeb.WebCms.Controllers
return Content(string.Join("<br />", data));
}
public ActionResult Search(string query)
{
var nameValueCollection = new NameValueCollection {{"query", query}};
return RedirectToUmbracoPage(LeafWebPageIds.ManageQueue, nameValueCollection);
}
[HttpPost]
public ActionResult Search(LeafDataQuery query)
{
var collection = new NameValueCollection() {{"Query.Query", query.Query}};
return RedirectToCurrentUmbracoPage(collection);
}
private static string ServiceDescription()
{