Merge pull request #1060 from geogolem/clientModeFixForMovieEditor

fix client mode fetching.. only setPageSize when necessary
pull/2/head
geogolem 8 years ago committed by GitHub
commit b71031f6d3

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

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

@ -142,7 +142,9 @@ module.exports = Marionette.Layout.extend({
//debugger; //debugger;
this.seriesCollection.bindSignalR(); this.seriesCollection.bindSignalR();
var pageSize = parseInt(Config.getValue("pageSize")) || 10; 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.listenTo(MoviesCollection, 'sync', function() {
// this.seriesCollection.fetch(); // this.seriesCollection.fetch();
//}); //});

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

Loading…
Cancel
Save