Fixed up per comments

pull/24/head
Mark McDowall 12 years ago
parent c0d77fcca2
commit 8b8ee912c0

@ -34,7 +34,7 @@ namespace NzbDrone.Api.Notifications
var notificationResource = new NotificationResource(); var notificationResource = new NotificationResource();
notificationResource.InjectFrom(notification); notificationResource.InjectFrom(notification);
notificationResource.Fields = SchemaBuilder.GenerateSchema(notification.Settings); notificationResource.Fields = SchemaBuilder.GenerateSchema(notification.Settings);
notificationResource.Command = String.Format("test{0}", notification.Implementation.ToLowerInvariant()); notificationResource.TestCommand = String.Format("test{0}", notification.Implementation.ToLowerInvariant());
result.Add(notificationResource); result.Add(notificationResource);
} }

@ -13,6 +13,6 @@ namespace NzbDrone.Api.Notifications
public Boolean OnDownload { get; set; } public Boolean OnDownload { get; set; }
public List<Field> Fields { get; set; } public List<Field> Fields { get; set; }
public String Implementation { get; set; } public String Implementation { get; set; }
public String Command { get; set; } public String TestCommand { get; set; }
} }
} }

@ -31,7 +31,7 @@ namespace NzbDrone.Api.Notifications
var notificationResource = new NotificationResource(); var notificationResource = new NotificationResource();
notificationResource.InjectFrom(notification); notificationResource.InjectFrom(notification);
notificationResource.Fields = SchemaBuilder.GenerateSchema(notification.Settings); notificationResource.Fields = SchemaBuilder.GenerateSchema(notification.Settings);
notificationResource.Command = String.Format("test{0}", notification.Implementation.ToLowerInvariant()); notificationResource.TestCommand = String.Format("test{0}", notification.Implementation.ToLowerInvariant());
result.Add(notificationResource); result.Add(notificationResource);
} }

@ -4,7 +4,7 @@ define(['app'], function () {
NzbDrone.Commands.Execute = function (name, properties) { NzbDrone.Commands.Execute = function (name, properties) {
var data = { command: name }; var data = { command: name };
if (properties !== undefined) { if (!properties) {
$.extend(data, properties); $.extend(data, properties);
} }

@ -49,8 +49,8 @@ define([
}, },
_test: function () { _test: function () {
var command = this.model.get('command'); var testCommand = this.model.get('testCommand');
if (command) { if (testCommand) {
this.idle = false; this.idle = false;
this.ui.testButton.addClass('disabled'); this.ui.testButton.addClass('disabled');
this.ui.testIcon.removeClass('icon-question'); this.ui.testIcon.removeClass('icon-question');
@ -58,12 +58,12 @@ define([
var properties = {}; var properties = {};
_.each(this.model.attributes.fields, function (field) { _.each(this.model.get('fields'), function (field) {
properties[field.name] = field.value; properties[field.name] = field.value;
}); });
var self = this; var self = this;
var commandPromise = NzbDrone.Commands.Execute(command, properties); var commandPromise = NzbDrone.Commands.Execute(testCommand, properties);
commandPromise.done(function () { commandPromise.done(function () {
NzbDrone.Shared.Messenger.show({ NzbDrone.Shared.Messenger.show({
message: 'Notification settings tested successfully' message: 'Notification settings tested successfully'

Loading…
Cancel
Save