mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-17 21:25:39 -04:00
New: The Manual Search result table is now sorted by the internal prioritization logic and sorting by quality now works as well.
Tnx to mspec and betrayed for averting catastrophe.
This commit is contained in:
@@ -20,48 +20,40 @@ define(
|
||||
columns:
|
||||
[
|
||||
{
|
||||
name : 'age',
|
||||
label : 'Age',
|
||||
sortable: true,
|
||||
cell : AgeCell
|
||||
name : 'age',
|
||||
label : 'Age',
|
||||
cell : AgeCell
|
||||
},
|
||||
{
|
||||
name : 'title',
|
||||
label : 'Title',
|
||||
sortable: true,
|
||||
cell : Backgrid.StringCell.extend({ className: 'nzb-title-cell' })
|
||||
name : 'title',
|
||||
label : 'Title',
|
||||
cell : Backgrid.StringCell.extend({ className: 'nzb-title-cell' })
|
||||
},
|
||||
{
|
||||
name : 'indexer',
|
||||
label : 'Indexer',
|
||||
sortable: true,
|
||||
cell : Backgrid.StringCell
|
||||
name : 'indexer',
|
||||
label : 'Indexer',
|
||||
cell : Backgrid.StringCell
|
||||
},
|
||||
{
|
||||
name : 'size',
|
||||
label : 'Size',
|
||||
sortable: true,
|
||||
cell : FileSizeCell
|
||||
name : 'size',
|
||||
label : 'Size',
|
||||
cell : FileSizeCell
|
||||
},
|
||||
{
|
||||
name : 'quality',
|
||||
label : 'Quality',
|
||||
sortable : true,
|
||||
cell : QualityCell,
|
||||
sortValue : function (model) {
|
||||
return model.get('quality').quality.weight;
|
||||
}
|
||||
cell : QualityCell
|
||||
},
|
||||
|
||||
{
|
||||
name : 'rejections',
|
||||
label: '',
|
||||
cell : ApprovalStatusCell
|
||||
name : 'rejections',
|
||||
label : '',
|
||||
cell : ApprovalStatusCell
|
||||
},
|
||||
{
|
||||
name : 'download',
|
||||
label: '',
|
||||
cell : DownloadReportCell
|
||||
name : 'download',
|
||||
label : '',
|
||||
cell : DownloadReportCell
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
@@ -1,19 +1,44 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'backbone',
|
||||
'Release/ReleaseModel'
|
||||
], function (Backbone, ReleaseModel) {
|
||||
return Backbone.Collection.extend({
|
||||
'backbone.pageable',
|
||||
'Release/ReleaseModel',
|
||||
'Mixins/AsSortedCollection'
|
||||
], function (PagableCollection, ReleaseModel, AsSortedCollection) {
|
||||
var Collection = PagableCollection.extend({
|
||||
url : window.NzbDrone.ApiRoot + '/release',
|
||||
model: ReleaseModel,
|
||||
|
||||
state: {
|
||||
pageSize: 2000
|
||||
pageSize : 2000,
|
||||
sortKey : 'download',
|
||||
order : -1
|
||||
},
|
||||
|
||||
mode: 'client',
|
||||
|
||||
sortMappings: {
|
||||
'quality' : { sortKey: 'qualityWeight' },
|
||||
'rejections' : { sortValue: function (model, attr) {
|
||||
var rejections = model.get('rejections');
|
||||
var releaseWeight = model.get('releaseWeight');
|
||||
|
||||
if (rejections.length !== 0) {
|
||||
return releaseWeight + 1000000;
|
||||
}
|
||||
|
||||
return releaseWeight;
|
||||
}
|
||||
},
|
||||
'download' : { sortKey: 'releaseWeight' }
|
||||
},
|
||||
|
||||
fetchEpisodeReleases: function (episodeId) {
|
||||
return this.fetch({ data: { episodeId: episodeId }});
|
||||
}
|
||||
});
|
||||
|
||||
Collection = AsSortedCollection.call(Collection);
|
||||
|
||||
return Collection;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user