1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2025-01-01 12:45:03 +00:00
Sonarr/UI/Commands/CommandModel.js
2013-09-14 00:10:19 -07:00

33 lines
931 B
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;
},
isActive: function () {
return this.get('state') !== 'completed' && this.get('state') !== 'failed';
},
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;
}
});
});