UI Cleanup - Updated System, Tags and Wanted subtrees.

This commit is contained in:
Taloth Saldono
2015-02-14 11:18:21 +01:00
parent d6079a701c
commit 32fc68b9df
46 changed files with 1008 additions and 643 deletions
+3 -1
View File
@@ -4,10 +4,12 @@ var BackupModel = require('./BackupModel');
module.exports = PageableCollection.extend({
url : window.NzbDrone.ApiRoot + '/system/backup',
model : BackupModel,
state : {
sortKey : 'time',
order : 1,
pageSize : 100000
},
mode : 'client'
mode : 'client'
});
+3 -1
View File
@@ -1,3 +1,5 @@
var Marionette = require('marionette');
module.exports = Marionette.ItemView.extend({template : 'System/Backup/BackupEmptyViewTemplate'});
module.exports = Marionette.ItemView.extend({
template : 'System/Backup/BackupEmptyViewTemplate'
});
+50 -36
View File
@@ -10,55 +10,68 @@ var LoadingView = require('../../Shared/LoadingView');
var ToolbarLayout = require('../../Shared/Toolbar/ToolbarLayout');
module.exports = Marionette.Layout.extend({
template : 'System/Backup/BackupLayoutTemplate',
regions : {
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 : {
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!'
}]
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(){
initialize : function() {
this.backupCollection = new BackupCollection();
this.listenTo(this.backupCollection, 'sync', this._showBackups);
this.listenTo(vent, vent.Events.CommandComplete, this._commandComplete);
},
onRender : function(){
onRender : function() {
this._showToolbar();
this.backups.show(new LoadingView());
this.backupCollection.fetch();
},
_showBackups : function(){
if(this.backupCollection.length === 0) {
_showBackups : function() {
if (this.backupCollection.length === 0) {
this.backups.show(new EmptyView());
}
else {
} else {
this.backups.show(new Backgrid.Grid({
columns : this.columns,
collection : this.backupCollection,
@@ -66,14 +79,15 @@ module.exports = Marionette.Layout.extend({
}));
}
},
_showToolbar : function(){
_showToolbar : function() {
this.toolbar.show(new ToolbarLayout({
left : [this.leftSideButtons],
context : this
}));
},
_commandComplete : function(options){
if(options.command.get('name') === 'backup') {
_commandComplete : function(options) {
if (options.command.get('name') === 'backup') {
this.backupCollection.fetch();
}
}
+9 -4
View File
@@ -2,20 +2,25 @@ var NzbDroneCell = require('../../Cells/NzbDroneCell');
module.exports = NzbDroneCell.extend({
className : 'backup-type-cell',
render : function(){
render : function() {
this.$el.empty();
var icon = 'icon-time';
var title = 'Scheduled';
var type = this.model.get(this.column.get('name'));
if(type === 'manual') {
if (type === 'manual') {
icon = 'icon-book';
title = 'Manual';
}
else if(type === 'update') {
} else if (type === 'update') {
icon = 'icon-retweet';
title = 'Before update';
}
this.$el.html('<i class="{0}" title="{1}"></i>'.format(icon, title));
return this;
}
});