rjs -> webpack

This commit is contained in:
Keivan Beigi
2015-02-02 17:18:45 -08:00
parent 344f3d66ef
commit 428a1439e5
399 changed files with 11591 additions and 16139 deletions
+11 -16
View File
@@ -1,17 +1,12 @@
'use strict';
define(
[
'backbone'
], function (Backbone) {
return Backbone.Model.extend({
url: function () {
return this.get('contentsUrl');
},
var Backbone = require('backbone');
parse: function (contents) {
var response = {};
response.contents = contents;
return response;
}
});
});
module.exports = Backbone.Model.extend({
url : function(){
return this.get('contentsUrl');
},
parse : function(contents){
var response = {};
response.contents = contents;
return response;
}
});
+2 -9
View File
@@ -1,10 +1,3 @@
'use strict';
var Marionette = require('marionette');
define(
[
'marionette'
], function (Marionette) {
return Marionette.ItemView.extend({
template: 'System/Logs/Files/ContentsViewTemplate'
});
});
module.exports = Marionette.ItemView.extend({template : 'System/Logs/Files/ContentsViewTemplate'});
+9 -16
View File
@@ -1,17 +1,10 @@
'use strict';
define(
[
'../../../Cells/NzbDroneCell'
], function (NzbDroneCell) {
return NzbDroneCell.extend({
var NzbDroneCell = require('../../../Cells/NzbDroneCell');
className: 'download-log-cell',
render: function () {
this.$el.empty();
this.$el.html('<a href="{0}" class="no-router" target="_blank">Download</a>'.format(this.cellValue));
return this;
}
});
});
module.exports = NzbDroneCell.extend({
className : 'download-log-cell',
render : function(){
this.$el.empty();
this.$el.html('<a href="{0}" class="no-router" target="_blank">Download</a>'.format(this.cellValue));
return this;
}
});
+9 -17
View File
@@ -1,18 +1,10 @@
'use strict';
define(
[
'../../../Cells/NzbDroneCell'
], function (NzbDroneCell) {
return NzbDroneCell.extend({
var NzbDroneCell = require('../../../Cells/NzbDroneCell');
className: 'log-filename-cell',
render: function () {
var filename = this._getValue();
this.$el.html(filename);
return this;
}
});
});
module.exports = NzbDroneCell.extend({
className : 'log-filename-cell',
render : function(){
var filename = this._getValue();
this.$el.html(filename);
return this;
}
});
+10 -16
View File
@@ -1,17 +1,11 @@
'use strict';
var Backbone = require('backbone');
var LogFileModel = require('./LogFileModel');
define(
[
'backbone',
'System/Logs/Files/LogFileModel'
], function (Backbone, LogFileModel) {
return Backbone.Collection.extend({
url : window.NzbDrone.ApiRoot + '/log/file',
model: LogFileModel,
state: {
sortKey: 'lastWriteTime',
order : 1
}
});
});
module.exports = Backbone.Collection.extend({
url : window.NzbDrone.ApiRoot + '/log/file',
model : LogFileModel,
state : {
sortKey : 'lastWriteTime',
order : 1
}
});
+107 -154
View File
@@ -1,155 +1,108 @@
'use strict';
define(
[
'vent',
'marionette',
'backgrid',
'System/Logs/Files/FilenameCell',
'Cells/RelativeDateCell',
'System/Logs/Files/DownloadLogCell',
'System/Logs/Files/Row',
'System/Logs/Files/ContentsView',
'System/Logs/Files/ContentsModel',
'Shared/Toolbar/ToolbarLayout',
'Shared/LoadingView',
'jQuery/jquery.spin'
], function (vent,
Marionette,
Backgrid,
FilenameCell,
RelativeDateCell,
DownloadLogCell,
LogFileRow,
ContentsView,
ContentsModel,
ToolbarLayout,
LoadingView) {
return Marionette.Layout.extend({
template: 'System/Logs/Files/LogFileLayoutTemplate',
var vent = require('../../../vent');
var Marionette = require('marionette');
var Backgrid = require('backgrid');
var FilenameCell = require('./FilenameCell');
var RelativeDateCell = require('../../../Cells/RelativeDateCell');
var DownloadLogCell = require('./DownloadLogCell');
var LogFileRow = require('./Row');
var ContentsView = require('./ContentsView');
var ContentsModel = require('./ContentsModel');
var ToolbarLayout = require('../../../Shared/Toolbar/ToolbarLayout');
var LoadingView = require('../../../Shared/LoadingView');
require('../../../jQuery/jquery.spin');
regions: {
toolbar : '#x-toolbar',
grid : '#x-grid',
contents : '#x-contents'
},
columns:
[
{
name : 'filename',
label: 'Filename',
cell : FilenameCell,
sortable: false
},
{
name : 'lastWriteTime',
label: 'Last Write Time',
cell : RelativeDateCell,
sortable: false
},
{
name : 'downloadUrl',
label : '',
cell : DownloadLogCell,
sortable: false
}
],
initialize: function (options) {
this.collection = options.collection;
this.deleteFilesCommand = options.deleteFilesCommand;
this.listenTo(vent, vent.Commands.ShowLogFile, this._fetchLogFileContents);
this.listenTo(vent, vent.Events.CommandComplete, this._commandComplete);
this.listenTo(this.collection, 'sync', this._collectionSynced);
this.collection.fetch();
},
onShow: function () {
this._showToolbar();
this._showTable();
},
_showToolbar: function () {
var leftSideButtons = {
type : 'default',
storeState: false,
items :
[
{
title : 'Refresh',
icon : 'icon-refresh',
ownerContext : this,
callback : this._refreshTable
},
{
title : 'Delete Log Files',
icon : 'icon-trash',
command : this.deleteFilesCommand,
successMessage : 'Log files have been deleted',
errorMessage : 'Failed to delete log files'
}
]
};
this.toolbar.show(new ToolbarLayout({
left :
[
leftSideButtons
],
context: this
}));
},
_showTable: function () {
this.grid.show(new Backgrid.Grid({
row : LogFileRow,
columns : this.columns,
collection: this.collection,
className : 'table table-hover'
}));
},
_collectionSynced: function () {
if (!this.collection.any()) {
return;
}
var model = this.collection.first();
this._fetchLogFileContents({ model: model });
},
_fetchLogFileContents: function (options) {
this.contents.show(new LoadingView());
var model = options.model;
var contentsModel = new ContentsModel(model.toJSON());
this.listenToOnce(contentsModel, 'sync', this._showDetails);
contentsModel.fetch({ dataType: 'text' });
},
_showDetails: function (model) {
this.contents.show(new ContentsView({ model: model }));
},
_refreshTable: function (buttonContext) {
this.contents.close();
var promise = this.collection.fetch();
//Would be nice to spin the icon on the refresh button
if (buttonContext) {
buttonContext.ui.icon.spinForPromise(promise);
}
},
_commandComplete: function (options) {
if (options.command.get('name') === this.deleteFilesCommand.toLowerCase()) {
this._refreshTable();
}
}
});
});
module.exports = Marionette.Layout.extend({
template : 'System/Logs/Files/LogFileLayoutTemplate',
regions : {
toolbar : '#x-toolbar',
grid : '#x-grid',
contents : '#x-contents'
},
columns : [{
name : 'filename',
label : 'Filename',
cell : FilenameCell,
sortable : false
}, {
name : 'lastWriteTime',
label : 'Last Write Time',
cell : RelativeDateCell,
sortable : false
}, {
name : 'downloadUrl',
label : '',
cell : DownloadLogCell,
sortable : false
}],
initialize : function(options){
this.collection = options.collection;
this.deleteFilesCommand = options.deleteFilesCommand;
this.listenTo(vent, vent.Commands.ShowLogFile, this._fetchLogFileContents);
this.listenTo(vent, vent.Events.CommandComplete, this._commandComplete);
this.listenTo(this.collection, 'sync', this._collectionSynced);
this.collection.fetch();
},
onShow : function(){
this._showToolbar();
this._showTable();
},
_showToolbar : function(){
var leftSideButtons = {
type : 'default',
storeState : false,
items : [{
title : 'Refresh',
icon : 'icon-refresh',
ownerContext : this,
callback : this._refreshTable
}, {
title : 'Delete Log Files',
icon : 'icon-trash',
command : this.deleteFilesCommand,
successMessage : 'Log files have been deleted',
errorMessage : 'Failed to delete log files'
}]
};
this.toolbar.show(new ToolbarLayout({
left : [leftSideButtons],
context : this
}));
},
_showTable : function(){
this.grid.show(new Backgrid.Grid({
row : LogFileRow,
columns : this.columns,
collection : this.collection,
className : 'table table-hover'
}));
},
_collectionSynced : function(){
if(!this.collection.any()) {
return;
}
var model = this.collection.first();
this._fetchLogFileContents({model : model});
},
_fetchLogFileContents : function(options){
this.contents.show(new LoadingView());
var model = options.model;
var contentsModel = new ContentsModel(model.toJSON());
this.listenToOnce(contentsModel, 'sync', this._showDetails);
contentsModel.fetch({dataType : 'text'});
},
_showDetails : function(model){
this.contents.show(new ContentsView({model : model}));
},
_refreshTable : function(buttonContext){
this.contents.close();
var promise = this.collection.fetch();
if(buttonContext) {
buttonContext.ui.icon.spinForPromise(promise);
}
},
_commandComplete : function(options){
if(options.command.get('name') === this.deleteFilesCommand.toLowerCase()) {
this._refreshTable();
}
}
});
+3 -8
View File
@@ -1,8 +1,3 @@
'use strict';
define(
[
'backbone'
], function (Backbone) {
return Backbone.Model.extend({
});
});
var Backbone = require('backbone');
module.exports = Backbone.Model.extend({});
+9 -18
View File
@@ -1,19 +1,10 @@
'use strict';
define(
[
'../../../vent',
'backgrid'
], function (vent, Backgrid) {
var vent = require('../../../vent');
var Backgrid = require('backgrid');
return Backgrid.Row.extend({
className: 'log-file-row',
events: {
'click': '_showDetails'
},
_showDetails: function () {
vent.trigger(vent.Commands.ShowLogFile, { model: this.model });
}
});
});
module.exports = Backgrid.Row.extend({
className : 'log-file-row',
events : {"click" : '_showDetails'},
_showDetails : function(){
vent.trigger(vent.Commands.ShowLogFile, {model : this.model});
}
});
+31 -44
View File
@@ -1,58 +1,45 @@
'use strict';
var PagableCollection = require('backbone.pageable');
var LogsModel = require('./LogsModel');
var AsFilteredCollection = require('../../Mixins/AsFilteredCollection');
var AsPersistedStateCollection = require('../../Mixins/AsPersistedStateCollection');
define(
[
'backbone.pageable',
'System/Logs/LogsModel',
'Mixins/AsFilteredCollection',
'Mixins/AsPersistedStateCollection'
],
function (PagableCollection, LogsModel, AsFilteredCollection, AsPersistedStateCollection) {
module.exports = (function(){
var collection = PagableCollection.extend({
url : window.NzbDrone.ApiRoot + '/log',
model: LogsModel,
tableName: 'logs',
state: {
pageSize: 50,
sortKey : 'time',
order : 1
url : window.NzbDrone.ApiRoot + '/log',
model : LogsModel,
tableName : 'logs',
state : {
pageSize : 50,
sortKey : 'time',
order : 1
},
queryParams: {
totalPages : null,
totalRecords: null,
pageSize : 'pageSize',
sortKey : 'sortKey',
order : 'sortDir',
directions : {
'-1': 'asc',
'1' : 'desc'
queryParams : {
totalPages : null,
totalRecords : null,
pageSize : 'pageSize',
sortKey : 'sortKey',
order : 'sortDir',
directions : {
"-1" : 'asc',
"1" : 'desc'
}
},
// Filter Modes
filterModes: {
'all' : [null, null],
'info' : ['level', 'Info'],
'warn' : ['level', 'Warn'],
'error' : ['level', 'Error']
filterModes : {
"all" : [null, null],
"info" : ['level', 'Info'],
"warn" : ['level', 'Warn'],
"error" : ['level', 'Error']
},
parseState: function (resp, queryParams, state) {
return {totalRecords: resp.totalRecords};
parseState : function(resp, queryParams, state){
return {totalRecords : resp.totalRecords};
},
parseRecords: function (resp) {
if (resp) {
parseRecords : function(resp){
if(resp) {
return resp.records;
}
return resp;
}
});
collection = AsFilteredCollection.apply(collection);
return AsPersistedStateCollection.apply(collection);
});
}).call(this);
+53 -67
View File
@@ -1,68 +1,54 @@
'use strict';
define(
[
'marionette',
'System/Logs/Table/LogsTableLayout',
'System/Logs/Files/LogFileLayout',
'System/Logs/Files/LogFileCollection',
'System/Logs/Updates/LogFileCollection'
], function (Marionette, LogsTableLayout, LogsFileLayout, LogFileCollection, UpdateLogFileCollection) {
return Marionette.Layout.extend({
template: 'System/Logs/LogsLayoutTemplate',
var Marionette = require('marionette');
var LogsTableLayout = require('./Table/LogsTableLayout');
var LogsFileLayout = require('./Files/LogFileLayout');
var LogFileCollection = require('./Files/LogFileCollection');
var UpdateLogFileCollection = require('./Updates/LogFileCollection');
ui: {
tableTab : '.x-table-tab',
filesTab : '.x-files-tab',
updateFilesTab : '.x-update-files-tab'
},
regions: {
table : '#table',
files : '#files',
updateFiles : '#update-files'
},
events: {
'click .x-table-tab' : '_showTable',
'click .x-files-tab' : '_showFiles',
'click .x-update-files-tab' : '_showUpdateFiles'
},
onShow: function () {
this._showTable();
},
_showTable: function (e) {
if (e) {
e.preventDefault();
}
this.ui.tableTab.tab('show');
this.table.show(new LogsTableLayout());
},
_showFiles: function (e) {
if (e) {
e.preventDefault();
}
this.ui.filesTab.tab('show');
this.files.show(new LogsFileLayout({
collection: new LogFileCollection(),
deleteFilesCommand: 'deleteLogFiles'
}));
},
_showUpdateFiles: function (e) {
if (e) {
e.preventDefault();
}
this.ui.updateFilesTab.tab('show');
this.updateFiles.show(new LogsFileLayout({
collection: new UpdateLogFileCollection(),
deleteFilesCommand: 'deleteUpdateLogFiles'
}));
}
});
});
module.exports = Marionette.Layout.extend({
template : 'System/Logs/LogsLayoutTemplate',
ui : {
tableTab : '.x-table-tab',
filesTab : '.x-files-tab',
updateFilesTab : '.x-update-files-tab'
},
regions : {
table : '#table',
files : '#files',
updateFiles : '#update-files'
},
events : {
"click .x-table-tab" : '_showTable',
"click .x-files-tab" : '_showFiles',
"click .x-update-files-tab" : '_showUpdateFiles'
},
onShow : function(){
this._showTable();
},
_showTable : function(e){
if(e) {
e.preventDefault();
}
this.ui.tableTab.tab('show');
this.table.show(new LogsTableLayout());
},
_showFiles : function(e){
if(e) {
e.preventDefault();
}
this.ui.filesTab.tab('show');
this.files.show(new LogsFileLayout({
collection : new LogFileCollection(),
deleteFilesCommand : 'deleteLogFiles'
}));
},
_showUpdateFiles : function(e){
if(e) {
e.preventDefault();
}
this.ui.updateFilesTab.tab('show');
this.updateFiles.show(new LogsFileLayout({
collection : new UpdateLogFileCollection(),
deleteFilesCommand : 'deleteUpdateLogFiles'
}));
}
});
+3 -8
View File
@@ -1,8 +1,3 @@
'use strict';
define(
[
'backbone'
], function (Backbone) {
return Backbone.Model.extend({
});
});
var Backbone = require('backbone');
module.exports = Backbone.Model.extend({});
@@ -1,11 +1,4 @@
'use strict';
define(
[
'vent',
'marionette'
], function (vent, Marionette) {
var vent = require('../../../../vent');
var Marionette = require('marionette');
return Marionette.ItemView.extend({
template: 'System/Logs/Table/Details/LogDetailsViewTemplate'
});
});
module.exports = Marionette.ItemView.extend({template : 'System/Logs/Table/Details/LogDetailsViewTemplate'});
+9 -17
View File
@@ -1,18 +1,10 @@
'use strict';
define(
[
'Cells/NzbDroneCell'
], function (NzbDroneCell) {
return NzbDroneCell.extend({
var NzbDroneCell = require('../../../Cells/NzbDroneCell');
className: 'log-level-cell',
render: function () {
var level = this._getValue();
this.$el.html('<i class="icon-{0}" title="{1}"/>'.format(this._getValue().toLowerCase(), level));
return this;
}
});
});
module.exports = NzbDroneCell.extend({
className : 'log-level-cell',
render : function(){
var level = this._getValue();
this.$el.html('<i class="icon-{0}" title="{1}"/>'.format(this._getValue().toLowerCase(), level));
return this;
}
});
+9 -18
View File
@@ -1,19 +1,10 @@
'use strict';
define(
[
'vent',
'backgrid'
], function (vent, Backgrid) {
var vent = require('../../../vent');
var Backgrid = require('backgrid');
return Backgrid.Row.extend({
className: 'log-row',
events: {
'click': '_showDetails'
},
_showDetails: function () {
vent.trigger(vent.Commands.ShowLogDetails, { model: this.model });
}
});
});
module.exports = Backgrid.Row.extend({
className : 'log-row',
events : {"click" : '_showDetails'},
_showDetails : function(){
vent.trigger(vent.Commands.ShowLogDetails, {model : this.model});
}
});
+11 -19
View File
@@ -1,20 +1,12 @@
'use strict';
define(
[
'Cells/NzbDroneCell',
'moment',
'Shared/UiSettingsModel'
], function (NzbDroneCell, moment, UiSettings) {
return NzbDroneCell.extend({
var NzbDroneCell = require('../../../Cells/NzbDroneCell');
var moment = require('moment');
var UiSettings = require('../../../Shared/UiSettingsModel');
className: 'log-time-cell',
render: function () {
var date = moment(this._getValue());
this.$el.html('<span title="{1}">{0}</span>'.format(date.format(UiSettings.time(true, false)), date.format(UiSettings.longDateTime(true))));
return this;
}
});
});
module.exports = NzbDroneCell.extend({
className : 'log-time-cell',
render : function(){
var date = moment(this._getValue());
this.$el.html('<span title="{1}">{0}</span>'.format(date.format(UiSettings.time(true, false)), date.format(UiSettings.longDateTime(true))));
return this;
}
});
+136 -188
View File
@@ -1,189 +1,137 @@
'use strict';
define(
[
'vent',
'marionette',
'backgrid',
'System/Logs/Table/LogTimeCell',
'System/Logs/Table/LogLevelCell',
'System/Logs/Table/LogRow',
'Shared/Grid/Pager',
'System/Logs/LogsCollection',
'Shared/Toolbar/ToolbarLayout',
'Shared/LoadingView',
'jQuery/jquery.spin'
], function (vent, Marionette, Backgrid, LogTimeCell, LogLevelCell, LogRow, GridPager, LogCollection, ToolbarLayout, LoadingView) {
return Marionette.Layout.extend({
template: 'System/Logs/Table/LogsTableLayoutTemplate',
var vent = require('../../../vent');
var Marionette = require('marionette');
var Backgrid = require('backgrid');
var LogTimeCell = require('./LogTimeCell');
var LogLevelCell = require('./LogLevelCell');
var LogRow = require('./LogRow');
var GridPager = require('../../../Shared/Grid/Pager');
var LogCollection = require('../LogsCollection');
var ToolbarLayout = require('../../../Shared/Toolbar/ToolbarLayout');
var LoadingView = require('../../../Shared/LoadingView');
require('../../../jQuery/jquery.spin');
regions: {
grid : '#x-grid',
toolbar: '#x-toolbar',
pager : '#x-pager'
},
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
}
],
initialize: function () {
this.collection = new LogCollection();
this.listenTo(this.collection, 'sync', this._showTable);
this.listenTo(vent, vent.Events.CommandComplete, this._commandComplete);
},
onRender: function () {
this.grid.show(new LoadingView());
},
onShow: function () {
this._showToolbar();
},
_showTable: function () {
this.grid.show(new Backgrid.Grid({
row : LogRow,
columns : this.columns,
collection: this.collection,
className : 'table table-hover'
}));
this.pager.show(new GridPager({
columns : this.columns,
collection: this.collection
}));
},
_showToolbar: function () {
var filterButtons = {
type : 'radio',
storeState : true,
menuKey : 'logs.filterMode',
defaultAction: 'all',
items :
[
{
key : 'all',
title : '',
tooltip : 'All',
icon : 'icon-circle-blank',
callback : this._setFilter
},
{
key : 'info',
title : '',
tooltip : 'Info',
icon : 'icon-info',
callback : this._setFilter
},
{
key : 'warn',
title : '',
tooltip : 'Warn',
icon : 'icon-warn',
callback : this._setFilter
},
{
key : 'error',
title : '',
tooltip : 'Error',
icon : 'icon-error',
callback : this._setFilter
}
]
};
var leftSideButtons = {
type : 'default',
storeState: false,
items :
[
{
title : 'Refresh',
icon : 'icon-refresh',
ownerContext : this,
callback : this._refreshTable
},
{
title : 'Clear Logs',
icon : 'icon-trash',
command : 'clearLog'
}
]
};
this.toolbar.show(new ToolbarLayout({
left :
[
leftSideButtons
],
right :
[
filterButtons
],
context: this
}));
},
_refreshTable: function (buttonContext) {
this.collection.state.currentPage = 1;
var promise = this.collection.fetch({ reset: true });
if (buttonContext) {
buttonContext.ui.icon.spinForPromise(promise);
}
},
_setFilter: function(buttonContext) {
var mode = buttonContext.model.get('key');
this.collection.setFilterMode(mode, { reset: false });
this.collection.state.currentPage = 1;
var promise = this.collection.fetch({ reset: true });
if (buttonContext) {
buttonContext.ui.icon.spinForPromise(promise);
}
},
_commandComplete: function (options) {
if (options.command.get('name') === 'clearlog') {
this._refreshTable();
}
}
});
});
module.exports = Marionette.Layout.extend({
template : 'System/Logs/Table/LogsTableLayoutTemplate',
regions : {
grid : '#x-grid',
toolbar : '#x-toolbar',
pager : '#x-pager'
},
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
}],
initialize : function(){
this.collection = new LogCollection();
this.listenTo(this.collection, 'sync', this._showTable);
this.listenTo(vent, vent.Events.CommandComplete, this._commandComplete);
},
onRender : function(){
this.grid.show(new LoadingView());
},
onShow : function(){
this._showToolbar();
},
_showTable : function(){
this.grid.show(new Backgrid.Grid({
row : LogRow,
columns : this.columns,
collection : this.collection,
className : 'table table-hover'
}));
this.pager.show(new GridPager({
columns : this.columns,
collection : this.collection
}));
},
_showToolbar : function(){
var filterButtons = {
type : 'radio',
storeState : true,
menuKey : 'logs.filterMode',
defaultAction : 'all',
items : [{
key : 'all',
title : '',
tooltip : 'All',
icon : 'icon-circle-blank',
callback : this._setFilter
}, {
key : 'info',
title : '',
tooltip : 'Info',
icon : 'icon-info',
callback : this._setFilter
}, {
key : 'warn',
title : '',
tooltip : 'Warn',
icon : 'icon-warn',
callback : this._setFilter
}, {
key : 'error',
title : '',
tooltip : 'Error',
icon : 'icon-error',
callback : this._setFilter
}]
};
var leftSideButtons = {
type : 'default',
storeState : false,
items : [{
title : 'Refresh',
icon : 'icon-refresh',
ownerContext : this,
callback : this._refreshTable
}, {
title : 'Clear Logs',
icon : 'icon-trash',
command : 'clearLog'
}]
};
this.toolbar.show(new ToolbarLayout({
left : [leftSideButtons],
right : [filterButtons],
context : this
}));
},
_refreshTable : function(buttonContext){
this.collection.state.currentPage = 1;
var promise = this.collection.fetch({reset : true});
if(buttonContext) {
buttonContext.ui.icon.spinForPromise(promise);
}
},
_setFilter : function(buttonContext){
var mode = buttonContext.model.get('key');
this.collection.setFilterMode(mode, {reset : false});
this.collection.state.currentPage = 1;
var promise = this.collection.fetch({reset : true});
if(buttonContext) {
buttonContext.ui.icon.spinForPromise(promise);
}
},
_commandComplete : function(options){
if(options.command.get('name') === 'clearlog') {
this._refreshTable();
}
}
});
+10 -16
View File
@@ -1,17 +1,11 @@
'use strict';
var Backbone = require('backbone');
var LogFileModel = require('./LogFileModel');
define(
[
'backbone',
'System/Logs/Updates/LogFileModel'
], function (Backbone, LogFileModel) {
return Backbone.Collection.extend({
url : window.NzbDrone.ApiRoot + '/log/file/update',
model: LogFileModel,
state: {
sortKey: 'lastWriteTime',
order : 1
}
});
});
module.exports = Backbone.Collection.extend({
url : window.NzbDrone.ApiRoot + '/log/file/update',
model : LogFileModel,
state : {
sortKey : 'lastWriteTime',
order : 1
}
});
+3 -8
View File
@@ -1,8 +1,3 @@
'use strict';
define(
[
'backbone'
], function (Backbone) {
return Backbone.Model.extend({
});
});
var Backbone = require('backbone');
module.exports = Backbone.Model.extend({});