mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-08-08 02:13:34 +00:00
Filtered log views
This commit is contained in:
60
frontend/js/app/openappsec-log/list-all/main.js
Normal file
60
frontend/js/app/openappsec-log/list-all/main.js
Normal file
@@ -0,0 +1,60 @@
|
||||
const Mn = require('backbone.marionette');
|
||||
const ItemView = require('./item');
|
||||
const template = require('./main.ejs');
|
||||
|
||||
let TableBody = Mn.CollectionView.extend({
|
||||
tagName: 'tbody',
|
||||
childView: ItemView,
|
||||
|
||||
initialize: function (options) {
|
||||
this.options = new Backbone.Model(options);
|
||||
console.log("options: ", options);
|
||||
// this.page = options.page;
|
||||
// this.perPage = options.perPage;
|
||||
this.updatePage();
|
||||
// this.listenTo(this.options, 'change:page', this.updatePage);
|
||||
},
|
||||
|
||||
updatePage: function () {
|
||||
let perPage = this.perPage || this.collection.length;
|
||||
let page = this.page || 1;
|
||||
let models;
|
||||
if (this.perPage && this.page) {
|
||||
console.log('updatePage2');
|
||||
models = this.collection.models.slice((page - 1) * perPage, page * perPage);
|
||||
} else {
|
||||
console.log('updatePage3');
|
||||
|
||||
models = this.collection.models;
|
||||
}
|
||||
this.collection.reset(models);
|
||||
}
|
||||
|
||||
// updatePage: function () {
|
||||
// let perPage = this.perPage || this.collection.length;
|
||||
// let page = this.page || 1;
|
||||
// let models = this.collection.models.slice((page - 1) * perPage, page * perPage);
|
||||
// this.collection.reset(models);
|
||||
// }
|
||||
});
|
||||
|
||||
module.exports = Mn.View.extend({
|
||||
tagName: 'table',
|
||||
className: 'table table-hover table-outline table-vcenter card-table',
|
||||
template: template,
|
||||
|
||||
regions: {
|
||||
body: {
|
||||
el: 'tbody',
|
||||
replaceElement: true
|
||||
}
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
this.showChildView('body', new TableBody({
|
||||
collection: this.collection,
|
||||
// page: this.options.page,
|
||||
// perPage: this.options.perPage
|
||||
}));
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user