mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-14 00:53:57 -07:00
Settings save when changed only
This commit is contained in:
parent
8b8ee912c0
commit
bddbc7a0cf
7 changed files with 39 additions and 34 deletions
|
@ -14,7 +14,8 @@ define(['app',
|
|||
},
|
||||
|
||||
initialize: function () {
|
||||
NzbDrone.vent.on(NzbDrone.Commands.SaveSettings, this.saveSettings, this);
|
||||
NzbDrone.vent.on(NzbDrone.Commands.SaveSettings, this._saveSettings, this);
|
||||
this.savedCount = 0;
|
||||
},
|
||||
|
||||
openSchemaModal: function () {
|
||||
|
@ -35,12 +36,25 @@ define(['app',
|
|||
});
|
||||
},
|
||||
|
||||
saveSettings: function () {
|
||||
_saveSettings: function () {
|
||||
var self = this;
|
||||
|
||||
_.each(this.collection.models, function (model, index, list) {
|
||||
model.saveIfChanged(NzbDrone.Settings.SyncNotificaiton.callback({
|
||||
errorMessage: 'Failed to save indexer: ' + model.get('name')
|
||||
errorMessage: 'Failed to save indexer: ' + model.get('name'),
|
||||
successCallback: self._saveSuccessful,
|
||||
context: self
|
||||
}));
|
||||
});
|
||||
|
||||
if (self.savedCount > 0) {
|
||||
NzbDrone.Shared.Messenger.show({message: 'Indexer settings saved'});
|
||||
}
|
||||
|
||||
this.savedCount = 0;
|
||||
},
|
||||
_saveSuccessful: function () {
|
||||
this.savedCount++;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue