fix client mode fetching.. only setPageSize when necessary

This commit is contained in:
geogolem 2017-03-07 09:55:48 -05:00
parent 0668f12e62
commit d03f4a515e
4 changed files with 11 additions and 10 deletions

View File

@ -220,14 +220,10 @@ namespace NzbDrone.Api.REST
private PagingResource<TResource> ReadPagingResourceFromRequest()
{
int pageSize;
int.TryParse(Request.Query.PageSize.ToString(), out pageSize);
if (pageSize == 0) pageSize = 0;
int.TryParse(Request.Query.PageSize.ToString(), out pageSize);
int page;
int.TryParse(Request.Query.Page.ToString(), out page);
if (page == 0) page = 0;
var pagingResource = new PagingResource<TResource>
@ -269,4 +265,4 @@ namespace NzbDrone.Api.REST
return pagingResource;
}
}
}
}

View File

@ -84,8 +84,8 @@ module.exports = Marionette.Layout.extend({
initialize : function() {
this.movieCollection = MoviesCollection.clone();
var pageSize = parseInt(Config.getValue("pageSize")) || 10;
this.movieCollection.switchMode('client');
this.movieCollection.setPageSize(pageSize);
this.movieCollection.switchMode('client', {fetch: false});
this.movieCollection.setPageSize(pageSize, {fetch: true});
this.movieCollection.bindSignalR();
this.movieCollection.fullCollection.bindSignalR();

View File

@ -142,7 +142,9 @@ module.exports = Marionette.Layout.extend({
//debugger;
this.seriesCollection.bindSignalR();
var pageSize = parseInt(Config.getValue("pageSize")) || 10;
// this.seriesCollection.setPageSize(pageSize);
if (this.series.state.pageSize !== pageSize) {
this.seriesCollection.setPageSize(pageSize);
}
//this.listenTo(MoviesCollection, 'sync', function() {
// this.seriesCollection.fetch();
//});

View File

@ -86,6 +86,9 @@ var Collection = PageableCollection.extend({
},
parseState : function(resp) {
if (this.mode === 'client') {
return {};
}
var direction = -1;
if (resp.sortDirection == "descending") {
direction = 1;
@ -94,7 +97,7 @@ var Collection = PageableCollection.extend({
},
parseRecords : function(resp) {
if (resp) {
if (resp && this.mode !== 'client') {
return resp.records;
}