Sonarr/src/UI/Activity/Queue/QueueLayout.js

98 lines
2.7 KiB
JavaScript
Raw Normal View History

2015-02-13 21:03:50 +00:00
var Marionette = require('marionette');
var Backgrid = require('backgrid');
var QueueCollection = require('./QueueCollection');
var SeriesTitleCell = require('../../Cells/SeriesTitleCell');
var EpisodeNumberCell = require('../../Cells/EpisodeNumberCell');
var EpisodeTitleCell = require('../../Cells/EpisodeTitleCell');
var QualityCell = require('../../Cells/QualityCell');
var QueueStatusCell = require('./QueueStatusCell');
var QueueActionsCell = require('./QueueActionsCell');
var TimeleftCell = require('./TimeleftCell');
var ProgressCell = require('./ProgressCell');
var ProtocolCell = require('../../Release/ProtocolCell');
var GridPager = require('../../Shared/Grid/Pager');
2015-02-13 21:03:50 +00:00
module.exports = Marionette.Layout.extend({
template : 'Activity/Queue/QueueLayoutTemplate',
2015-02-13 21:03:50 +00:00
regions : {
table : '#x-queue',
pager : '#x-queue-pager'
},
2015-02-13 21:03:50 +00:00
columns : [
{
name : 'status',
label : '',
cell : QueueStatusCell,
cellValue : 'this'
},
{
name : 'series',
label : 'Series',
cell : SeriesTitleCell
2015-02-13 21:03:50 +00:00
},
{
name : 'episode',
label : 'Episode',
cell : EpisodeNumberCell
2015-02-13 21:03:50 +00:00
},
{
name : 'episodeTitle',
label : 'Episode Title',
cell : EpisodeTitleCell,
cellValue : 'episode'
2015-02-13 21:03:50 +00:00
},
{
name : 'quality',
label : 'Quality',
cell : QualityCell,
sortable : false
},
{
name : 'protocol',
label : 'Protocol',
cell : ProtocolCell
},
{
name : 'timeleft',
label : 'Time Left',
2015-02-13 21:03:50 +00:00
cell : TimeleftCell,
cellValue : 'this'
},
{
name : 'sizeleft',
2015-02-13 21:03:50 +00:00
label : 'Progress',
cell : ProgressCell,
cellValue : 'this'
},
{
name : 'status',
label : '',
cell : QueueActionsCell,
cellValue : 'this'
}
],
2015-02-13 21:03:50 +00:00
initialize : function() {
this.listenTo(QueueCollection, 'sync', this._showTable);
},
2015-02-13 21:03:50 +00:00
onShow : function() {
this._showTable();
},
2014-02-23 22:45:37 +00:00
2015-02-13 21:03:50 +00:00
_showTable : function() {
this.table.show(new Backgrid.Grid({
columns : this.columns,
collection : QueueCollection,
className : 'table table-hover'
}));
this.pager.show(new GridPager({
columns : this.columns,
collection : QueueCollection
}));
}
});