1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

Show warning message for rTorrent that it doesn't support torrent removal

This commit is contained in:
Mark McDowall 2015-06-28 14:06:03 -07:00
parent 873fadbcaa
commit 14b9a031bb
14 changed files with 88 additions and 2 deletions

View File

@ -1,6 +1,7 @@
using System.Collections.Generic;
using NzbDrone.Api.ClientSchema;
using NzbDrone.Api.REST;
using NzbDrone.Core.ThingiProvider;
namespace NzbDrone.Api
{
@ -12,6 +13,7 @@ public class ProviderResource : RestResource
public string Implementation { get; set; }
public string ConfigContract { get; set; }
public string InfoLink { get; set; }
public ProviderMessage Message { get; set; }
public List<ProviderResource> Presets { get; set; }
}

View File

@ -10,9 +10,9 @@
using NLog;
using NzbDrone.Core.Validation;
using FluentValidation.Results;
using System.Net;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.RemotePathMappings;
using NzbDrone.Core.ThingiProvider;
namespace NzbDrone.Core.Download.Clients.RTorrent
{
@ -92,6 +92,14 @@ public override string Name
}
}
public override ProviderMessage Message
{
get
{
return new ProviderMessage("Sonarr is unable to remove torrents that have finished seeding when using rTorrent", ProviderMessageType.Warning);
}
}
public override IEnumerable<DownloadClientItem> GetItems()
{
try

View File

@ -32,6 +32,14 @@ public Type ConfigContract
}
}
public virtual ProviderMessage Message
{
get
{
return null;
}
}
public IEnumerable<ProviderDefinition> DefaultDefinitions
{
get

View File

@ -37,6 +37,14 @@ public Type ConfigContract
get { return typeof(TSettings); }
}
public virtual ProviderMessage Message
{
get
{
return null;
}
}
public virtual IEnumerable<ProviderDefinition> DefaultDefinitions
{
get

View File

@ -20,6 +20,14 @@ public Type ConfigContract
}
}
public virtual ProviderMessage Message
{
get
{
return null;
}
}
public IEnumerable<ProviderDefinition> DefaultDefinitions
{
get

View File

@ -18,6 +18,14 @@ public Type ConfigContract
}
}
public virtual ProviderMessage Message
{
get
{
return null;
}
}
public IEnumerable<ProviderDefinition> DefaultDefinitions
{
get

View File

@ -887,6 +887,7 @@
<Compile Include="ThingiProvider\NullConfig.cs" />
<Compile Include="ThingiProvider\ProviderDefinition.cs" />
<Compile Include="ThingiProvider\ProviderFactory.cs" />
<Compile Include="ThingiProvider\ProviderMessage.cs" />
<Compile Include="ThingiProvider\ProviderRepository.cs" />
<Compile Include="Tv\Actor.cs" />
<Compile Include="Tv\AddSeriesOptions.cs" />

View File

@ -8,7 +8,7 @@ public interface IProvider
{
string Name { get; }
Type ConfigContract { get; }
ProviderMessage Message { get; }
IEnumerable<ProviderDefinition> DefaultDefinitions { get; }
ProviderDefinition Definition { get; set; }
ValidationResult Test();

View File

@ -11,6 +11,7 @@ public abstract class ProviderDefinition : ModelBase
public string Implementation { get; set; }
public string ConfigContract { get; set; }
public virtual bool Enable { get; set; }
public ProviderMessage Message { get; set; }
public IProviderConfig Settings
{

View File

@ -141,6 +141,7 @@ protected virtual List<TProviderDefinition> Active()
public virtual TProviderDefinition GetProviderCharacteristics(TProvider provider, TProviderDefinition definition)
{
definition.ImplementationName = provider.Name;
definition.Message = provider.Message;
return definition;
}

View File

@ -0,0 +1,21 @@
namespace NzbDrone.Core.ThingiProvider
{
public class ProviderMessage
{
public string Message { get; set; }
public ProviderMessageType Type { get; set; }
public ProviderMessage(string message, ProviderMessageType type)
{
Message = message;
Type = type;
}
}
public enum ProviderMessageType
{
Info,
Warning,
Error
}
}

View File

@ -1,6 +1,7 @@
var Marionette = require('marionette');
var Handlebars = require('handlebars');
var _ = require('underscore');
require('./FormMessage');
var _templateRenderer = function(templateName) {
var templateFunction = Marionette.TemplateCache.get(templateName);

View File

@ -0,0 +1,17 @@
var Handlebars = require('handlebars');
Handlebars.registerHelper('formMessage', function(message) {
if (!message) {
return '';
}
var level = message.type;
if (message.type === 'error') {
level = 'danger';
}
var messageHtml = '<div class="alert alert-{0}" role="alert">{1}</div>'.format(level, message.message);
return new Handlebars.SafeString(messageHtml);
});

View File

@ -8,6 +8,8 @@
{{/if}}
</div>
<div class="modal-body download-client-modal">
{{formMessage message}}
<div class="form-horizontal">
<div class="form-group">
<label class="col-sm-3 control-label">Name</label>