1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-22 22:15:17 -04:00

New: Drone now uses the Download Client API to determine if a download is ready for import. (User configuration is required to replace the drone factory with this feature)

This commit is contained in:
Taloth Saldono
2014-04-19 17:09:22 +02:00
parent dcb586b937
commit 2035fe8578
196 changed files with 3961 additions and 2223 deletions
@@ -0,0 +1,13 @@
'use strict';
define([
'Settings/ThingyAddCollectionView',
'Settings/Notifications/Add/NotificationAddItemView'
], function (ThingyAddCollectionView, AddItemView) {
return ThingyAddCollectionView.extend({
itemView : AddItemView,
itemViewContainer: '.add-notifications .items',
template : 'Settings/Notifications/Add/NotificationAddCollectionViewTemplate'
});
});
@@ -1,37 +1,38 @@
'use strict';
define([
'jquery',
'AppLayout',
'marionette',
'Settings/Notifications/NotificationEditView'
], function (AppLayout, Marionette, EditView) {
'Settings/Notifications/Edit/NotificationEditView'
], function ($, AppLayout, Marionette, EditView) {
return Marionette.ItemView.extend({
template: 'Settings/Notifications/AddItemTemplate',
template: 'Settings/Notifications/Add/NotificationAddItemViewTemplate',
tagName : 'li',
events: {
'click': 'addNotification'
'click': '_add'
},
initialize: function (options) {
this.notificationCollection = options.notificationCollection;
this.targetCollection = options.targetCollection;
},
addNotification: function (e) {
_add: function (e) {
if (this.$(e.target).hasClass('icon-info-sign')) {
return;
}
this.model.set({
id : undefined,
name : this.model.get('implementationName'),
name : this.model.get('implementation'),
onGrab : true,
onDownload : true,
onUpgrade : true
});
var editView = new EditView({ model: this.model, notificationCollection: this.notificationCollection });
var editView = new EditView({ model: this.model, targetCollection: this.targetCollection });
AppLayout.modalRegion.show(editView);
}
});
@@ -0,0 +1,21 @@
'use strict';
define([
'AppLayout',
'Settings/Notifications/NotificationCollection',
'Settings/Notifications/Add/NotificationAddCollectionView'
], function (AppLayout, SchemaCollection, AddCollectionView) {
return ({
open: function (collection) {
var schemaCollection = new SchemaCollection();
var originalUrl = schemaCollection.url;
schemaCollection.url = schemaCollection.url + '/schema';
schemaCollection.fetch();
schemaCollection.url = originalUrl;
var view = new AddCollectionView({ collection: schemaCollection, targetCollection: collection});
AppLayout.modalRegion.show(view);
}
});
});
-23
View File
@@ -1,23 +0,0 @@
'use strict';
define([
'marionette',
'Settings/Notifications/AddItemView'
], function (Marionette, AddItemView) {
return Marionette.CompositeView.extend({
itemView : AddItemView,
itemViewContainer: '.add-notifications .items',
template : 'Settings/Notifications/AddTemplate',
itemViewOptions: function () {
return {
notificationCollection: this.notificationCollection
};
},
initialize: function (options) {
this.notificationCollection = options.notificationCollection;
}
});
});
@@ -1,11 +0,0 @@
'use strict';
define(
[
'backbone',
'Settings/Notifications/Model'
], function (Backbone, NotificationModel) {
return Backbone.Collection.extend({
url : window.NzbDrone.ApiRoot + '/notification',
model: NotificationModel
});
});
@@ -1,13 +0,0 @@
<div class="row">
<div class="col-md-12">
<ul class="notifications thingies">
<li>
<div class="notification-item thingy add-card x-add-card">
<span class="center well">
<i class="icon-plus" title="Add Connection"/>
</span>
</div>
</li>
</ul>
</div>
</div>
@@ -1,28 +0,0 @@
'use strict';
define([
'marionette',
'Settings/Notifications/NotificationsItemView',
'Settings/Notifications/SchemaModal'
], function (Marionette, NotificationItemView, SchemaModal) {
return Marionette.CompositeView.extend({
itemView : NotificationItemView,
itemViewContainer: '.notifications',
template : 'Settings/Notifications/CollectionTemplate',
ui: {
'addCard': '.x-add-card'
},
events: {
'click .x-add-card': '_openSchemaModal'
},
appendHtml: function(collectionView, itemView, index){
collectionView.ui.addCard.parent('li').before(itemView.el);
},
_openSchemaModal: function () {
SchemaModal.open(this.collection);
}
});
});
@@ -0,0 +1,23 @@
'use strict';
define([
'vent',
'marionette'
], function (vent, Marionette) {
return Marionette.ItemView.extend({
template: 'Settings/Notifications/Delete/NotificationDeleteViewTemplate',
events: {
'click .x-confirm-delete': '_delete'
},
_delete: function () {
this.model.destroy({
wait : true,
success: function () {
vent.trigger(vent.Commands.CloseModalCommand);
}
});
}
});
});
@@ -1,23 +0,0 @@
'use strict';
define(
[
'vent',
'marionette'
], function (vent, Marionette) {
return Marionette.ItemView.extend({
template: 'Settings/Notifications/DeleteTemplate',
events: {
'click .x-confirm-delete': '_removeNotification'
},
_removeNotification: function () {
this.model.destroy({
wait : true,
success: function () {
vent.trigger(vent.Commands.CloseModalCommand);
}
});
}
});
});
@@ -0,0 +1,113 @@
'use strict';
define([
'vent',
'AppLayout',
'marionette',
'Settings/Notifications/Delete/NotificationDeleteView',
'Commands/CommandController',
'Mixins/AsModelBoundView',
'Mixins/AsValidatedView',
'underscore',
'Form/FormBuilder'
], function (vent, AppLayout, Marionette, DeleteView, CommandController, AsModelBoundView, AsValidatedView, _) {
var view = Marionette.ItemView.extend({
template: 'Settings/Notifications/Edit/NotificationEditViewTemplate',
ui: {
onDownloadToggle: '.x-on-download',
onUpgradeSection: '.x-on-upgrade'
},
events: {
'click .x-save' : '_save',
'click .x-save-and-add': '_saveAndAdd',
'click .x-delete' : '_delete',
'click .x-back' : '_back',
'click .x-cancel' : '_cancel',
'click .x-test' : '_test',
'change .x-on-download': '_onDownloadChanged'
},
initialize: function (options) {
this.targetCollection = options.targetCollection;
},
onRender: function () {
this._onDownloadChanged();
},
_save: function () {
var self = this;
var promise = this.model.save();
if (promise) {
promise.done(function () {
self.targetCollection.add(self.model, { merge: true });
vent.trigger(vent.Commands.CloseModalCommand);
});
}
},
_saveAndAdd: function () {
var self = this;
var promise = this.model.save();
if (promise) {
promise.done(function () {
self.targetCollection.add(self.model, { merge: true });
require('Settings/Notifications/Add/NotificationSchemaModal').open(self.targetCollection);
});
}
},
_delete: function () {
var view = new DeleteView({ model: this.model });
AppLayout.modalRegion.show(view);
},
_back: function () {
if (this.model.isNew()) {
this.model.destroy();
}
require('Settings/Notifications/Add/NotificationSchemaModal').open(this.targetCollection);
},
_cancel: function () {
if (this.model.isNew()) {
this.model.destroy();
}
},
_test: function () {
var testCommand = 'test{0}'.format(this.model.get('implementation'));
var properties = {};
_.each(this.model.get('fields'), function (field) {
properties[field.name] = field.value;
});
CommandController.Execute(testCommand, properties);
},
_onDownloadChanged: function () {
var checked = this.ui.onDownloadToggle.prop('checked');
if (checked) {
this.ui.onUpgradeSection.show();
}
else {
this.ui.onUpgradeSection.hide();
}
}
});
AsModelBoundView.call(view);
AsValidatedView.call(view);
return view;
});
@@ -1,14 +1,14 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close x-cancel" aria-hidden="true">&times;</button>
<button type="button" class="close x-cancel" data-dismiss="modal" aria-hidden="true">&times;</button>
{{#if id}}
<h3>Edit - {{implementation}}</h3>
{{else}}
<h3>Add - {{implementation}}</h3>
{{/if}}
</div>
<div class="modal-body">
<div class="modal-body notification-modal">
<div class="form-horizontal">
<div class="form-group">
<label class="col-sm-3 control-label">Name</label>
@@ -95,7 +95,7 @@
{{/if}}
<button class="btn x-test">test <i class="x-test-icon icon-nd-test"/></button>
<button class="btn x-cancel">cancel</button>
<button class="btn x-cancel" data-dismiss="modal">cancel</button>
<div class="btn-group">
<button class="btn btn-primary x-save">save</button>
@@ -0,0 +1,13 @@
'use strict';
define([
'backbone',
'Settings/Notifications/NotificationModel'
], function (Backbone, NotificationModel) {
return Backbone.Collection.extend({
model: NotificationModel,
url : window.NzbDrone.ApiRoot + '/notification'
});
});
@@ -0,0 +1,29 @@
'use strict';
define([
'marionette',
'Settings/Notifications/NotificationItemView',
'Settings/Notifications/Add/NotificationSchemaModal'
], function (Marionette, ItemView, SchemaModal) {
return Marionette.CompositeView.extend({
itemView : ItemView,
itemViewContainer: '.notification-list',
template : 'Settings/Notifications/NotificationCollectionViewTemplate',
ui: {
'addCard': '.x-add-card'
},
events: {
'click .x-add-card': '_openSchemaModal'
},
appendHtml: function (collectionView, itemView, index) {
collectionView.ui.addCard.parent('li').before(itemView.el);
},
_openSchemaModal: function () {
SchemaModal.open(this.collection);
}
});
});
@@ -0,0 +1,16 @@
<fieldset>
<legend>Connections</legend>
<div class="row">
<div class="col-md-12">
<ul class="notification-list thingies">
<li>
<div class="notification-item thingy add-card x-add-card">
<span class="center well">
<i class="icon-plus" title="Add Connection"/>
</span>
</div>
</li>
</ul>
</div>
</div>
</fieldset>
@@ -1,113 +0,0 @@
'use strict';
define(
[
'vent',
'AppLayout',
'marionette',
'Settings/Notifications/DeleteView',
'Commands/CommandController',
'Mixins/AsModelBoundView',
'underscore',
'Form/FormBuilder'
], function (vent, AppLayout, Marionette, DeleteView, CommandController, AsModelBoundView, _) {
var model = Marionette.ItemView.extend({
template: 'Settings/Notifications/NotificationEditViewTemplate',
ui: {
onDownloadToggle: '.x-on-download',
onUpgradeSection: '.x-on-upgrade'
},
events: {
'click .x-save' : '_saveClient',
'click .x-save-and-add': '_saveAndAddNotification',
'click .x-delete' : '_deleteNotification',
'click .x-back' : '_back',
'click .x-test' : '_test',
'click .x-cancel' : '_cancel',
'change .x-on-download': '_onDownloadChanged'
},
initialize: function (options) {
this.notificationCollection = options.notificationCollection;
},
onRender: function () {
this._onDownloadChanged();
},
_saveClient: function () {
var self = this;
var promise = this.model.saveSettings();
if (promise) {
promise.done(function () {
self.notificationCollection.add(self.model, { merge: true });
vent.trigger(vent.Commands.CloseModalCommand);
});
}
},
_saveAndAddNotification: function () {
var self = this;
var promise = this.model.saveSettings();
if (promise) {
promise.done(function () {
self.notificationCollection.add(self.model, { merge: true });
require('Settings/Notifications/SchemaModal').open(self.notificationCollection);
});
}
},
_cancel: function () {
if (this.model.isNew()) {
this.model.destroy();
}
vent.trigger(vent.Commands.CloseModalCommand);
},
_deleteNotification: function () {
var view = new DeleteView({ model: this.model });
AppLayout.modalRegion.show(view);
},
_back: function () {
if (this.model.isNew()) {
this.model.destroy();
}
require('Settings/Notifications/SchemaModal').open(this.notificationCollection);
},
_test: function () {
var testCommand = 'test{0}'.format(this.model.get('implementation'));
var properties = {};
_.each(this.model.get('fields'), function (field) {
properties[field.name] = field.value;
});
CommandController.Execute(testCommand, properties);
},
_onDownloadChanged: function () {
var checked = this.ui.onDownloadToggle.prop('checked');
if (checked) {
this.ui.onUpgradeSection.show();
}
else {
this.ui.onUpgradeSection.hide();
}
}
});
return AsModelBoundView.call(model);
});
@@ -3,8 +3,7 @@
define([
'AppLayout',
'marionette',
'Settings/Notifications/NotificationEditView'
'Settings/Notifications/Edit/NotificationEditView'
], function (AppLayout, Marionette, EditView) {
return Marionette.ItemView.extend({
@@ -12,15 +11,15 @@ define([
tagName : 'li',
events: {
'click' : '_editNotification'
'click' : '_edit'
},
initialize: function () {
this.listenTo(this.model, 'sync', this.render);
},
_editNotification: function () {
var view = new EditView({ model: this.model, notificationCollection: this.model.collection});
_edit: function () {
var view = new EditView({ model: this.model, targetCollection: this.model.collection});
AppLayout.modalRegion.show(view);
}
});
@@ -1,6 +1,7 @@
'use strict';
define([
'Settings/SettingsModelBase'], function (ModelBase) {
'Settings/SettingsModelBase'
], function (ModelBase) {
return ModelBase.extend({
successMessage: 'Notification Saved',
@@ -1,20 +0,0 @@
'use strict';
define([
'AppLayout',
'Settings/Notifications/Collection',
'Settings/Notifications/AddView'
], function (AppLayout, NotificationCollection, AddSelectionNotificationView) {
return ({
open: function (collection) {
var schemaCollection = new NotificationCollection();
var orginalUrl = schemaCollection.url;
schemaCollection.url = schemaCollection.url + '/schema';
schemaCollection.fetch();
schemaCollection.url = orginalUrl;
var view = new AddSelectionNotificationView({ collection: schemaCollection, notificationCollection: collection});
AppLayout.modalRegion.show(view);
}
});
});