mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-27 22:56:45 -04:00
Activity instead of History
New: Renamed history to activity New: Queue is default tab of activity
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'vent',
|
||||
'marionette',
|
||||
'backgrid',
|
||||
'Activity/Blacklist/BlacklistCollection',
|
||||
'Cells/SeriesTitleCell',
|
||||
'Cells/QualityCell',
|
||||
'Cells/RelativeDateCell',
|
||||
'Activity/Blacklist/BlacklistActionsCell',
|
||||
'Shared/Grid/Pager',
|
||||
'Shared/LoadingView',
|
||||
'Shared/Toolbar/ToolbarLayout'
|
||||
], function (vent,
|
||||
Marionette,
|
||||
Backgrid,
|
||||
BlacklistCollection,
|
||||
SeriesTitleCell,
|
||||
QualityCell,
|
||||
RelativeDateCell,
|
||||
BlacklistActionsCell,
|
||||
GridPager,
|
||||
LoadingView,
|
||||
ToolbarLayout) {
|
||||
return Marionette.Layout.extend({
|
||||
template: 'Activity/Blacklist/BlacklistLayoutTemplate',
|
||||
|
||||
regions: {
|
||||
blacklist : '#x-blacklist',
|
||||
toolbar : '#x-toolbar',
|
||||
pager : '#x-pager'
|
||||
},
|
||||
|
||||
columns:
|
||||
[
|
||||
{
|
||||
name : 'series',
|
||||
label : 'Series',
|
||||
cell : SeriesTitleCell
|
||||
},
|
||||
{
|
||||
name : 'sourceTitle',
|
||||
label : 'Source Title',
|
||||
cell : 'string'
|
||||
},
|
||||
{
|
||||
name : 'quality',
|
||||
label : 'Quality',
|
||||
cell : QualityCell,
|
||||
sortable : false
|
||||
},
|
||||
{
|
||||
name : 'date',
|
||||
label : 'Date',
|
||||
cell : RelativeDateCell
|
||||
},
|
||||
{
|
||||
name : 'this',
|
||||
label : '',
|
||||
cell : BlacklistActionsCell,
|
||||
sortable : false
|
||||
}
|
||||
],
|
||||
|
||||
initialize: function () {
|
||||
this.collection = new BlacklistCollection({ tableName: 'blacklist' });
|
||||
|
||||
this.listenTo(this.collection, 'sync', this._showTable);
|
||||
this.listenTo(vent, vent.Events.CommandComplete, this._commandComplete);
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
this.blacklist.show(new LoadingView());
|
||||
this._showToolbar();
|
||||
this.collection.fetch();
|
||||
},
|
||||
|
||||
_showTable: function (collection) {
|
||||
|
||||
this.blacklist.show(new Backgrid.Grid({
|
||||
columns : this.columns,
|
||||
collection: collection,
|
||||
className : 'table table-hover'
|
||||
}));
|
||||
|
||||
this.pager.show(new GridPager({
|
||||
columns : this.columns,
|
||||
collection: collection
|
||||
}));
|
||||
},
|
||||
|
||||
_showToolbar: function () {
|
||||
var leftSideButtons = {
|
||||
type : 'default',
|
||||
storeState: false,
|
||||
items :
|
||||
[
|
||||
{
|
||||
title : 'Clear Blacklist',
|
||||
icon : 'icon-trash',
|
||||
command : 'clearBlacklist'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.toolbar.show(new ToolbarLayout({
|
||||
left :
|
||||
[
|
||||
leftSideButtons
|
||||
],
|
||||
context: this
|
||||
}));
|
||||
},
|
||||
|
||||
_refreshTable: function (buttonContext) {
|
||||
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') === 'clearblacklist') {
|
||||
this._refreshTable();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user