New: Set default names for providers in Add Modals

This commit is contained in:
Bogdan
2023-07-27 02:58:07 +03:00
parent b3a541c9ff
commit 3b5f151252
9 changed files with 21 additions and 33 deletions

View File

@@ -40,6 +40,10 @@ interface Indexer extends ModelBase {
added: Date; added: Date;
enable: boolean; enable: boolean;
redirect: boolean; redirect: boolean;
supportsRss: boolean;
supportsSearch: boolean;
supportsRedirect: boolean;
supportsPagination: boolean;
protocol: string; protocol: string;
privacy: string; privacy: string;
priority: number; priority: number;
@@ -49,6 +53,7 @@ interface Indexer extends ModelBase {
status: IndexerStatus; status: IndexerStatus;
capabilities: IndexerCapabilities; capabilities: IndexerCapabilities;
indexerUrls: string[]; indexerUrls: string[];
legacyUrls: string[];
} }
export default Indexer; export default Indexer;

View File

@@ -117,10 +117,7 @@ export default {
[SELECT_APPLICATION_SCHEMA]: (state, { payload }) => { [SELECT_APPLICATION_SCHEMA]: (state, { payload }) => {
return selectProviderSchema(state, section, payload, (selectedSchema) => { return selectProviderSchema(state, section, payload, (selectedSchema) => {
selectedSchema.onGrab = selectedSchema.supportsOnGrab; selectedSchema.name = selectedSchema.implementationName;
selectedSchema.onDownload = selectedSchema.supportsOnDownload;
selectedSchema.onUpgrade = selectedSchema.supportsOnUpgrade;
selectedSchema.onRename = selectedSchema.supportsOnRename;
return selectedSchema; return selectedSchema;
}); });

View File

@@ -142,6 +142,7 @@ export default {
[SELECT_DOWNLOAD_CLIENT_SCHEMA]: (state, { payload }) => { [SELECT_DOWNLOAD_CLIENT_SCHEMA]: (state, { payload }) => {
return selectProviderSchema(state, section, payload, (selectedSchema) => { return selectProviderSchema(state, section, payload, (selectedSchema) => {
selectedSchema.name = selectedSchema.implementationName;
selectedSchema.enable = true; selectedSchema.enable = true;
return selectedSchema; return selectedSchema;

View File

@@ -104,6 +104,8 @@ export default {
[SELECT_INDEXER_PROXY_SCHEMA]: (state, { payload }) => { [SELECT_INDEXER_PROXY_SCHEMA]: (state, { payload }) => {
return selectProviderSchema(state, section, payload, (selectedSchema) => { return selectProviderSchema(state, section, payload, (selectedSchema) => {
selectedSchema.name = selectedSchema.implementationName;
return selectedSchema; return selectedSchema;
}); });
} }

View File

@@ -104,6 +104,7 @@ export default {
[SELECT_NOTIFICATION_SCHEMA]: (state, { payload }) => { [SELECT_NOTIFICATION_SCHEMA]: (state, { payload }) => {
return selectProviderSchema(state, section, payload, (selectedSchema) => { return selectProviderSchema(state, section, payload, (selectedSchema) => {
selectedSchema.name = selectedSchema.implementationName;
selectedSchema.onGrab = selectedSchema.supportsOnGrab; selectedSchema.onGrab = selectedSchema.supportsOnGrab;
selectedSchema.onApplicationUpdate = selectedSchema.supportsOnApplicationUpdate; selectedSchema.onApplicationUpdate = selectedSchema.supportsOnApplicationUpdate;

View File

@@ -13,6 +13,15 @@ export interface Field {
interface Notification extends ModelBase { interface Notification extends ModelBase {
enable: boolean; enable: boolean;
name: string; name: string;
onGrab: boolean;
onHealthIssue: boolean;
onHealthRestored: boolean;
includeHealthWarnings: boolean;
onApplicationUpdate: boolean;
supportsOnGrab: boolean;
supportsOnHealthIssue: boolean;
supportsOnHealthRestored: boolean;
supportsOnApplicationUpdate: boolean;
fields: Field[]; fields: Field[];
implementationName: string; implementationName: string;
implementation: string; implementation: string;

View File

@@ -46,7 +46,6 @@ namespace NzbDrone.Core.Applications
yield return new ApplicationDefinition yield return new ApplicationDefinition
{ {
Name = GetType().Name,
SyncLevel = ApplicationSyncLevel.FullSync, SyncLevel = ApplicationSyncLevel.FullSync,
Implementation = GetType().Name, Implementation = GetType().Name,
Settings = config Settings = config

View File

@@ -27,20 +27,7 @@ namespace NzbDrone.Core.Download
public virtual ProviderMessage Message => null; public virtual ProviderMessage Message => null;
public IEnumerable<ProviderDefinition> DefaultDefinitions public IEnumerable<ProviderDefinition> DefaultDefinitions => new List<ProviderDefinition>();
{
get
{
var config = (IProviderConfig)new TSettings();
yield return new DownloadClientDefinition
{
Name = GetType().Name,
Implementation = GetType().Name,
Settings = config
};
}
}
public ProviderDefinition Definition { get; set; } public ProviderDefinition Definition { get; set; }

View File

@@ -14,20 +14,7 @@ namespace NzbDrone.Core.IndexerProxies
public Type ConfigContract => typeof(TSettings); public Type ConfigContract => typeof(TSettings);
public IEnumerable<ProviderDefinition> DefaultDefinitions public IEnumerable<ProviderDefinition> DefaultDefinitions => new List<ProviderDefinition>();
{
get
{
var config = (IProviderConfig)new TSettings();
yield return new IndexerProxyDefinition
{
Name = GetType().Name,
Implementation = GetType().Name,
Settings = config
};
}
}
public ProviderDefinition Definition { get; set; } public ProviderDefinition Definition { get; set; }
public abstract ValidationResult Test(); public abstract ValidationResult Test();