Signalr errors will not be shown in the UI.

New: Search History, review recent searches and force specific reports to download (Under history)
This commit is contained in:
Mark McDowall
2012-04-23 00:38:42 -07:00
parent 06df8a86b6
commit 38927e3ca1
16 changed files with 100 additions and 99 deletions
@@ -10,20 +10,20 @@ using NzbDrone.Web.Models;
namespace NzbDrone.Web.Controllers
{
public class SearchResultController : Controller
public class SearchHistoryController : Controller
{
private readonly SearchResultProvider _searchResultProvider;
private readonly SearchHistoryProvider _searchHistoryProvider;
public SearchResultController(SearchResultProvider searchResultProvider)
public SearchHistoryController(SearchHistoryProvider searchHistoryProvider)
{
_searchResultProvider = searchResultProvider;
_searchHistoryProvider = searchHistoryProvider;
}
public ActionResult Index()
{
var results = _searchResultProvider.AllSearchResults();
var results = _searchHistoryProvider.AllSearchHistory();
var model = results.Select(s => new SearchResultsModel
var model = results.Select(s => new SearchHistoryModel
{
Id = s.Id,
SearchTime = s.SearchTime.ToString(),
@@ -37,13 +37,13 @@ namespace NzbDrone.Web.Controllers
public ActionResult Details(int searchId)
{
var searchResult = _searchResultProvider.GetSearchResult(searchId);
var searchResult = _searchHistoryProvider.GetSearchHistory(searchId);
var model = new SearchDetailsModel
{
Id = searchResult.Id,
DisplayName = GetDisplayName(searchResult),
SearchResultItems =
searchResult.SearchResultItems.Select(s => new SearchItemModel
SearchHistoryItems =
searchResult.SearchHistoryItems.Select(s => new SearchItemModel
{
Id = s.Id,
ReportTitle = s.ReportTitle,
@@ -66,12 +66,12 @@ namespace NzbDrone.Web.Controllers
public JsonResult ForceDownload(int id)
{
_searchResultProvider.ForceDownload(id);
_searchHistoryProvider.ForceDownload(id);
return new JsonResult { Data = "ok", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
}
public string GetDisplayName(SearchResult searchResult)
public string GetDisplayName(SearchHistory searchResult)
{
if (!searchResult.EpisodeNumber.HasValue)
{
+1 -1
View File
@@ -8,6 +8,6 @@ namespace NzbDrone.Web.Models
{
public int Id { get; set; }
public string DisplayName { get; set; }
public List<SearchItemModel> SearchResultItems { get; set; }
public List<SearchItemModel> SearchHistoryItems { get; set; }
}
}
@@ -2,7 +2,7 @@
namespace NzbDrone.Web.Models
{
public class SearchResultsModel
public class SearchHistoryModel
{
public int Id { get; set; }
public string DisplayName { get; set; }
+4 -4
View File
@@ -142,7 +142,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="App_Start\DataTablesMvc.cs" />
<Compile Include="Controllers\SearchResultController.cs" />
<Compile Include="Controllers\SearchHistoryController.cs" />
<Compile Include="Helpers\Validation\RequiredIfAnyAttribute.cs" />
<Compile Include="Helpers\Validation\RequiredIfAttribute.cs" />
<Content Include="Content\DataTables-1.9.0\media\css\jquery.dataTables.css" />
@@ -241,7 +241,7 @@
<Compile Include="Models\LogModel.cs" />
<Compile Include="Models\PostUpgradeModel.cs" />
<Compile Include="Models\SearchItemModel.cs" />
<Compile Include="Models\SearchResultsModel.cs" />
<Compile Include="Models\SearchHistoryModel.cs" />
<Compile Include="Models\UpcomingEpisodesModel.cs" />
<Compile Include="Models\SeasonModel.cs" />
<Compile Include="Models\SeriesDetailsModel.cs" />
@@ -525,10 +525,10 @@
<Content Include="Views\Update\Post.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\SearchResult\Index.cshtml" />
<Content Include="Views\SearchHistory\Index.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\SearchResult\Details.cshtml" />
<Content Include="Views\SearchHistory\Details.cshtml" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
@@ -34,7 +34,7 @@
jqXHR.error(function (xhr, textStatus, thrownError) {
//ignore notification errors.
if (this.url.indexOf("/notification/Comet") === 0 || this.url.indexOf("/Health/Index") === 0)
if (this.url.indexOf("/notification/Comet") === 0 || this.url.indexOf("/Health/Index") === 0 || this.url.indexOf("/signalr") === 0)
return;
alert("Status: " + textStatus + ", Error: " + thrownError);
+1
View File
@@ -4,6 +4,7 @@
<ul class="sub-menu">
<li>@Ajax.ActionLink("Trim History", "Trim", "History", null, new AjaxOptions{ OnSuccess = "reloadGrid", Confirm = "Delete history items older than 30 days?"}, new { Title = "Delete history items older than 30 days" })</li>
<li>@Ajax.ActionLink("Purge History", "Purge", "History", null, new AjaxOptions{ OnSuccess = "reloadGrid", Confirm = "Purge all history items?" }, new { Title = "Delete all history items" })</li>
<li>@Html.ActionLink("Search Hisotry", "Index", "SearchHistory", null, new { Title = "Review recent searches" })</li>
</ul>
}
@@ -12,7 +12,7 @@
@section Scripts
{
@(Html.GridScriptFor(m => m.SearchResultItems, "#searchDetailsGrid")
@(Html.GridScriptFor(m => m.SearchHistoryItems, "#searchDetailsGrid")
.PageLength(20)
.ChangePageLength(false)
.AddColumn(new Column().Image("/Content/Images/Indexers/{Indexer}.png", new { alt = "{Indexer}", title = "{Indexer}" }, "{Indexer}").Sortable(false).Title("").Width("20px"))
@@ -36,7 +36,7 @@
function actionColumn(source, type, val) {
if (type === 'display' || type === 'filter') {
return '<a href="/SearchResult/ForceDownload/' + source["Id"] + '" data-ajax="true" data-ajax-confirm="Are you sure?"><img src="/Content/Images/Plus.png" alt="Force" title="Force" class="gridAction"/></a>';
return '<a href="/SearchHistory/ForceDownload/' + source["Id"] + '" data-ajax="true" data-ajax-confirm="Are you sure?"><img src="/Content/Images/Plus.png" alt="Force" title="Force" class="gridAction"/></a>';
}
// 'sort' and 'type' both just use the raw data
return '';
@@ -1,5 +1,5 @@
@using DataTables.Mvc.Core
@model IEnumerable<NzbDrone.Web.Models.SearchResultsModel>
@model IEnumerable<NzbDrone.Web.Models.SearchHistoryModel>
@{
ViewBag.Title = "Search Results";
@@ -13,7 +13,7 @@
Html.GridScriptForModel("#searchResultsGrid")
.PageLength(20)
.ChangePageLength(false)
.AddColumn(new Column().DataProperty("DisplayName").Link("SearchResult/Details?searchId={Id}", "{DisplayName}", null).Title("Name"))
.AddColumn(new Column().DataProperty("DisplayName").Link("SearchHistory/Details?searchId={Id}", "{DisplayName}", null).Title("Name"))
.AddColumn(new Column().DataProperty("SearchTime").Title("Time").Width("170px"))
.AddColumn(new Column().DataProperty("ReportCount").Title("Reports Found").Width("140px"))
.AddColumn(new Column().DataProperty("Successful").Title("Successful").Width("110px"))