1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2025-03-13 07:23:14 +00:00
Lidarr/src/UI/Wanted/Cutoff/CutoffUnmetCollection.js

60 lines
1.8 KiB
JavaScript

'use strict';
define(
[
'underscore',
'Series/EpisodeModel',
'backbone.pageable',
'Mixins/AsFilteredCollection',
'Mixins/AsSortedCollection',
'Mixins/AsPersistedStateCollection'
], function (_, EpisodeModel, PagableCollection, AsFilteredCollection, AsSortedCollection, AsPersistedStateCollection) {
var Collection = PagableCollection.extend({
url : window.NzbDrone.ApiRoot + '/wanted/cutoff',
model: EpisodeModel,
tableName: 'wanted.cutoff',
state: {
pageSize : 15,
sortKey : 'airDateUtc',
order : 1
},
queryParams: {
totalPages : null,
totalRecords: null,
pageSize : 'pageSize',
sortKey : 'sortKey',
order : 'sortDir',
directions : {
'-1': 'asc',
'1' : 'desc'
}
},
// Filter Modes
filterModes: {
'monitored' : ['monitored', 'true'],
'unmonitored' : ['monitored', 'false'],
},
sortMappings: {
'series' : { sortKey: 'series.sortTitle' }
},
parseState: function (resp) {
return {totalRecords: resp.totalRecords};
},
parseRecords: function (resp) {
if (resp) {
return resp.records;
}
return resp;
}
});
Collection = AsFilteredCollection.call(Collection);
Collection = AsSortedCollection.call(Collection);
return AsPersistedStateCollection.call(Collection);
});