Queue search
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using Hangfire;
|
||||
@@ -14,10 +15,42 @@ namespace LeafWeb.WebCms.Controllers
|
||||
[MemberAuthorize]
|
||||
public class QueueController : BaseController
|
||||
{
|
||||
public ActionResult Index()
|
||||
public ActionResult Index(string query)
|
||||
{
|
||||
var resultItems = DataService.GetLeafInputsOrdered();
|
||||
var resultItems =
|
||||
DataService.GetLeafInputsOrdered() ;
|
||||
|
||||
if (!string.IsNullOrEmpty(query))
|
||||
{
|
||||
foreach (var piece in query.Split(' ').Select(p => p.Trim()))
|
||||
{
|
||||
resultItems =
|
||||
from li in resultItems
|
||||
where li.Name.Contains(piece)
|
||||
|| li.Identifier.Contains(piece)
|
||||
|| li.SiteId.Contains(piece)
|
||||
select li;
|
||||
}
|
||||
}
|
||||
|
||||
var serviceDescription = ServiceDescription();
|
||||
|
||||
var queueViewModel = new QueueViewModel
|
||||
{
|
||||
Items = resultItems, ServerDescription = serviceDescription, Query = query
|
||||
};
|
||||
|
||||
return View(queueViewModel);
|
||||
}
|
||||
|
||||
public ActionResult Search(string query)
|
||||
{
|
||||
var nameValueCollection = new NameValueCollection {{"query", query}};
|
||||
return RedirectToUmbracoPage(LeafWebPageIds.ManageQueue, nameValueCollection);
|
||||
}
|
||||
|
||||
private static string ServiceDescription()
|
||||
{
|
||||
string serviceDescription;
|
||||
try
|
||||
{
|
||||
@@ -27,13 +60,7 @@ namespace LeafWeb.WebCms.Controllers
|
||||
{
|
||||
serviceDescription = "Exception while initializing";
|
||||
}
|
||||
|
||||
var queueViewModel = new QueueViewModel
|
||||
{
|
||||
Items = resultItems, ServerDescription = serviceDescription
|
||||
};
|
||||
|
||||
return View(queueViewModel);
|
||||
return serviceDescription;
|
||||
}
|
||||
|
||||
public ActionResult Details(int id)
|
||||
|
||||
Reference in New Issue
Block a user