2013-06-22 08:24:24 +02:00
|
|
|
'use strict';
|
2013-06-05 02:49:53 +02:00
|
|
|
define([
|
2013-06-25 01:41:59 +02:00
|
|
|
'marionette',
|
|
|
|
'backgrid',
|
|
|
|
'Shared/Grid/Pager',
|
|
|
|
'Logs/Collection'
|
2013-06-05 02:49:53 +02:00
|
|
|
],
|
2013-06-25 01:41:59 +02:00
|
|
|
function (Marionette,Backgrid, GridPager, LogCollection) {
|
|
|
|
return Marionette.Layout.extend({
|
2013-06-05 02:49:53 +02:00
|
|
|
template: 'Logs/LayoutTemplate',
|
|
|
|
|
|
|
|
regions: {
|
|
|
|
grid : '#x-grid',
|
|
|
|
toolbar: '#x-toolbar',
|
|
|
|
pager : '#x-pager'
|
|
|
|
},
|
|
|
|
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
name : 'level',
|
|
|
|
label : 'Level',
|
|
|
|
sortable: true,
|
|
|
|
cell : Backgrid.StringCell
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name : 'logger',
|
|
|
|
label : 'Component',
|
|
|
|
sortable: true,
|
|
|
|
cell : Backgrid.StringCell
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name : 'message',
|
|
|
|
label : 'Message',
|
|
|
|
sortable: false,
|
|
|
|
cell : Backgrid.StringCell
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name : 'time',
|
|
|
|
label: 'Time',
|
|
|
|
cell : Backgrid.DatetimeCell
|
|
|
|
}
|
|
|
|
],
|
|
|
|
|
|
|
|
showTable: function () {
|
|
|
|
|
|
|
|
this.grid.show(new Backgrid.Grid(
|
|
|
|
{
|
|
|
|
row : Backgrid.Row,
|
|
|
|
columns : this.columns,
|
|
|
|
collection: this.collection,
|
|
|
|
className : 'table table-hover'
|
|
|
|
}));
|
|
|
|
|
2013-06-25 01:41:59 +02:00
|
|
|
this.pager.show(new GridPager({
|
2013-06-05 02:49:53 +02:00
|
|
|
columns : this.columns,
|
|
|
|
collection: this.collection
|
|
|
|
}));
|
|
|
|
},
|
|
|
|
|
|
|
|
initialize: function () {
|
2013-06-25 01:41:59 +02:00
|
|
|
this.collection = new LogCollection();
|
2013-06-05 02:49:53 +02:00
|
|
|
this.collection.fetch();
|
|
|
|
},
|
|
|
|
|
|
|
|
onShow: function () {
|
|
|
|
this.showTable();
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
;
|
|
|
|
})
|
|
|
|
;
|