|
|
|
@ -12,6 +12,7 @@ define(
|
|
|
|
|
'Cells/RelativeDateCell',
|
|
|
|
|
'History/Table/HistoryDetailsCell',
|
|
|
|
|
'Shared/Grid/Pager',
|
|
|
|
|
'Shared/Toolbar/ToolbarLayout',
|
|
|
|
|
'Shared/LoadingView'
|
|
|
|
|
], function (Marionette,
|
|
|
|
|
Backgrid,
|
|
|
|
@ -24,14 +25,15 @@ define(
|
|
|
|
|
RelativeDateCell,
|
|
|
|
|
HistoryDetailsCell,
|
|
|
|
|
GridPager,
|
|
|
|
|
ToolbarLayout,
|
|
|
|
|
LoadingView) {
|
|
|
|
|
return Marionette.Layout.extend({
|
|
|
|
|
template: 'History/Table/HistoryTableLayoutTemplate',
|
|
|
|
|
|
|
|
|
|
regions: {
|
|
|
|
|
history: '#x-history',
|
|
|
|
|
toolbar: '#x-toolbar',
|
|
|
|
|
pager : '#x-pager'
|
|
|
|
|
toolbar: '#x-history-toolbar',
|
|
|
|
|
pager : '#x-history-pager'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
columns:
|
|
|
|
@ -84,6 +86,11 @@ define(
|
|
|
|
|
this.listenTo(this.collection, 'sync', this._showTable);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onShow: function () {
|
|
|
|
|
this.history.show(new LoadingView());
|
|
|
|
|
this.collection.fetch();
|
|
|
|
|
this._showToolbar();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_showTable: function (collection) {
|
|
|
|
|
|
|
|
|
@ -99,9 +106,62 @@ define(
|
|
|
|
|
}));
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onShow: function () {
|
|
|
|
|
this.history.show(new LoadingView());
|
|
|
|
|
this.collection.fetch();
|
|
|
|
|
_showToolbar: function () {
|
|
|
|
|
var filterOptions = {
|
|
|
|
|
type : 'radio',
|
|
|
|
|
storeState : false,
|
|
|
|
|
menuKey : 'history.filterMode',
|
|
|
|
|
defaultAction : 'all',
|
|
|
|
|
items :
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
key : 'all',
|
|
|
|
|
title : '',
|
|
|
|
|
tooltip : 'All',
|
|
|
|
|
icon : 'icon-circle-blank',
|
|
|
|
|
callback : this._setFilter
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key : 'grabbed',
|
|
|
|
|
title : '',
|
|
|
|
|
tooltip : 'Grabbed',
|
|
|
|
|
icon : 'icon-nd-downloading',
|
|
|
|
|
callback : this._setFilter
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key : 'imported',
|
|
|
|
|
title : '',
|
|
|
|
|
tooltip : 'Imported',
|
|
|
|
|
icon : 'icon-nd-imported',
|
|
|
|
|
callback : this._setFilter
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key : 'failed',
|
|
|
|
|
title : '',
|
|
|
|
|
tooltip : 'Failed',
|
|
|
|
|
icon : 'icon-nd-download-failed',
|
|
|
|
|
callback : this._setFilter
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.toolbar.show(new ToolbarLayout({
|
|
|
|
|
right :
|
|
|
|
|
[
|
|
|
|
|
filterOptions
|
|
|
|
|
],
|
|
|
|
|
context: this
|
|
|
|
|
}));
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_setFilter: function(buttonContext) {
|
|
|
|
|
var mode = buttonContext.model.get('key');
|
|
|
|
|
|
|
|
|
|
this.collection.state.currentPage = 1;
|
|
|
|
|
var promise = this.collection.setFilterMode(mode);
|
|
|
|
|
|
|
|
|
|
if (buttonContext)
|
|
|
|
|
buttonContext.ui.icon.spinForPromise(promise);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|