Auto reload when server has been updated

New: Updating will reload UI on navigation
This commit is contained in:
Mark McDowall
2014-05-11 17:44:42 -07:00
parent 99f2b07a11
commit eff7c4b7b7
10 changed files with 98 additions and 31 deletions
+24 -1
View File
@@ -28,6 +28,29 @@ define(
xhr.headers['X-Api-Key'] = window.NzbDrone.ApiKey;
}
return original.apply(this, arguments);
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 : 'NzbDrone has been updated',
hideAfter : 0,
id : 'droneUpdated'
});
vent.trigger(vent.Events.ServerUpdated);
}
});
};
});