Fixed: List Tags and Prevent Delete of Tag if on List

This commit is contained in:
Qstick
2019-11-01 21:31:47 -04:00
parent 816905a506
commit c08ae534c5
9 changed files with 73 additions and 7 deletions

View File

@@ -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 (

View File

@@ -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
};

View File

@@ -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
};
}
);

View File

@@ -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: []
};

View File

@@ -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);