Feature: Quick Search

Device/Job/User Search refactoring. Quick-Search implemented.
This commit is contained in:
Gary Sharp
2014-02-06 16:11:45 +11:00
parent 9ea0273936
commit cd31ba4a6c
53 changed files with 1045 additions and 470 deletions
+1 -1
View File
@@ -160,7 +160,7 @@ namespace Disco.Web.Controllers
HideClosedJobs = true,
EnablePaging = false
};
m.Jobs.Fill(Database, BI.JobBI.Searching.BuildJobTableModel(Database).Where(j => j.DeviceSerialNumber == m.Device.SerialNumber).OrderByDescending(j => j.Id), true);
m.Jobs.Fill(Database, Disco.Services.Searching.Search.BuildJobTableModel(Database).Where(j => j.DeviceSerialNumber == m.Device.SerialNumber).OrderByDescending(j => j.Id), true);
}
if (Authorization.Has(Claims.Device.ShowCertificates))
+10 -10
View File
@@ -34,7 +34,7 @@ namespace Disco.Web.Controllers
if (Authorization.Has(Claims.Job.Lists.LongRunningJobs))
{
var longRunningThreshold = DateTime.Today.AddDays(Database.DiscoConfiguration.JobPreferences.LongRunningJobDaysThreshold * -1);
m.LongRunningJobs = ManagedJobList.OpenJobsTable(q => q.Where(j => j.OpenedDate < longRunningThreshold).OrderBy(j => j.Id));
m.LongRunningJobs = ManagedJobList.OpenJobsTable(q => q.Where(j => j.OpenedDate < longRunningThreshold).OrderBy(j => j.JobId));
}
if (Authorization.Has(Claims.Job.ShowDailyChart))
m.DailyOpenedClosedStatistics = Disco.BI.JobBI.Statistics.DailyOpenedClosed.Data(Database, true);
@@ -68,7 +68,7 @@ namespace Disco.Web.Controllers
public virtual ActionResult AllOpen()
{
var m = new Models.Job.ListModel() { Title = "All Open Jobs" };
m.JobTable = ManagedJobList.OpenJobsTable(q => q.OrderBy(j => j.Id));
m.JobTable = ManagedJobList.OpenJobsTable(q => q.OrderBy(j => j.JobId));
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
@@ -97,7 +97,7 @@ namespace Disco.Web.Controllers
m.JobTable = ManagedJobList.OpenJobsTable(q => q.Where(j => !j.WaitingForUserAction.HasValue
&& j.DeviceHeld != null && j.DeviceReturnedDate == null && j.DeviceReadyForReturn != null &&
((!j.JobMetaNonWarranty_AccountingChargeRequiredDate.HasValue && !j.JobMetaNonWarranty_AccountingChargeAddedDate.HasValue) || j.JobMetaNonWarranty_AccountingChargePaidDate.HasValue))
.OrderBy(j => j.Id));
.OrderBy(j => j.JobId));
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
@@ -113,7 +113,7 @@ namespace Disco.Web.Controllers
m.JobTable = ManagedJobList.OpenJobsTable(q => q.Where(j =>
(j.JobMetaNonWarranty_RepairerLoggedDate != null && j.JobMetaNonWarranty_RepairerCompletedDate == null) ||
(j.JobMetaWarranty_ExternalLoggedDate != null && j.JobMetaWarranty_ExternalCompletedDate == null)
).OrderBy(j => j.Id));
).OrderBy(j => j.JobId));
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
@@ -145,7 +145,7 @@ namespace Disco.Web.Controllers
var m = new Models.Job.ListModel() { Title = "Jobs Awaiting Finance - Accounting Charge" };
m.JobTable = ManagedJobList.OpenJobsTable(q => q.Where(j =>
j.JobTypeId == JobType.JobTypeIds.HNWar && (j.JobMetaNonWarranty_AccountingChargeRequiredDate.HasValue && (!j.JobMetaNonWarranty_AccountingChargeAddedDate.HasValue && !j.JobMetaNonWarranty_AccountingChargePaidDate.HasValue))
).OrderBy(j => j.Id));
).OrderBy(j => j.JobId));
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
@@ -159,7 +159,7 @@ namespace Disco.Web.Controllers
var m = new Models.Job.ListModel() { Title = "Jobs Awaiting Finance - Accounting Payment" };
m.JobTable = ManagedJobList.OpenJobsTable(q => q.Where(j =>
j.JobTypeId == JobType.JobTypeIds.HNWar && ((j.JobMetaNonWarranty_AccountingChargeRequiredDate.HasValue || j.JobMetaNonWarranty_AccountingChargeAddedDate.HasValue) && !j.JobMetaNonWarranty_AccountingChargePaidDate.HasValue)
).OrderBy(j => j.Id));
).OrderBy(j => j.JobId));
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
@@ -173,7 +173,7 @@ namespace Disco.Web.Controllers
var m = new Models.Job.ListModel() { Title = "Jobs Awaiting Finance - Insurance Processing" };
m.JobTable = ManagedJobList.OpenJobsTable(q => q.Where(j =>
j.JobTypeId == JobType.JobTypeIds.HNWar && (j.JobMetaNonWarranty_IsInsuranceClaim.Value && !j.JobMetaInsurance_ClaimFormSentDate.HasValue)
).OrderBy(j => j.Id));
).OrderBy(j => j.JobId));
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
@@ -187,7 +187,7 @@ namespace Disco.Web.Controllers
var m = new Models.Job.ListModel() { Title = "Jobs Awaiting Finance - Agreement Breach" };
m.JobTable = ManagedJobList.OpenJobsTable(q => q.Where(j =>
j.JobTypeId == JobType.JobTypeIds.UMgmt && Job.UserManagementFlags.Infringement_BreachFinancialAgreement == (j.Flags & Job.UserManagementFlags.Infringement_BreachFinancialAgreement)
).OrderBy(j => j.Id));
).OrderBy(j => j.JobId));
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
@@ -204,7 +204,7 @@ namespace Disco.Web.Controllers
j.WaitingForUserAction.HasValue ||
(j.JobMetaNonWarranty_AccountingChargeAddedDate != null && j.JobMetaNonWarranty_AccountingChargePaidDate == null) ||
(j.JobMetaNonWarranty_AccountingChargeRequiredDate != null && j.JobMetaNonWarranty_AccountingChargePaidDate == null)
).OrderBy(j => j.Id));
).OrderBy(j => j.JobId));
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
@@ -224,7 +224,7 @@ namespace Disco.Web.Controllers
closedThreshold = closedThreshold.AddDays(-2);
if (dateTimeNow.DayOfWeek == DayOfWeek.Tuesday)
closedThreshold = closedThreshold.AddDays(-1);
m.JobTable.Fill(Database, BI.JobBI.Searching.BuildJobTableModel(Database).Where(j => j.ClosedDate > closedThreshold).OrderBy(j => j.Id), true);
m.JobTable.Fill(Database, Disco.Services.Searching.Search.BuildJobTableModel(Database).Where(j => j.ClosedDate > closedThreshold).OrderBy(j => j.Id), true);
// UI Extensions
UIExtensions.ExecuteExtensions<JobListModel>(this.ControllerContext, m);
+10 -10
View File
@@ -62,13 +62,13 @@ namespace Disco.Web.Controllers
return View(m);
}
if (Authorization.Has(Claims.Job.Search))
m.Jobs = BI.JobBI.Searching.Search(Database, term, null, true, searchDetails);
m.Jobs = Services.Searching.Search.SearchJobsTable(Database, term, null, true, searchDetails);
if (Authorization.Has(Claims.Device.Search))
m.Devices = BI.DeviceBI.Searching.Search(Database, term, null, searchDetails);
m.Devices = Services.Searching.Search.SearchDevices(Database, term, null, searchDetails);
if (Authorization.Has(Claims.User.Search))
m.Users = BI.UserBI.Searching.Search(Database, term);
m.Users = Services.Searching.Search.SearchUsers(Database, term);
}
else
{
@@ -83,7 +83,7 @@ namespace Disco.Web.Controllers
if (vm != null)
{
m.FriendlyTerm = string.Format("Device Model: {0}", vm.ToString());
m.Devices = BI.DeviceBI.Searching.SearchDeviceModel(Database, vm.Id);
m.Devices = Services.Searching.Search.SearchDeviceModel(Database, vm.Id);
break;
}
}
@@ -100,7 +100,7 @@ namespace Disco.Web.Controllers
if (dp != null)
{
m.FriendlyTerm = string.Format("Device Profile: {0}", dp.ToString());
m.Devices = BI.DeviceBI.Searching.SearchDeviceProfile(Database, dp.Id);
m.Devices = Services.Searching.Search.SearchDeviceProfile(Database, dp.Id);
break;
}
}
@@ -117,7 +117,7 @@ namespace Disco.Web.Controllers
if (db != null)
{
m.FriendlyTerm = string.Format("Device Batch: {0}", db.ToString());
m.Devices = BI.DeviceBI.Searching.SearchDeviceBatch(Database, db.Id);
m.Devices = Services.Searching.Search.SearchDeviceBatch(Database, db.Id);
break;
}
}
@@ -133,10 +133,10 @@ namespace Disco.Web.Controllers
m.ErrorMessage = "A search term of at least two characters is required";
return View(m);
}
m.Devices = BI.DeviceBI.Searching.Search(Database, term, null, searchDetails);
m.Devices = Services.Searching.Search.SearchDevices(Database, term, null, searchDetails);
if (m.Devices.Count == 1)
{
return RedirectToAction(MVC.Device.Show(m.Devices[0].SerialNumber));
return RedirectToAction(MVC.Device.Show(m.Devices[0].Id));
}
break;
case "jobs":
@@ -154,7 +154,7 @@ namespace Disco.Web.Controllers
return RedirectToAction(MVC.Job.Show(termInt));
}
}
m.Jobs = BI.JobBI.Searching.Search(Database, term, null, true, searchDetails);
m.Jobs = Services.Searching.Search.SearchJobsTable(Database, term, null, true, searchDetails);
break;
case "users":
Authorization.Require(Claims.User.Search);
@@ -164,7 +164,7 @@ namespace Disco.Web.Controllers
m.ErrorMessage = "A search term of at least two characters is required";
return View(m);
}
m.Users = BI.UserBI.Searching.Search(Database, term);
m.Users = Services.Searching.Search.SearchUsers(Database, term);
if (m.Users.Count == 1)
{
return RedirectToAction(MVC.User.Show(m.Users[0].Id));
+1 -1
View File
@@ -64,7 +64,7 @@ namespace Disco.Web.Controllers
HideClosedJobs = true,
EnablePaging = false
};
m.Jobs.Fill(Database, BI.JobBI.Searching.BuildJobTableModel(Database).Where(j => j.UserId == id).OrderByDescending(j => j.Id), true);
m.Jobs.Fill(Database, Disco.Services.Searching.Search.BuildJobTableModel(Database).Where(j => j.UserId == id).OrderByDescending(j => j.Id), true);
}
try