mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-18 00:09:37 +02:00
Fixed: List Tags and Prevent Delete of Tag if on List
This commit is contained in:
parent
816905a506
commit
c08ae534c5
@ -42,6 +42,7 @@ function EditNetImportModalContent(props) {
|
||||
shouldMonitor,
|
||||
qualityProfileId,
|
||||
rootFolderPath,
|
||||
tags,
|
||||
fields
|
||||
} = item;
|
||||
|
||||
@ -136,6 +137,18 @@ function EditNetImportModalContent(props) {
|
||||
/>
|
||||
</FormGroup>
|
||||
|
||||
<FormGroup>
|
||||
<FormLabel>Radarr Tags</FormLabel>
|
||||
|
||||
<FormInputGroup
|
||||
type={inputTypes.TAG}
|
||||
name="tags"
|
||||
helpText="Add movie from this list with these tags"
|
||||
{...tags}
|
||||
onChange={onInputChange}
|
||||
/>
|
||||
</FormGroup>
|
||||
|
||||
{
|
||||
fields.map((field) => {
|
||||
return (
|
||||
|
@ -20,6 +20,7 @@ function TagDetailsModalContent(props) {
|
||||
delayProfiles,
|
||||
notifications,
|
||||
restrictions,
|
||||
netImports,
|
||||
onModalClose,
|
||||
onDeleteTagPress
|
||||
} = props;
|
||||
@ -140,6 +141,21 @@ function TagDetailsModalContent(props) {
|
||||
}
|
||||
</FieldSet>
|
||||
}
|
||||
|
||||
{
|
||||
!!netImports.length &&
|
||||
<FieldSet legend="Lists">
|
||||
{
|
||||
netImports.map((item) => {
|
||||
return (
|
||||
<div key={item.id}>
|
||||
{item.name}
|
||||
</div>
|
||||
);
|
||||
})
|
||||
}
|
||||
</FieldSet>
|
||||
}
|
||||
</ModalBody>
|
||||
|
||||
<ModalFooter>
|
||||
@ -172,6 +188,7 @@ TagDetailsModalContent.propTypes = {
|
||||
delayProfiles: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
notifications: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
restrictions: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
netImports: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
onModalClose: PropTypes.func.isRequired,
|
||||
onDeleteTagPress: PropTypes.func.isRequired
|
||||
};
|
||||
|
@ -41,18 +41,28 @@ function createMatchingRestrictionsSelector() {
|
||||
);
|
||||
}
|
||||
|
||||
function createMatchingNetImportsSelector() {
|
||||
return createSelector(
|
||||
(state, { netImportIds }) => netImportIds,
|
||||
(state) => state.settings.netImports.items,
|
||||
findMatchingItems
|
||||
);
|
||||
}
|
||||
|
||||
function createMapStateToProps() {
|
||||
return createSelector(
|
||||
createMatchingMovieSelector(),
|
||||
createMatchingDelayProfilesSelector(),
|
||||
createMatchingNotificationsSelector(),
|
||||
createMatchingRestrictionsSelector(),
|
||||
(movies, delayProfiles, notifications, restrictions) => {
|
||||
createMatchingNetImportsSelector(),
|
||||
(movies, delayProfiles, notifications, restrictions, netImports) => {
|
||||
return {
|
||||
movies,
|
||||
delayProfiles,
|
||||
notifications,
|
||||
restrictions
|
||||
restrictions,
|
||||
netImports
|
||||
};
|
||||
}
|
||||
);
|
||||
|
@ -55,6 +55,7 @@ class Tag extends Component {
|
||||
delayProfileIds,
|
||||
notificationIds,
|
||||
restrictionIds,
|
||||
netImportIds,
|
||||
movieIds
|
||||
} = this.props;
|
||||
|
||||
@ -67,6 +68,7 @@ class Tag extends Component {
|
||||
delayProfileIds.length ||
|
||||
notificationIds.length ||
|
||||
restrictionIds.length ||
|
||||
netImportIds.length ||
|
||||
movieIds.length
|
||||
);
|
||||
|
||||
@ -110,6 +112,13 @@ class Tag extends Component {
|
||||
{restrictionIds.length} restriction{restrictionIds.length > 1 && 's'}
|
||||
</div>
|
||||
}
|
||||
|
||||
{
|
||||
!!netImportIds.length &&
|
||||
<div>
|
||||
{netImportIds.length} list{netImportIds.length > 1 && 's'}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
@ -127,6 +136,7 @@ class Tag extends Component {
|
||||
delayProfileIds={delayProfileIds}
|
||||
notificationIds={notificationIds}
|
||||
restrictionIds={restrictionIds}
|
||||
netImportIds={netImportIds}
|
||||
isOpen={isDetailsModalOpen}
|
||||
onModalClose={this.onDetailsModalClose}
|
||||
onDeleteTagPress={this.onDeleteTagPress}
|
||||
@ -152,6 +162,7 @@ Tag.propTypes = {
|
||||
delayProfileIds: PropTypes.arrayOf(PropTypes.number).isRequired,
|
||||
notificationIds: PropTypes.arrayOf(PropTypes.number).isRequired,
|
||||
restrictionIds: PropTypes.arrayOf(PropTypes.number).isRequired,
|
||||
netImportIds: PropTypes.arrayOf(PropTypes.number).isRequired,
|
||||
movieIds: PropTypes.arrayOf(PropTypes.number).isRequired,
|
||||
onConfirmDeleteTag: PropTypes.func.isRequired
|
||||
};
|
||||
@ -160,6 +171,7 @@ Tag.defaultProps = {
|
||||
delayProfileIds: [],
|
||||
notificationIds: [],
|
||||
restrictionIds: [],
|
||||
netImportIds: [],
|
||||
movieIds: []
|
||||
};
|
||||
|
||||
|
@ -3,7 +3,7 @@ import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import { fetchTagDetails } from 'Store/Actions/tagActions';
|
||||
import { fetchDelayProfiles, fetchNotifications, fetchRestrictions } from 'Store/Actions/settingsActions';
|
||||
import { fetchDelayProfiles, fetchNotifications, fetchRestrictions, fetchNetImports } from 'Store/Actions/settingsActions';
|
||||
import Tags from './Tags';
|
||||
|
||||
function createMapStateToProps() {
|
||||
@ -28,7 +28,8 @@ const mapDispatchToProps = {
|
||||
dispatchFetchTagDetails: fetchTagDetails,
|
||||
dispatchFetchDelayProfiles: fetchDelayProfiles,
|
||||
dispatchFetchNotifications: fetchNotifications,
|
||||
dispatchFetchRestrictions: fetchRestrictions
|
||||
dispatchFetchRestrictions: fetchRestrictions,
|
||||
dispatchFetchNetImports: fetchNetImports
|
||||
};
|
||||
|
||||
class MetadatasConnector extends Component {
|
||||
@ -41,13 +42,15 @@ class MetadatasConnector extends Component {
|
||||
dispatchFetchTagDetails,
|
||||
dispatchFetchDelayProfiles,
|
||||
dispatchFetchNotifications,
|
||||
dispatchFetchRestrictions
|
||||
dispatchFetchRestrictions,
|
||||
dispatchFetchNetImports
|
||||
} = this.props;
|
||||
|
||||
dispatchFetchTagDetails();
|
||||
dispatchFetchDelayProfiles();
|
||||
dispatchFetchNotifications();
|
||||
dispatchFetchRestrictions();
|
||||
dispatchFetchNetImports();
|
||||
}
|
||||
|
||||
//
|
||||
@ -66,7 +69,8 @@ MetadatasConnector.propTypes = {
|
||||
dispatchFetchTagDetails: PropTypes.func.isRequired,
|
||||
dispatchFetchDelayProfiles: PropTypes.func.isRequired,
|
||||
dispatchFetchNotifications: PropTypes.func.isRequired,
|
||||
dispatchFetchRestrictions: PropTypes.func.isRequired
|
||||
dispatchFetchRestrictions: PropTypes.func.isRequired,
|
||||
dispatchFetchNetImports: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default connect(createMapStateToProps, mapDispatchToProps)(MetadatasConnector);
|
||||
|
@ -67,7 +67,6 @@ public static void Map()
|
||||
|
||||
Mapper.Entity<NetImportDefinition>().RegisterDefinition("NetImport")
|
||||
.Ignore(i => i.Enable)
|
||||
.Ignore(d => d.Tags)
|
||||
.Relationship()
|
||||
.HasOne(n => n.Profile, n => n.ProfileId);
|
||||
|
||||
|
@ -10,6 +10,7 @@ public class TagDetails : ModelBase
|
||||
public List<int> MovieIds { get; set; }
|
||||
public List<int> NotificationIds { get; set; }
|
||||
public List<int> RestrictionIds { get; set; }
|
||||
public List<int> NetImportIds { get; set; }
|
||||
public List<int> DelayProfileIds { get; set; }
|
||||
|
||||
public bool InUse
|
||||
|
@ -7,6 +7,7 @@
|
||||
using NzbDrone.Core.Profiles.Delay;
|
||||
using NzbDrone.Core.Restrictions;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.NetImport;
|
||||
|
||||
namespace NzbDrone.Core.Tags
|
||||
{
|
||||
@ -28,6 +29,7 @@ public class TagService : ITagService
|
||||
private readonly ITagRepository _repo;
|
||||
private readonly IEventAggregator _eventAggregator;
|
||||
private readonly IDelayProfileService _delayProfileService;
|
||||
private readonly INetImportFactory _netImportFactory;
|
||||
private readonly INotificationFactory _notificationFactory;
|
||||
private readonly IRestrictionService _restrictionService;
|
||||
private readonly IMovieService _movieService;
|
||||
@ -35,6 +37,7 @@ public class TagService : ITagService
|
||||
public TagService(ITagRepository repo,
|
||||
IEventAggregator eventAggregator,
|
||||
IDelayProfileService delayProfileService,
|
||||
INetImportFactory netImportFactory,
|
||||
INotificationFactory notificationFactory,
|
||||
IRestrictionService restrictionService,
|
||||
IMovieService movieService)
|
||||
@ -42,6 +45,7 @@ public TagService(ITagRepository repo,
|
||||
_repo = repo;
|
||||
_eventAggregator = eventAggregator;
|
||||
_delayProfileService = delayProfileService;
|
||||
_netImportFactory = netImportFactory;
|
||||
_notificationFactory = notificationFactory;
|
||||
_restrictionService = restrictionService;
|
||||
_movieService = movieService;
|
||||
@ -73,6 +77,7 @@ public TagDetails Details(int tagId)
|
||||
{
|
||||
var tag = GetTag(tagId);
|
||||
var delayProfiles = _delayProfileService.AllForTag(tagId);
|
||||
var netImports = _netImportFactory.AllForTag(tagId);
|
||||
var notifications = _notificationFactory.AllForTag(tagId);
|
||||
var restrictions = _restrictionService.AllForTag(tagId);
|
||||
var movies = _movieService.AllForTag(tagId);
|
||||
@ -82,6 +87,7 @@ public TagDetails Details(int tagId)
|
||||
Id = tagId,
|
||||
Label = tag.Label,
|
||||
DelayProfileIds = delayProfiles.Select(c => c.Id).ToList(),
|
||||
NetImportIds = netImports.Select(c => c.Id).ToList(),
|
||||
NotificationIds = notifications.Select(c => c.Id).ToList(),
|
||||
RestrictionIds = restrictions.Select(c => c.Id).ToList(),
|
||||
MovieIds = movies.Select(c => c.Id).ToList()
|
||||
@ -92,6 +98,7 @@ public List<TagDetails> Details()
|
||||
{
|
||||
var tags = All();
|
||||
var delayProfiles = _delayProfileService.All();
|
||||
var netImports = _netImportFactory.All();
|
||||
var notifications = _notificationFactory.All();
|
||||
var restrictions = _restrictionService.All();
|
||||
var movies = _movieService.GetAllMovies();
|
||||
@ -105,6 +112,7 @@ public List<TagDetails> Details()
|
||||
Id = tag.Id,
|
||||
Label = tag.Label,
|
||||
DelayProfileIds = delayProfiles.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
||||
NetImportIds = netImports.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
||||
NotificationIds = notifications.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
||||
RestrictionIds = restrictions.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
||||
MovieIds = movies.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList()
|
||||
|
@ -11,6 +11,7 @@ public class TagDetailsResource : RestResource
|
||||
public List<int> DelayProfileIds { get; set; }
|
||||
public List<int> NotificationIds { get; set; }
|
||||
public List<int> RestrictionIds { get; set; }
|
||||
public List<int> NetImportIds { get; set; }
|
||||
public List<int> MovieIds { get; set; }
|
||||
}
|
||||
|
||||
@ -27,6 +28,7 @@ public static TagDetailsResource ToResource(this TagDetails model)
|
||||
DelayProfileIds = model.DelayProfileIds,
|
||||
NotificationIds = model.NotificationIds,
|
||||
RestrictionIds = model.RestrictionIds,
|
||||
NetImportIds = model.NetImportIds,
|
||||
MovieIds = model.MovieIds
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user