1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Fix: Grids will no longer display alerts when navigating to another page while the grid is still loading.

This commit is contained in:
Mark McDowall 2012-01-29 17:38:44 -08:00
parent 68e1a0bc4d
commit 2635ff9bee
11 changed files with 58 additions and 3 deletions

View File

@ -380,6 +380,7 @@
<Content Include="Scripts\jquery.validate.unobtrusive.min.js" />
<Content Include="Scripts\NzbDrone\addSeries.js" />
<Content Include="Scripts\NzbDrone\AutoComplete.js" />
<Content Include="Scripts\NzbDrone\grid.js" />
<Content Include="Scripts\NzbDrone\settings.js" />
<Content Include="Scripts\NzbDrone\localSearch.js" />
<Content Include="Scripts\NzbDrone\Notification.js" />

View File

@ -32,9 +32,10 @@
});
jqXHR.error(function (xhr, ajaxOptions, thrownError) {
jqXHR.error(function (xhr, textStatus, thrownError) {
//ignore notification errors.
if (this.url.indexOf("/notification/Comet") !== 0) {
alert("Status: " + textStatus + ", Error: " + thrownError);
$.gritter.add({
title: 'Request failed',
text: this.url,

View File

@ -0,0 +1,4 @@
function grid_onError(e) {
//Suppress the alert
e.preventDefault();
}

View File

@ -1,4 +1,5 @@
@model List<HistoryModel>
@using NzbDrone.Common
@using NzbDrone.Web.Models
@using NzbDrone.Web.Helpers
@{ViewBag.Title = "History";}
@ -49,6 +50,11 @@
.Pageable(
c =>
c.PageSize(20).Position(GridPagerPosition.Bottom).Style(GridPagerStyles.NextPrevious))
.ClientEvents(clientEvents =>
{
if (EnviromentProvider.IsProduction)
clientEvents.OnError("grid_onError");
})
.Render();}
</div>
<script type="text/javascript">

View File

@ -1,3 +1,4 @@
@using NzbDrone.Common
@using NzbDrone.Core.Instrumentation
@using NzbDrone.Web.Helpers
@model IEnumerable<NzbDrone.Core.Instrumentation.Log>
@ -50,6 +51,11 @@
.Filterable()
.ClientEvents(c => c.OnRowDataBound("onRowDataBound"))
.Scrollable(c => c.Height(500))
.ClientEvents(clientEvents =>
{
if (EnviromentProvider.IsProduction)
clientEvents.OnError("grid_onError");
})
.Render();}
<script type="text/javascript">
function reloadGrid() {

View File

@ -1,4 +1,5 @@
@using NzbDrone.Core.Model
@using NzbDrone.Common
@using NzbDrone.Core.Model
@{ViewBag.Title = "Misnamed";}
@section ActionMenu{
<ul class="sub-menu">
@ -47,6 +48,8 @@
.ClientEvents(clientEvents =>
{
clientEvents.OnDataBound("grid_dataBound");
if (EnviromentProvider.IsProduction)
clientEvents.OnError("grid_onError");
})
.Render();}
</div>

View File

@ -1,4 +1,5 @@
@model List<MissingEpisodeModel>
@using NzbDrone.Common
@using NzbDrone.Web.Helpers
@using NzbDrone.Web.Models;
@{ViewBag.Title="Missing";}
@ -48,4 +49,9 @@
.Pageable(
c =>
c.PageSize(20).Position(GridPagerPosition.Bottom).Style(GridPagerStyles.NextPrevious))
.ClientEvents(clientEvents =>
{
if (EnviromentProvider.IsProduction)
clientEvents.OnError("grid_onError");
})
.Render();}

View File

@ -1,4 +1,5 @@
@model SeriesModel
@using NzbDrone.Common
@using NzbDrone.Web.Helpers
@using NzbDrone.Web.Models
@{ViewBag.Title = Model.Title;}
@ -128,6 +129,8 @@
{
clientEvents.OnRowDataBound("grid_rowBound");
clientEvents.OnDataBound("grid_dataBound");
if (EnviromentProvider.IsProduction)
clientEvents.OnError("grid_onError");
})
.Sortable(sorting => sorting
.OrderBy(sortOrder => sortOrder.Add(o => o.EpisodeNumber).Descending()).SortMode(GridSortMode.SingleColumn))

View File

@ -1,3 +1,4 @@
@using NzbDrone.Common
@using NzbDrone.Web.Helpers
@using NzbDrone.Web.Models;
@model IEnumerable<NzbDrone.Core.Repository.Series>
@ -98,6 +99,8 @@
clientEvents.OnEdit("grid_edit");
clientEvents.OnSave("grid_save");
clientEvents.OnRowDataBound("grid_rowBound");
if(EnviromentProvider.IsProduction)
clientEvents.OnError("grid_onError");
})
.Render();}
@section Scripts{

View File

@ -34,6 +34,7 @@
@Html.IncludeScript("NzbDrone/AutoComplete.js")
@Html.IncludeScript("NzbDrone/Notification.js")
@Html.IncludeScript("NzbDrone/AutoBind.js")
@Html.IncludeScript("NzbDrone/grid.js")
@RenderSection("Scripts", required: false)
</body>
</html>
</html>

View File

@ -1,4 +1,5 @@
@model List<UpcomingEpisodeModel>
@using NzbDrone.Common
@using NzbDrone.Web.Helpers
@using NzbDrone.Web.Models
@{ViewBag.Title = "Upcoming";}
@ -43,6 +44,11 @@
))
.DataBinding(data => data.Ajax().Select("_AjaxBindingYesterday", "Upcoming"))
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.AirDateTime).Ascending()).Enabled(true))
.ClientEvents(clientEvents =>
{
if (EnviromentProvider.IsProduction)
clientEvents.OnError("grid_onError");
})
.Render();}
</div>
</div>
@ -78,6 +84,11 @@
))
.DataBinding(data => data.Ajax().Select("_AjaxBindingToday", "Upcoming"))
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.AirDateTime).Ascending()).Enabled(true))
.ClientEvents(clientEvents =>
{
if (EnviromentProvider.IsProduction)
clientEvents.OnError("grid_onError");
})
.Render();}
</div>
</div>
@ -115,6 +126,11 @@
.DataBinding(data => data.Ajax().Select("_AjaxBindingTomorrow", "Upcoming"))
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.AirDateTime).Ascending()).Enabled(true))
.ClientEvents(clientEvents =>
{
if (EnviromentProvider.IsProduction)
clientEvents.OnError("grid_onError");
})
.Render();}
</div>
</div>
@ -151,6 +167,11 @@
))
.DataBinding(data => data.Ajax().Select("_AjaxBindingWeek", "Upcoming"))
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.AirDateTime).Ascending()).Enabled(true))
.ClientEvents(clientEvents =>
{
if (EnviromentProvider.IsProduction)
clientEvents.OnError("grid_onError");
})
.Render();}
</div>
</div>