1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-16 21:15:33 -04:00

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

View File

@@ -1,19 +1,13 @@
'use strict';
define(
[
'backbone.pageable',
'System/Backup/BackupModel'
], function (PageableCollection, BackupModel) {
return PageableCollection.extend({
url : window.NzbDrone.ApiRoot + '/system/backup',
model: BackupModel,
var PageableCollection = require('backbone.pageable');
var BackupModel = require('./BackupModel');
state: {
sortKey : 'time',
order : 1,
pageSize : 100000
},
mode: 'client'
});
});
module.exports = PageableCollection.extend({
url : window.NzbDrone.ApiRoot + '/system/backup',
model : BackupModel,
state : {
sortKey : 'time',
order : 1,
pageSize : 100000
},
mode : 'client'
});

View File

@@ -1,10 +1,3 @@
'use strict';
var Marionette = require('marionette');
define(
[
'marionette'
], function (Marionette) {
return Marionette.ItemView.extend({
template: 'System/Backup/BackupEmptyViewTemplate'
});
});
module.exports = Marionette.ItemView.extend({template : 'System/Backup/BackupEmptyViewTemplate'});

View File

@@ -1,12 +1,6 @@
'use strict';
define(
[
'Cells/TemplatedCell'
], function (TemplatedCell) {
return TemplatedCell.extend({
var TemplatedCell = require('../../Cells/TemplatedCell');
className: 'series-title-cell',
template : 'System/Backup/BackupFilenameCellTemplate'
});
});
module.exports = TemplatedCell.extend({
className : 'series-title-cell',
template : 'System/Backup/BackupFilenameCellTemplate'
});

View File

@@ -1,106 +1,80 @@
'use strict';
define(
[
'vent',
'marionette',
'backgrid',
'System/Backup/BackupCollection',
'Cells/RelativeDateCell',
'System/Backup/BackupFilenameCell',
'System/Backup/BackupTypeCell',
'System/Backup/BackupEmptyView',
'Shared/LoadingView',
'Shared/Toolbar/ToolbarLayout'
], function (vent, Marionette, Backgrid, BackupCollection, RelativeDateCell, BackupFilenameCell, BackupTypeCell, EmptyView, LoadingView, ToolbarLayout) {
return Marionette.Layout.extend({
template: 'System/Backup/BackupLayoutTemplate',
var vent = require('../../vent');
var Marionette = require('marionette');
var Backgrid = require('backgrid');
var BackupCollection = require('./BackupCollection');
var RelativeDateCell = require('../../Cells/RelativeDateCell');
var BackupFilenameCell = require('./BackupFilenameCell');
var BackupTypeCell = require('./BackupTypeCell');
var EmptyView = require('./BackupEmptyView');
var LoadingView = require('../../Shared/LoadingView');
var ToolbarLayout = require('../../Shared/Toolbar/ToolbarLayout');
regions: {
backups : '#x-backups',
toolbar : '#x-backup-toolbar'
},
columns: [
{
name : 'type',
label : '',
sortable : false,
cell : BackupTypeCell
},
{
name : 'this',
label : 'Name',
sortable : false,
cell : BackupFilenameCell
},
{
name : 'time',
label : 'Time',
sortable : false,
cell : RelativeDateCell
}
],
leftSideButtons: {
type : 'default',
storeState: false,
collapse : false,
items :
[
{
title : 'Backup',
icon : 'icon-file-text',
command : 'backup',
properties : { type: 'manual' },
successMessage: 'Database and settings were backed up successfully',
errorMessage : 'Backup Failed!'
}
]
},
initialize: function () {
this.backupCollection = new BackupCollection();
this.listenTo(this.backupCollection, 'sync', this._showBackups);
this.listenTo(vent, vent.Events.CommandComplete, this._commandComplete);
},
onRender: function () {
this._showToolbar();
this.backups.show(new LoadingView());
this.backupCollection.fetch();
},
_showBackups: function () {
if (this.backupCollection.length === 0) {
this.backups.show(new EmptyView());
}
else {
this.backups.show(new Backgrid.Grid({
columns : this.columns,
collection: this.backupCollection,
className : 'table table-hover'
}));
}
},
_showToolbar : function () {
this.toolbar.show(new ToolbarLayout({
left :
[
this.leftSideButtons
],
context: this
}));
},
_commandComplete: function (options) {
if (options.command.get('name') === 'backup') {
this.backupCollection.fetch();
}
}
});
});
module.exports = Marionette.Layout.extend({
template : 'System/Backup/BackupLayoutTemplate',
regions : {
backups : '#x-backups',
toolbar : '#x-backup-toolbar'
},
columns : [{
name : 'type',
label : '',
sortable : false,
cell : BackupTypeCell
}, {
name : 'this',
label : 'Name',
sortable : false,
cell : BackupFilenameCell
}, {
name : 'time',
label : 'Time',
sortable : false,
cell : RelativeDateCell
}],
leftSideButtons : {
type : 'default',
storeState : false,
collapse : false,
items : [{
title : 'Backup',
icon : 'icon-file-text',
command : 'backup',
properties : {type : 'manual'},
successMessage : 'Database and settings were backed up successfully',
errorMessage : 'Backup Failed!'
}]
},
initialize : function(){
this.backupCollection = new BackupCollection();
this.listenTo(this.backupCollection, 'sync', this._showBackups);
this.listenTo(vent, vent.Events.CommandComplete, this._commandComplete);
},
onRender : function(){
this._showToolbar();
this.backups.show(new LoadingView());
this.backupCollection.fetch();
},
_showBackups : function(){
if(this.backupCollection.length === 0) {
this.backups.show(new EmptyView());
}
else {
this.backups.show(new Backgrid.Grid({
columns : this.columns,
collection : this.backupCollection,
className : 'table table-hover'
}));
}
},
_showToolbar : function(){
this.toolbar.show(new ToolbarLayout({
left : [this.leftSideButtons],
context : this
}));
},
_commandComplete : function(options){
if(options.command.get('name') === 'backup') {
this.backupCollection.fetch();
}
}
});

View File

@@ -1,9 +1,3 @@
'use strict';
define(
[
'backbone'
], function (Backbone) {
return Backbone.Model.extend({
var Backbone = require('backbone');
});
});
module.exports = Backbone.Model.extend({});

View File

@@ -1,33 +1,21 @@
'use strict';
define(
[
'Cells/NzbDroneCell'
], function (NzbDroneCell) {
return NzbDroneCell.extend({
var NzbDroneCell = require('../../Cells/NzbDroneCell');
className: 'backup-type-cell',
render: function () {
this.$el.empty();
var icon = 'icon-time';
var title = 'Scheduled';
var type = this.model.get(this.column.get('name'));
if (type === 'manual') {
icon = 'icon-book';
title = 'Manual';
}
else if (type === 'update') {
icon = 'icon-retweet';
title = 'Before update';
}
this.$el.html('<i class="{0}" title="{1}"></i>'.format(icon, title));
return this;
}
});
});
module.exports = NzbDroneCell.extend({
className : 'backup-type-cell',
render : function(){
this.$el.empty();
var icon = 'icon-time';
var title = 'Scheduled';
var type = this.model.get(this.column.get('name'));
if(type === 'manual') {
icon = 'icon-book';
title = 'Manual';
}
else if(type === 'update') {
icon = 'icon-retweet';
title = 'Before update';
}
this.$el.html('<i class="{0}" title="{1}"></i>'.format(icon, title));
return this;
}
});