mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-05 02:22:31 +01:00
Added back version check on ajaxSuccess
This commit is contained in:
parent
8f8fe99a16
commit
8d03850de7
@ -34,6 +34,7 @@ module.exports = (function(){
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
$(document).ajaxError(function(event, xmlHttpRequest, ajaxOptions){
|
||||
if(xmlHttpRequest.status >= 200 && xmlHttpRequest.status <= 300) {
|
||||
return undefined;
|
||||
|
@ -2,6 +2,7 @@ var _ = require('underscore');
|
||||
var Backbone = require('backbone');
|
||||
|
||||
module.exports = function(){
|
||||
|
||||
this.prototype.setFilter = function(filter, options){
|
||||
options = _.extend({reset : true}, options || {});
|
||||
this.state.filterKey = filter[0];
|
||||
@ -15,10 +16,13 @@ module.exports = function(){
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.prototype.setFilterMode = function(mode, options){
|
||||
return this.setFilter(this.filterModes[mode], options);
|
||||
};
|
||||
|
||||
var originalMakeFullCollection = this.prototype._makeFullCollection;
|
||||
|
||||
this.prototype._makeFullCollection = function(models, options){
|
||||
var self = this;
|
||||
self.shadowCollection = originalMakeFullCollection.call(this, models, options);
|
||||
@ -30,18 +34,23 @@ module.exports = function(){
|
||||
return model.get(self.state.filterKey) === self.state.filterValue;
|
||||
}
|
||||
};
|
||||
|
||||
self.shadowCollection.filtered = function(){
|
||||
return this.filter(filterModel);
|
||||
};
|
||||
|
||||
var filteredModels = self.shadowCollection.filtered();
|
||||
var fullCollection = originalMakeFullCollection.call(this, filteredModels, options);
|
||||
|
||||
fullCollection.resetFiltered = function(options){
|
||||
Backbone.Collection.prototype.reset.call(this, self.shadowCollection.filtered(), options);
|
||||
};
|
||||
|
||||
fullCollection.reset = function(models, options){
|
||||
self.shadowCollection.reset(models, options);
|
||||
self.fullCollection.resetFiltered();
|
||||
};
|
||||
|
||||
return fullCollection;
|
||||
};
|
||||
_.extend(this.prototype.state, {
|
||||
|
@ -1,7 +1,9 @@
|
||||
var vent = require('../vent');
|
||||
var vent = require('../vent');
|
||||
var AppLayout = require('../AppLayout');
|
||||
var Marionette = require('marionette');
|
||||
var NotFoundView = require('./NotFoundView');
|
||||
var Messenger = require('messenger');
|
||||
|
||||
|
||||
module.exports = Marionette.AppRouter.extend({
|
||||
initialize : function(){
|
||||
@ -34,6 +36,20 @@ module.exports = Marionette.AppRouter.extend({
|
||||
}
|
||||
},
|
||||
_onServerUpdated : function(){
|
||||
Messenger.show({
|
||||
message : 'Sonarr has been updated',
|
||||
hideAfter : 0,
|
||||
id : 'droneUpdated',
|
||||
actions : {
|
||||
viewChanges : {
|
||||
label : 'View Changes',
|
||||
action : function(){
|
||||
window.location = window.NzbDrone.UrlBase + '/system/updates';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.pendingUpdate = true;
|
||||
},
|
||||
showMainRegion : function(view){
|
||||
|
13
src/UI/Shared/VersionChangeMonitor.js
Normal file
13
src/UI/Shared/VersionChangeMonitor.js
Normal file
@ -0,0 +1,13 @@
|
||||
var $ = require('jquery');
|
||||
var vent = require('vent');
|
||||
|
||||
$(document).ajaxSuccess(function(event, xhr){
|
||||
var version = xhr.getResponseHeader('X-ApplicationVersion');
|
||||
if(!version || !window.NzbDrone || !window.NzbDrone.Version) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(version !== window.NzbDrone.Version) {
|
||||
vent.trigger(vent.Events.ServerUpdated);
|
||||
}
|
||||
});
|
@ -20,28 +20,5 @@ module.exports = function(){
|
||||
xhr.headers['X-Api-Key'] = window.NzbDrone.ApiKey;
|
||||
}
|
||||
return original.apply(this, arguments);
|
||||
/* .done(function (response, status, xhr) {
|
||||
var version = xhr.getResponseHeader('X-ApplicationVersion');
|
||||
if (!window.NzbDrone || !window.NzbDrone.Version) {
|
||||
return;
|
||||
}
|
||||
if (version !== window.NzbDrone.Version) {
|
||||
var vent = require('../vent');
|
||||
var messenger = require('../Shared/Messenger');
|
||||
if (!vent || !messenger) {
|
||||
return;
|
||||
}
|
||||
messenger.show({
|
||||
message : 'Sonarr has been updated', hideAfter : 0, id : 'droneUpdated', actions : {
|
||||
viewChanges : {
|
||||
label : 'View Changes', action : function () {
|
||||
window.location = window.NzbDrone.UrlBase + '/system/updates';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
vent.trigger(vent.Events.ServerUpdated);
|
||||
}
|
||||
});*/
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -17,6 +17,7 @@ require('./Instrumentation/StringFormat');
|
||||
require('./LifeCycle');
|
||||
require('./Hotkeys/Hotkeys');
|
||||
require('./Shared/piwikCheck');
|
||||
require('./Shared/VersionChangeMonitor');
|
||||
|
||||
new SeriesController();
|
||||
new ModalController();
|
||||
|
Loading…
Reference in New Issue
Block a user