New: Queue in UI is now paged
This commit is contained in:
parent
828e8eb147
commit
42936c956d
|
@ -3,13 +3,20 @@ define(
|
||||||
[
|
[
|
||||||
'underscore',
|
'underscore',
|
||||||
'backbone',
|
'backbone',
|
||||||
|
'backbone.pageable',
|
||||||
'History/Queue/QueueModel',
|
'History/Queue/QueueModel',
|
||||||
'Mixins/backbone.signalr.mixin'
|
'Mixins/backbone.signalr.mixin'
|
||||||
], function (_, Backbone, QueueModel) {
|
], function (_, Backbone, PageableCollection, QueueModel) {
|
||||||
var QueueCollection = Backbone.Collection.extend({
|
var QueueCollection = PageableCollection.extend({
|
||||||
url : window.NzbDrone.ApiRoot + '/queue',
|
url : window.NzbDrone.ApiRoot + '/queue',
|
||||||
model: QueueModel,
|
model: QueueModel,
|
||||||
|
|
||||||
|
state: {
|
||||||
|
pageSize: 15
|
||||||
|
},
|
||||||
|
|
||||||
|
mode: 'client',
|
||||||
|
|
||||||
findEpisode: function (episodeId) {
|
findEpisode: function (episodeId) {
|
||||||
return _.find(this.models, function (queueModel) {
|
return _.find(this.models, function (queueModel) {
|
||||||
return queueModel.get('episode').id === episodeId;
|
return queueModel.get('episode').id === episodeId;
|
||||||
|
|
|
@ -9,7 +9,8 @@ define(
|
||||||
'Cells/EpisodeTitleCell',
|
'Cells/EpisodeTitleCell',
|
||||||
'Cells/QualityCell',
|
'Cells/QualityCell',
|
||||||
'History/Queue/QueueStatusCell',
|
'History/Queue/QueueStatusCell',
|
||||||
'History/Queue/TimeleftCell'
|
'History/Queue/TimeleftCell',
|
||||||
|
'Shared/Grid/Pager'
|
||||||
], function (Marionette,
|
], function (Marionette,
|
||||||
Backgrid,
|
Backgrid,
|
||||||
QueueCollection,
|
QueueCollection,
|
||||||
|
@ -18,12 +19,14 @@ define(
|
||||||
EpisodeTitleCell,
|
EpisodeTitleCell,
|
||||||
QualityCell,
|
QualityCell,
|
||||||
QueueStatusCell,
|
QueueStatusCell,
|
||||||
TimeleftCell) {
|
TimeleftCell,
|
||||||
|
GridPager) {
|
||||||
return Marionette.Layout.extend({
|
return Marionette.Layout.extend({
|
||||||
template: 'History/Queue/QueueLayoutTemplate',
|
template: 'History/Queue/QueueLayoutTemplate',
|
||||||
|
|
||||||
regions: {
|
regions: {
|
||||||
table: '#x-queue'
|
table: '#x-queue',
|
||||||
|
pager: '#x-queue-pager'
|
||||||
},
|
},
|
||||||
|
|
||||||
columns:
|
columns:
|
||||||
|
@ -65,7 +68,6 @@ define(
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
this.listenTo(QueueCollection, 'sync', this._showTable);
|
this.listenTo(QueueCollection, 'sync', this._showTable);
|
||||||
},
|
},
|
||||||
|
@ -80,6 +82,11 @@ define(
|
||||||
collection: QueueCollection,
|
collection: QueueCollection,
|
||||||
className : 'table table-hover'
|
className : 'table table-hover'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
this.pager.show(new GridPager({
|
||||||
|
columns : this.columns,
|
||||||
|
collection: QueueCollection
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,3 +3,9 @@
|
||||||
<div id="x-queue"/>
|
<div id="x-queue"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="span12">
|
||||||
|
<div id="x-queue-pager"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -79,7 +79,6 @@ define(
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
this.collection = new HistoryCollection({ tableName: 'history' });
|
this.collection = new HistoryCollection({ tableName: 'history' });
|
||||||
this.listenTo(this.collection, 'sync', this._showTable);
|
this.listenTo(this.collection, 'sync', this._showTable);
|
||||||
|
@ -104,6 +103,5 @@ define(
|
||||||
this.history.show(new LoadingView());
|
this.history.show(new LoadingView());
|
||||||
this.collection.fetch();
|
this.collection.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue