1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2025-01-19 06:00:27 +00:00
Radarr/UI/Commands/CommandModel.js
Mark McDowall bd1a9db0ef refresh series details after rename/refresh
Fixed: Refresh series details after series refresh and rename
2013-09-29 01:48:47 -07:00

37 lines
1 KiB
JavaScript

'use strict';
define(
[
'backbone'
], function (Backbone) {
return Backbone.Model.extend({
url: window.NzbDrone.ApiRoot + '/command',
parse: function (response) {
response.name = response.name.toLocaleLowerCase();
return response;
},
isSameCommand: function (command) {
if (command.name.toLocaleLowerCase() !== this.get('name').toLocaleLowerCase()) {
return false;
}
for (var key in command) {
if (key !== 'name' && command[key] !== this.get(key)) {
return false;
}
}
return true;
},
isActive: function () {
return this.get('state') !== 'completed' && this.get('state') !== 'failed';
},
isComplete: function () {
return this.get('state') === 'completed';
}
});
});