2013-06-22 08:24:24 +02:00
|
|
|
'use strict';
|
2013-07-14 04:40:47 +02:00
|
|
|
define(
|
|
|
|
[
|
|
|
|
'marionette',
|
|
|
|
'backgrid',
|
|
|
|
'Logs/LogTimeCell',
|
|
|
|
'Logs/LogLevelCell',
|
|
|
|
'Shared/Grid/Pager',
|
2013-07-29 01:13:14 +02:00
|
|
|
'Logs/Collection',
|
|
|
|
'Shared/Toolbar/ToolbarLayout'
|
|
|
|
], function (Marionette, Backgrid, LogTimeCell, LogLevelCell, GridPager, LogCollection, ToolbarLayout) {
|
2013-06-25 01:41:59 +02:00
|
|
|
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'
|
|
|
|
},
|
|
|
|
|
2013-07-14 04:40:47 +02: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 02:49:53 +02:00
|
|
|
|
2013-07-29 01:13:14 +02:00
|
|
|
leftSideButtons: {
|
|
|
|
type : 'default',
|
|
|
|
storeState: false,
|
|
|
|
items :
|
|
|
|
[
|
|
|
|
{
|
|
|
|
title: 'Files',
|
|
|
|
icon : 'icon-file',
|
|
|
|
route: 'logs/files'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
|
|
|
initialize: function () {
|
|
|
|
this.collection = new LogCollection();
|
|
|
|
this.collection.fetch();
|
|
|
|
},
|
|
|
|
|
|
|
|
onShow: function () {
|
|
|
|
this._showToolbar();
|
|
|
|
this._showTable();
|
|
|
|
},
|
|
|
|
|
|
|
|
_showTable: function () {
|
2013-06-05 02:49:53 +02:00
|
|
|
|
2013-07-14 04:40:47 +02:00
|
|
|
this.grid.show(new Backgrid.Grid({
|
|
|
|
row : Backgrid.Row,
|
|
|
|
columns : this.columns,
|
|
|
|
collection: this.collection,
|
|
|
|
className : 'table table-hover'
|
|
|
|
}));
|
2013-06-05 02:49:53 +02:00
|
|
|
|
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
|
|
|
|
}));
|
|
|
|
},
|
|
|
|
|
2013-07-29 01:13:14 +02:00
|
|
|
_showToolbar: function () {
|
|
|
|
this.toolbar.show(new ToolbarLayout({
|
|
|
|
left :
|
|
|
|
[
|
|
|
|
this.leftSideButtons
|
|
|
|
],
|
|
|
|
context: this
|
|
|
|
}));
|
2013-06-05 02:49:53 +02:00
|
|
|
}
|
2013-07-14 04:40:47 +02:00
|
|
|
});
|
|
|
|
});
|