mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-18 08:19:38 +02:00
New: NetImport Lists Grouped by Type
Co-Authored-By: ta264 <ta264@users.noreply.github.com>
This commit is contained in:
parent
d76423a305
commit
ba83c01b6c
@ -10,6 +10,7 @@ import ModalHeader from 'Components/Modal/ModalHeader';
|
||||
import ModalBody from 'Components/Modal/ModalBody';
|
||||
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||
import AddNetImportItem from './AddNetImportItem';
|
||||
import titleCase from 'Utilities/String/titleCase';
|
||||
import styles from './AddNetImportModalContent.css';
|
||||
|
||||
class AddNetImportModalContent extends Component {
|
||||
@ -22,7 +23,7 @@ class AddNetImportModalContent extends Component {
|
||||
isSchemaFetching,
|
||||
isSchemaPopulated,
|
||||
schemaError,
|
||||
netImports,
|
||||
listGroups,
|
||||
onNetImportSelect,
|
||||
onModalClose
|
||||
} = this.props;
|
||||
@ -53,22 +54,28 @@ class AddNetImportModalContent extends Component {
|
||||
<div>For more information on the individual netImports, clink on the info buttons.</div>
|
||||
</Alert>
|
||||
|
||||
<FieldSet>
|
||||
<div className={styles.netImports}>
|
||||
{
|
||||
netImports.map((netImport) => {
|
||||
return (
|
||||
<AddNetImportItem
|
||||
key={netImport.implementation}
|
||||
implementation={netImport.implementation}
|
||||
{...netImport}
|
||||
onNetImportSelect={onNetImportSelect}
|
||||
/>
|
||||
);
|
||||
})
|
||||
}
|
||||
</div>
|
||||
</FieldSet>
|
||||
{
|
||||
Object.keys(listGroups).map((key) => {
|
||||
return (
|
||||
<FieldSet legend={`${titleCase(key)} List`} key={key}>
|
||||
<div className={styles.netImports}>
|
||||
{
|
||||
listGroups[key].map((netImport) => {
|
||||
return (
|
||||
<AddNetImportItem
|
||||
key={netImport.implementation}
|
||||
implementation={netImport.implementation}
|
||||
{...netImport}
|
||||
onNetImportSelect={onNetImportSelect}
|
||||
/>
|
||||
);
|
||||
})
|
||||
}
|
||||
</div>
|
||||
</FieldSet>
|
||||
);
|
||||
})
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</ModalBody>
|
||||
@ -88,7 +95,7 @@ AddNetImportModalContent.propTypes = {
|
||||
isSchemaFetching: PropTypes.bool.isRequired,
|
||||
isSchemaPopulated: PropTypes.bool.isRequired,
|
||||
schemaError: PropTypes.object,
|
||||
netImports: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
listGroups: PropTypes.object.isRequired,
|
||||
onNetImportSelect: PropTypes.func.isRequired,
|
||||
onModalClose: PropTypes.func.isRequired
|
||||
};
|
||||
|
@ -1,3 +1,4 @@
|
||||
import _ from 'lodash';
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
@ -16,11 +17,16 @@ function createMapStateToProps() {
|
||||
schema
|
||||
} = netImports;
|
||||
|
||||
const listGroups = _.chain(schema)
|
||||
.sortBy((o) => o.listOrder)
|
||||
.groupBy('listType')
|
||||
.value();
|
||||
|
||||
return {
|
||||
isSchemaFetching,
|
||||
isSchemaPopulated,
|
||||
schemaError,
|
||||
netImports: schema
|
||||
listGroups
|
||||
};
|
||||
}
|
||||
);
|
||||
|
@ -72,6 +72,7 @@ public static void Map()
|
||||
|
||||
Mapper.Entity<NetImportDefinition>("NetImport").RegisterModel()
|
||||
.Ignore(x => x.ImplementationName)
|
||||
.Ignore(i => i.ListType)
|
||||
.Ignore(i => i.Enable);
|
||||
|
||||
Mapper.Entity<NotificationDefinition>("Notifications").RegisterModel()
|
||||
|
@ -8,6 +8,8 @@ namespace NzbDrone.Core.NetImport.CouchPotato
|
||||
public class CouchPotatoImport : HttpNetImportBase<CouchPotatoSettings>
|
||||
{
|
||||
public override string Name => "CouchPotato";
|
||||
|
||||
public override NetImportType ListType => NetImportType.Other;
|
||||
public override bool Enabled => true;
|
||||
public override bool EnableAuto => false;
|
||||
|
||||
|
@ -7,6 +7,7 @@ public interface INetImport : IProvider
|
||||
bool Enabled { get; }
|
||||
bool EnableAuto { get; }
|
||||
|
||||
NetImportType ListType { get; }
|
||||
NetImportFetchResult Fetch();
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,8 @@ public abstract class NetImportBase<TSettings> : INetImport
|
||||
protected readonly Logger _logger;
|
||||
|
||||
public abstract string Name { get; }
|
||||
|
||||
public abstract NetImportType ListType { get; }
|
||||
public abstract bool Enabled { get; }
|
||||
public abstract bool EnableAuto { get; }
|
||||
|
||||
|
@ -18,5 +18,7 @@ public NetImportDefinition()
|
||||
public int ProfileId { get; set; }
|
||||
public string RootFolderPath { get; set; }
|
||||
public override bool Enable => Enabled;
|
||||
|
||||
public NetImportType ListType { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,8 @@ protected override List<NetImportDefinition> Active()
|
||||
public override void SetProviderCharacteristics(INetImport provider, NetImportDefinition definition)
|
||||
{
|
||||
base.SetProviderCharacteristics(provider, definition);
|
||||
|
||||
definition.ListType = provider.ListType;
|
||||
}
|
||||
|
||||
public List<INetImport> Enabled()
|
||||
|
8
src/NzbDrone.Core/NetImport/NetImportType.cs
Normal file
8
src/NzbDrone.Core/NetImport/NetImportType.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace NzbDrone.Core.NetImport
|
||||
{
|
||||
public enum NetImportType
|
||||
{
|
||||
TMDB,
|
||||
Other
|
||||
}
|
||||
}
|
@ -10,6 +10,8 @@ namespace NzbDrone.Core.NetImport.RSSImport
|
||||
public class RSSImport : HttpNetImportBase<RSSImportSettings>
|
||||
{
|
||||
public override string Name => "RSSList";
|
||||
|
||||
public override NetImportType ListType => NetImportType.Other;
|
||||
public override bool Enabled => true;
|
||||
public override bool EnableAuto => false;
|
||||
|
||||
|
@ -11,6 +11,8 @@ namespace NzbDrone.Core.NetImport.Radarr
|
||||
public class RadarrLists : HttpNetImportBase<RadarrSettings>
|
||||
{
|
||||
public override string Name => "Radarr Lists";
|
||||
|
||||
public override NetImportType ListType => NetImportType.Other;
|
||||
public override bool Enabled => true;
|
||||
public override bool EnableAuto => false;
|
||||
|
||||
|
@ -8,6 +8,8 @@ namespace NzbDrone.Core.NetImport.StevenLu
|
||||
public class StevenLuImport : HttpNetImportBase<StevenLuSettings>
|
||||
{
|
||||
public override string Name => "StevenLu";
|
||||
|
||||
public override NetImportType ListType => NetImportType.Other;
|
||||
public override bool Enabled => true;
|
||||
public override bool EnableAuto => false;
|
||||
|
||||
|
@ -9,6 +9,8 @@ namespace NzbDrone.Core.NetImport.TMDb
|
||||
public class TMDbImport : HttpNetImportBase<TMDbSettings>
|
||||
{
|
||||
public override string Name => "TMDb Lists";
|
||||
|
||||
public override NetImportType ListType => NetImportType.TMDB;
|
||||
public override bool Enabled => true;
|
||||
public override bool EnableAuto => false;
|
||||
|
||||
|
@ -11,6 +11,8 @@ namespace NzbDrone.Core.NetImport.Trakt
|
||||
public class TraktImport : HttpNetImportBase<TraktSettings>
|
||||
{
|
||||
public override string Name => "Trakt List";
|
||||
|
||||
public override NetImportType ListType => NetImportType.Other;
|
||||
public override bool Enabled => true;
|
||||
public override bool EnableAuto => false;
|
||||
|
||||
|
@ -11,6 +11,8 @@ public class NetImportResource : ProviderResource
|
||||
public string RootFolderPath { get; set; }
|
||||
public int QualityProfileId { get; set; }
|
||||
public MovieStatusType MinimumAvailability { get; set; }
|
||||
public NetImportType ListType { get; set; }
|
||||
public int ListOrder { get; set; }
|
||||
}
|
||||
|
||||
public class NetImportResourceMapper : ProviderResourceMapper<NetImportResource, NetImportDefinition>
|
||||
@ -30,6 +32,8 @@ public override NetImportResource ToResource(NetImportDefinition definition)
|
||||
resource.RootFolderPath = definition.RootFolderPath;
|
||||
resource.QualityProfileId = definition.ProfileId;
|
||||
resource.MinimumAvailability = definition.MinimumAvailability;
|
||||
resource.ListType = definition.ListType;
|
||||
resource.ListOrder = (int)definition.ListType;
|
||||
|
||||
return resource;
|
||||
}
|
||||
@ -49,6 +53,7 @@ public override NetImportDefinition ToModel(NetImportResource resource)
|
||||
definition.RootFolderPath = resource.RootFolderPath;
|
||||
definition.ProfileId = resource.QualityProfileId;
|
||||
definition.MinimumAvailability = resource.MinimumAvailability;
|
||||
definition.ListType = resource.ListType;
|
||||
|
||||
return definition;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user