2017-03-09 09:42:59 +00:00
|
|
|
define([
|
|
|
|
'underscore',
|
|
|
|
'backbone.paginator',
|
|
|
|
'common',
|
|
|
|
'sysadmin-app/models/admin-log'
|
|
|
|
], function(_, BackbonePaginator, Common, AdminLogModel) {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var AdminLogCollection = Backbone.PageableCollection.extend({
|
|
|
|
|
|
|
|
model: AdminLogModel,
|
|
|
|
|
|
|
|
url: function() {
|
|
|
|
return Common.getUrl({name: 'admin-logs'});
|
|
|
|
},
|
|
|
|
|
|
|
|
state: {
|
|
|
|
firstPage: 1,
|
2017-03-14 07:45:32 +00:00
|
|
|
pageSize: 100
|
2017-03-09 09:42:59 +00:00
|
|
|
},
|
|
|
|
|
2017-03-14 07:45:32 +00:00
|
|
|
// Setting a parameter mapping value to null removes it from the query string
|
2017-03-09 09:42:59 +00:00
|
|
|
queryParams: {
|
|
|
|
currentPage: "page",
|
|
|
|
pageSize: "per_page",
|
|
|
|
totalPages: null,
|
2017-03-14 07:45:32 +00:00
|
|
|
totalRecords: null
|
2017-03-09 09:42:59 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
parseState: function (resp) {
|
|
|
|
return {totalRecords: resp.total_count};
|
|
|
|
},
|
|
|
|
|
|
|
|
parseRecords: function (resp) {
|
|
|
|
return resp.data;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return AdminLogCollection;
|
|
|
|
});
|