mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-23 06:45:19 -07:00
Fix most paging issues on first load.
This commit is contained in:
parent
665832f0cc
commit
4640519438
2 changed files with 61 additions and 41 deletions
|
@ -61,7 +61,7 @@ module.exports = Marionette.Layout.extend({
|
||||||
name : 'added',
|
name : 'added',
|
||||||
label : 'Date Added',
|
label : 'Date Added',
|
||||||
cell : RelativeDateCell
|
cell : RelativeDateCell
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name : "downloadedQuality",
|
name : "downloadedQuality",
|
||||||
label : "Downloaded",
|
label : "Downloaded",
|
||||||
|
@ -139,6 +139,7 @@ module.exports = Marionette.Layout.extend({
|
||||||
initialize : function() {
|
initialize : function() {
|
||||||
//this variable prevents us from showing the list before seriesCollection has been fetched the first time
|
//this variable prevents us from showing the list before seriesCollection has been fetched the first time
|
||||||
this.seriesCollection = MoviesCollection.clone();
|
this.seriesCollection = MoviesCollection.clone();
|
||||||
|
//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);
|
// this.seriesCollection.setPageSize(pageSize);
|
||||||
|
@ -191,7 +192,7 @@ module.exports = Marionette.Layout.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
this.seriesCollection.setPageSize(pageSize);
|
//this.seriesCollection.setPageSize(pageSize);
|
||||||
|
|
||||||
|
|
||||||
this.sortingOptions = {
|
this.sortingOptions = {
|
||||||
|
@ -303,6 +304,12 @@ module.exports = Marionette.Layout.extend({
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//this._showToolbar();
|
||||||
|
//debugger;
|
||||||
|
self = this;
|
||||||
|
setTimeout(function(){self._showToolbar();}, 0);//wtf???
|
||||||
|
//this._renderView();
|
||||||
},
|
},
|
||||||
|
|
||||||
onShow : function() {
|
onShow : function() {
|
||||||
|
@ -375,6 +382,7 @@ module.exports = Marionette.Layout.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_showToolbar : function() {
|
_showToolbar : function() {
|
||||||
|
//debugger;
|
||||||
if (this.toolbar.currentView) {
|
if (this.toolbar.currentView) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -416,7 +424,7 @@ module.exports = Marionette.Layout.extend({
|
||||||
var movies = FullMovieCollection.models.length;
|
var movies = FullMovieCollection.models.length;
|
||||||
//instead of all the counters could do something like this with different query in the where...
|
//instead of all the counters could do something like this with different query in the where...
|
||||||
//var releasedMovies = FullMovieCollection.where({ 'released' : this.model.get('released') });
|
//var releasedMovies = FullMovieCollection.where({ 'released' : this.model.get('released') });
|
||||||
// releasedMovies.length
|
// releasedMovies.length
|
||||||
|
|
||||||
var announced = 0;
|
var announced = 0;
|
||||||
var incinemas = 0;
|
var incinemas = 0;
|
||||||
|
|
|
@ -13,6 +13,44 @@ var Config = require('../Config');
|
||||||
|
|
||||||
var pageSize = parseInt(Config.getValue("pageSize")) || 1000;
|
var pageSize = parseInt(Config.getValue("pageSize")) || 1000;
|
||||||
|
|
||||||
|
var filterModes = {
|
||||||
|
'all' : [
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
],
|
||||||
|
'continuing' : [
|
||||||
|
'status',
|
||||||
|
'continuing'
|
||||||
|
],
|
||||||
|
'ended' : [
|
||||||
|
'status',
|
||||||
|
'ended'
|
||||||
|
],
|
||||||
|
'monitored' : [
|
||||||
|
'monitored',
|
||||||
|
true
|
||||||
|
],
|
||||||
|
'missing' : [
|
||||||
|
'downloaded',
|
||||||
|
false
|
||||||
|
],
|
||||||
|
'released' : [
|
||||||
|
"status",
|
||||||
|
"released",
|
||||||
|
//function(model) { return model.getStatus() == "released"; }
|
||||||
|
],
|
||||||
|
'announced' : [
|
||||||
|
"status",
|
||||||
|
"announced",
|
||||||
|
//function(model) { return model.getStatus() == "announced"; }
|
||||||
|
],
|
||||||
|
'cinemas' : [
|
||||||
|
"status",
|
||||||
|
"inCinemas",
|
||||||
|
//function(model) { return model.getStatus() == "inCinemas"; }
|
||||||
|
]
|
||||||
|
}//Hacky, I know
|
||||||
|
|
||||||
|
|
||||||
var Collection = PageableCollection.extend({
|
var Collection = PageableCollection.extend({
|
||||||
url : window.NzbDrone.ApiRoot + '/movie',
|
url : window.NzbDrone.ApiRoot + '/movie',
|
||||||
|
@ -122,43 +160,7 @@ var Collection = PageableCollection.extend({
|
||||||
return proxy.save();
|
return proxy.save();
|
||||||
},
|
},
|
||||||
|
|
||||||
filterModes : {
|
filterModes : filterModes,
|
||||||
'all' : [
|
|
||||||
null,
|
|
||||||
null
|
|
||||||
],
|
|
||||||
'continuing' : [
|
|
||||||
'status',
|
|
||||||
'continuing'
|
|
||||||
],
|
|
||||||
'ended' : [
|
|
||||||
'status',
|
|
||||||
'ended'
|
|
||||||
],
|
|
||||||
'monitored' : [
|
|
||||||
'monitored',
|
|
||||||
true
|
|
||||||
],
|
|
||||||
'missing' : [
|
|
||||||
'downloaded',
|
|
||||||
false
|
|
||||||
],
|
|
||||||
'released' : [
|
|
||||||
"status",
|
|
||||||
"released",
|
|
||||||
//function(model) { return model.getStatus() == "released"; }
|
|
||||||
],
|
|
||||||
'announced' : [
|
|
||||||
"status",
|
|
||||||
"announced",
|
|
||||||
//function(model) { return model.getStatus() == "announced"; }
|
|
||||||
],
|
|
||||||
'cinemas' : [
|
|
||||||
"status",
|
|
||||||
"inCinemas",
|
|
||||||
//function(model) { return model.getStatus() == "inCinemas"; }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
sortMappings : {
|
sortMappings : {
|
||||||
title : {
|
title : {
|
||||||
|
@ -263,6 +265,16 @@ Collection = AsFilteredCollection.call(Collection);
|
||||||
Collection = AsSortedCollection.call(Collection);
|
Collection = AsSortedCollection.call(Collection);
|
||||||
Collection = AsPersistedStateCollection.call(Collection);
|
Collection = AsPersistedStateCollection.call(Collection);
|
||||||
|
|
||||||
var data = ApiData.get('movie?page=1&pageSize='+pageSize+'&sortKey=sortTitle&sortDir=asc');
|
var filterMode = Config.getValue("series.filterMode", "all");
|
||||||
|
var sortKey = Config.getValue("movie.sortKey", "sortTitle");
|
||||||
|
var sortDir = Config.getValue("movie.sortDirection", -1);
|
||||||
|
var sortD = "asc";
|
||||||
|
if (sortDir == 1) {
|
||||||
|
sortD = "desc";
|
||||||
|
}
|
||||||
|
|
||||||
|
var values = filterModes[filterMode];
|
||||||
|
|
||||||
|
var data = ApiData.get("movie?page=1&pageSize={0}&sortKey={3}&sortDir={4}&filterKey={1}&filterValue={2}".format(pageSize, values[0], values[1], sortKey, sortD));
|
||||||
|
|
||||||
module.exports = new Collection(data.records, { full : false, state : { totalRecords : data.totalRecords} }).bindSignalR();
|
module.exports = new Collection(data.records, { full : false, state : { totalRecords : data.totalRecords} }).bindSignalR();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue