Binding signalr to cloned series collection

pull/4/head
Mark McDowall 11 years ago
parent f5d85b8f57
commit bc908e0440

@ -33,6 +33,7 @@ namespace NzbDrone.Common.EnvironmentInfo
serviceProvider.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME) && serviceProvider.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME) &&
serviceProvider.GetStatus(ServiceProvider.NZBDRONE_SERVICE_NAME) == ServiceControllerStatus.StartPending; serviceProvider.GetStatus(ServiceProvider.NZBDRONE_SERVICE_NAME) == ServiceControllerStatus.StartPending;
//Guarded to avoid issues when running in a non-managed process
var entry = Assembly.GetEntryAssembly(); var entry = Assembly.GetEntryAssembly();
if (entry != null) if (entry != null)

@ -17,7 +17,8 @@ define(
'Cells/SeriesStatusCell', 'Cells/SeriesStatusCell',
'Series/Index/FooterView', 'Series/Index/FooterView',
'Series/Index/FooterModel', 'Series/Index/FooterModel',
'Shared/Toolbar/ToolbarLayout' 'Shared/Toolbar/ToolbarLayout',
'Mixins/backbone.signalr.mixin'
], function (_, ], function (_,
Marionette, Marionette,
Backgrid, Backgrid,
@ -130,27 +131,23 @@ define(
initialize: function () { initialize: function () {
this.seriesCollection = SeriesCollection.clone(); this.seriesCollection = SeriesCollection.clone();
this.seriesCollection.shadowCollection.bindSignalR();
this.listenTo(SeriesCollection, 'sync', function (model, collection, options) { this.listenTo(this.seriesCollection.shadowCollection, 'sync', function (model, collection, options) {
this.seriesCollection.shadowCollection.add(model, options);
this.seriesCollection.fullCollection.resetFiltered(); this.seriesCollection.fullCollection.resetFiltered();
this._renderView(); this._renderView();
}); });
this.listenTo(SeriesCollection, 'add', function (model, collection, options) { this.listenTo(this.seriesCollection.shadowCollection, 'add', function (model, collection, options) {
this.seriesCollection.shadowCollection.add(model, options);
this.seriesCollection.fullCollection.resetFiltered(); this.seriesCollection.fullCollection.resetFiltered();
this._renderView(); this._renderView();
}); });
this.listenTo(SeriesCollection, 'remove', function (model, collection, options) { this.listenTo(this.seriesCollection.shadowCollection, 'remove', function (model, collection, options) {
this.seriesCollection.shadowCollection.remove(model, options);
this.seriesCollection.fullCollection.resetFiltered(); this.seriesCollection.fullCollection.resetFiltered();
this._renderView(); this._renderView();
}); });
this.sortingOptions = { this.sortingOptions = {
type : 'sorting', type : 'sorting',
storeState : false, storeState : false,

@ -8,8 +8,7 @@ define(
'api!series', 'api!series',
'Mixins/AsFilteredCollection', 'Mixins/AsFilteredCollection',
'Mixins/AsPersistedStateCollection', 'Mixins/AsPersistedStateCollection',
'moment', 'moment'
'Mixins/backbone.signalr.mixin'
], function (_, Backbone, PageableCollection, SeriesModel, SeriesData, AsFilteredCollection, AsPersistedStateCollection, Moment) { ], function (_, Backbone, PageableCollection, SeriesModel, SeriesData, AsFilteredCollection, AsPersistedStateCollection, Moment) {
var Collection = PageableCollection.extend({ var Collection = PageableCollection.extend({
url : window.NzbDrone.ApiRoot + '/series', url : window.NzbDrone.ApiRoot + '/series',
@ -73,5 +72,5 @@ define(
var MixedIn = AsPersistedStateCollection.call(FilteredCollection); var MixedIn = AsPersistedStateCollection.call(FilteredCollection);
var collection = new MixedIn(SeriesData, { full: true }); var collection = new MixedIn(SeriesData, { full: true });
return collection.bindSignalR(); return collection;
}); });

Loading…
Cancel
Save