1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/UI/Logs/Layout.js

81 lines
2.4 KiB
JavaScript
Raw Normal View History

2013-06-22 09:24:24 +03:00
'use strict';
2013-07-14 05:40:47 +03:00
define(
[
'marionette',
'backgrid',
'Logs/LogTimeCell',
'Logs/LogLevelCell',
'Shared/Grid/Pager',
'Logs/Collection'
], function (Marionette, Backgrid, LogTimeCell, LogLevelCell, GridPager, LogCollection) {
return Marionette.Layout.extend({
2013-06-05 03:49:53 +03:00
template: 'Logs/LayoutTemplate',
regions: {
grid : '#x-grid',
toolbar: '#x-toolbar',
pager : '#x-pager'
},
2013-07-14 05:40:47 +03:00
attributes: {
id: 'logs-screen'
},
columns:
[
{
name : 'level',
label : '',
sortable: true,
cell : LogLevelCell
},
{
name : 'logger',
label : 'Component',
sortable: true,
cell : Backgrid.StringCell.extend({
className: 'log-logger-cell'
})
},
{
name : 'message',
label : 'Message',
sortable: false,
cell : Backgrid.StringCell.extend({
className: 'log-message-cell'
})
},
{
name : 'time',
label: 'Time',
cell : LogTimeCell
}
],
2013-06-05 03:49:53 +03:00
showTable: function () {
2013-07-14 05:40:47 +03:00
this.grid.show(new Backgrid.Grid({
row : Backgrid.Row,
columns : this.columns,
collection: this.collection,
className : 'table table-hover'
}));
2013-06-05 03:49:53 +03:00
this.pager.show(new GridPager({
2013-06-05 03:49:53 +03:00
columns : this.columns,
collection: this.collection
}));
},
initialize: function () {
this.collection = new LogCollection();
2013-06-05 03:49:53 +03:00
this.collection.fetch();
},
onShow: function () {
this.showTable();
}
2013-07-14 05:40:47 +03:00
});
});