Filtered log views

This commit is contained in:
Rami Winestock
2023-12-13 17:40:51 +02:00
parent 80deae99d6
commit dbd78e5e03
19 changed files with 627 additions and 137 deletions

View File

@@ -0,0 +1,32 @@
<td><%- formatDbDate(eventTime, 'D-M-YY, H:mm') %></td>
<td>
<div class="text-nowrap">
<% var sevirityClass = 'bg-success';
switch (eventSeverity) {
case 'Critical':
sevirityClass = 'bg-danger';
break;
case 'Warning':
sevirityClass = 'bg-warning';
break;
case 'Info':
sevirityClass = 'bg-success';
//sevirityClass = 'bg-info';
break;
case 'Debug':
sevirityClass = 'bg-success';
break;
}
%>
<span class="status-icon <%- sevirityClass %>"></span> <%- eventSeverity %>
</div>
</td>
<td><%- eventPriority %></td>
<td><%- eventTopic %></td>
<td><%- eventName %></td>
<td><%- suggestedRemediation %></td>
<td><%- assetName %></td>
<td class="text-right">
<a href="#" class="meta btn btn-secondary btn-sm">open</a>
</td>

View File

@@ -0,0 +1,32 @@
const Mn = require('backbone.marionette');
const Controller = require('../../controller');
const template = require('./item.ejs');
module.exports = Mn.View.extend({
template: template,
tagName: 'tr',
ui: {
meta: 'a.meta'
},
events: {
'click @ui.meta': function (e) {
e.preventDefault();
Controller.showOpenappsecMeta(this.model);
}
},
templateContext: {
more: function() {
switch (this.object_type) {
case 'redirection-host':
case 'stream':
case 'proxy-host':
return this.meta.domain_names.join(', ');
}
return '#' + (this.object_id || '?');
}
}
});

View File

@@ -0,0 +1,13 @@
<thead>
<th>Time</th>
<th>Event Severity</th>
<th>Event Priority</th>
<th>Event Topic</th>
<th>Event Name</th>
<th>Suggested Remediation if Applicable</th>
<th>Asset Name</th>
<th>&nbsp;</th>
</thead>
<tbody>
<!-- items -->
</tbody>

View File

@@ -0,0 +1,43 @@
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);
this.page = options.page;
this.perPage = options.perPage;
this.updatePage();
this.listenTo(this.options, 'change:page', this.updatePage);
},
updatePage: function () {
console.log('updatePage');
let models = this.collection.models.slice((this.page - 1) * this.perPage, this.page * this.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
}));
}
});