From bc908e044062d9998f89e6edb44fd21015c39d7d Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 10 Feb 2014 12:24:59 -0800 Subject: [PATCH] Binding signalr to cloned series collection --- .../EnvironmentInfo/RuntimeInfo.cs | 1 + src/UI/Series/Index/SeriesIndexLayout.js | 15 ++++++--------- src/UI/Series/SeriesCollection.js | 5 ++--- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs b/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs index 7f8ebedf3..82369c35b 100644 --- a/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs +++ b/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs @@ -33,6 +33,7 @@ namespace NzbDrone.Common.EnvironmentInfo serviceProvider.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME) && serviceProvider.GetStatus(ServiceProvider.NZBDRONE_SERVICE_NAME) == ServiceControllerStatus.StartPending; + //Guarded to avoid issues when running in a non-managed process var entry = Assembly.GetEntryAssembly(); if (entry != null) diff --git a/src/UI/Series/Index/SeriesIndexLayout.js b/src/UI/Series/Index/SeriesIndexLayout.js index 0896d35c3..bfd37e8e7 100644 --- a/src/UI/Series/Index/SeriesIndexLayout.js +++ b/src/UI/Series/Index/SeriesIndexLayout.js @@ -17,7 +17,8 @@ define( 'Cells/SeriesStatusCell', 'Series/Index/FooterView', 'Series/Index/FooterModel', - 'Shared/Toolbar/ToolbarLayout' + 'Shared/Toolbar/ToolbarLayout', + 'Mixins/backbone.signalr.mixin' ], function (_, Marionette, Backgrid, @@ -130,27 +131,23 @@ define( initialize: function () { this.seriesCollection = SeriesCollection.clone(); + this.seriesCollection.shadowCollection.bindSignalR(); - this.listenTo(SeriesCollection, 'sync', function (model, collection, options) { - this.seriesCollection.shadowCollection.add(model, options); + this.listenTo(this.seriesCollection.shadowCollection, 'sync', function (model, collection, options) { this.seriesCollection.fullCollection.resetFiltered(); this._renderView(); }); - this.listenTo(SeriesCollection, 'add', function (model, collection, options) { - this.seriesCollection.shadowCollection.add(model, options); + this.listenTo(this.seriesCollection.shadowCollection, 'add', function (model, collection, options) { this.seriesCollection.fullCollection.resetFiltered(); this._renderView(); }); - this.listenTo(SeriesCollection, 'remove', function (model, collection, options) { - this.seriesCollection.shadowCollection.remove(model, options); + this.listenTo(this.seriesCollection.shadowCollection, 'remove', function (model, collection, options) { this.seriesCollection.fullCollection.resetFiltered(); this._renderView(); }); - - this.sortingOptions = { type : 'sorting', storeState : false, diff --git a/src/UI/Series/SeriesCollection.js b/src/UI/Series/SeriesCollection.js index bbd70e940..4f00e6c42 100644 --- a/src/UI/Series/SeriesCollection.js +++ b/src/UI/Series/SeriesCollection.js @@ -8,8 +8,7 @@ define( 'api!series', 'Mixins/AsFilteredCollection', 'Mixins/AsPersistedStateCollection', - 'moment', - 'Mixins/backbone.signalr.mixin' + 'moment' ], function (_, Backbone, PageableCollection, SeriesModel, SeriesData, AsFilteredCollection, AsPersistedStateCollection, Moment) { var Collection = PageableCollection.extend({ url : window.NzbDrone.ApiRoot + '/series', @@ -73,5 +72,5 @@ define( var MixedIn = AsPersistedStateCollection.call(FilteredCollection); var collection = new MixedIn(SeriesData, { full: true }); - return collection.bindSignalR(); + return collection; });