First Pass at LeafDataQuery for Queue
This commit is contained in:
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user