mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-17 21:25:39 -04:00
added /logs
This commit is contained in:
@@ -10,6 +10,7 @@ define(['app',
|
||||
'Series/Details/SeriesDetailsLayout',
|
||||
'Series/EpisodeCollection',
|
||||
'Settings/SettingsLayout',
|
||||
'Logs/Layout',
|
||||
'Missing/MissingLayout',
|
||||
'History/HistoryLayout'],
|
||||
function () {
|
||||
@@ -62,11 +63,17 @@ define(['app',
|
||||
NzbDrone.mainRegion.show(new NzbDrone.History.HistoryLayout());
|
||||
},
|
||||
|
||||
logs: function () {
|
||||
this._setTitle('logs');
|
||||
NzbDrone.mainRegion.show(new NzbDrone.Logs.Layout());
|
||||
},
|
||||
|
||||
notFound: function () {
|
||||
this._setTitle('Not Found');
|
||||
NzbDrone.mainRegion.show(new NzbDrone.Shared.NotFoundView(this));
|
||||
},
|
||||
|
||||
|
||||
_setTitle: function (title) {
|
||||
//$('#title-region').html(title);
|
||||
|
||||
|
||||
37
UI/Logs/Collection.js
Normal file
37
UI/Logs/Collection.js
Normal file
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
define(['app', 'Logs/Model'], function () {
|
||||
NzbDrone.Logs.Collection = Backbone.PageableCollection.extend({
|
||||
url : NzbDrone.Constants.ApiRoot + '/log',
|
||||
model : NzbDrone.Logs.Model,
|
||||
|
||||
state: {
|
||||
pageSize: 50,
|
||||
sortKey: "time",
|
||||
order: 1
|
||||
},
|
||||
|
||||
queryParams: {
|
||||
totalPages: null,
|
||||
totalRecords: null,
|
||||
pageSize: 'pageSize',
|
||||
sortKey: "sortKey",
|
||||
order: "sortDir",
|
||||
directions: {
|
||||
"-1": "asc",
|
||||
"1": "desc"
|
||||
}
|
||||
},
|
||||
|
||||
parseState: function (resp, queryParams, state) {
|
||||
return {totalRecords: resp.totalRecords};
|
||||
},
|
||||
|
||||
parseRecords: function (resp) {
|
||||
if (resp) {
|
||||
return resp.records;
|
||||
}
|
||||
|
||||
return resp;
|
||||
}
|
||||
});
|
||||
});
|
||||
72
UI/Logs/Layout.js
Normal file
72
UI/Logs/Layout.js
Normal file
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
define([
|
||||
'app',
|
||||
'Logs/Collection',
|
||||
'Shared/Toolbar/ToolbarLayout'
|
||||
],
|
||||
function () {
|
||||
NzbDrone.Logs.Layout = Backbone.Marionette.Layout.extend({
|
||||
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'
|
||||
}));
|
||||
|
||||
this.pager.show(new Backgrid.NzbDronePaginator({
|
||||
columns : this.columns,
|
||||
collection: this.collection
|
||||
}));
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.collection = new NzbDrone.Logs.Collection();
|
||||
this.collection.fetch();
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
this.showTable();
|
||||
//this.toolbar.show(new NzbDrone.Shared.Toolbar.ToolbarLayout({right: [ viewButtons], context: this}));
|
||||
}
|
||||
|
||||
})
|
||||
;
|
||||
})
|
||||
;
|
||||
11
UI/Logs/LayoutTemplate.html
Normal file
11
UI/Logs/LayoutTemplate.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<div id="x-toolbar"></div>
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
<div id="x-grid"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
<div id="x-pager"></div>
|
||||
</div>
|
||||
</div>
|
||||
14
UI/Logs/Model.js
Normal file
14
UI/Logs/Model.js
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
define(['app'], function (app) {
|
||||
NzbDrone.Logs.Model = Backbone.Model.extend({
|
||||
/* mutators: {
|
||||
seasonNumber: function () {
|
||||
return this.get('episode').seasonNumber;
|
||||
},
|
||||
|
||||
paddedEpisodeNumber: function () {
|
||||
return this.get('episode').episodeNumber.pad(2);
|
||||
}
|
||||
}*/
|
||||
});
|
||||
});
|
||||
@@ -16,6 +16,7 @@ require(['app', 'Controller'], function (app, controller) {
|
||||
'settings/:action(/:query)' : 'settings',
|
||||
'missing' : 'missing',
|
||||
'history' : 'history',
|
||||
'logs' : 'logs',
|
||||
':whatever' : 'notFound'
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user