mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Fixed: Prevent loss of restrictions when attempting to edit multiple restrictions at once
(cherry picked from commit b16094a9e3153f2ac39800475c1ddb1dafb6ab34) Closes #8231
This commit is contained in:
parent
9d3e7f62ca
commit
45f5ce5f29
@ -76,9 +76,15 @@ class TagInput extends Component {
|
|||||||
// Listeners
|
// Listeners
|
||||||
|
|
||||||
onTagEdit = ({ value, ...otherProps }) => {
|
onTagEdit = ({ value, ...otherProps }) => {
|
||||||
this.setState({ value });
|
const currentValue = this.state.value;
|
||||||
|
|
||||||
this.props.onTagDelete(otherProps);
|
if (currentValue && this.props.onTagReplace) {
|
||||||
|
this.props.onTagReplace(otherProps, { name: currentValue });
|
||||||
|
} else {
|
||||||
|
this.props.onTagDelete(otherProps);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({ value });
|
||||||
};
|
};
|
||||||
|
|
||||||
onInputContainerPress = () => {
|
onInputContainerPress = () => {
|
||||||
@ -232,7 +238,7 @@ class TagInput extends Component {
|
|||||||
<AutoSuggestInput
|
<AutoSuggestInput
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
forwardedRef={this._setAutosuggestRef}
|
forwardedRef={this._setAutosuggestRef}
|
||||||
className={styles.internalInput}
|
className={className}
|
||||||
inputContainerClassName={classNames(
|
inputContainerClassName={classNames(
|
||||||
inputContainerClassName,
|
inputContainerClassName,
|
||||||
isFocused && styles.isFocused
|
isFocused && styles.isFocused
|
||||||
@ -272,7 +278,8 @@ TagInput.propTypes = {
|
|||||||
hasWarning: PropTypes.bool,
|
hasWarning: PropTypes.bool,
|
||||||
tagComponent: PropTypes.elementType.isRequired,
|
tagComponent: PropTypes.elementType.isRequired,
|
||||||
onTagAdd: PropTypes.func.isRequired,
|
onTagAdd: PropTypes.func.isRequired,
|
||||||
onTagDelete: PropTypes.func.isRequired
|
onTagDelete: PropTypes.func.isRequired,
|
||||||
|
onTagReplace: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
TagInput.defaultProps = {
|
TagInput.defaultProps = {
|
||||||
|
@ -138,6 +138,7 @@ class TagInputConnector extends Component {
|
|||||||
<TagInput
|
<TagInput
|
||||||
onTagAdd={this.onTagAdd}
|
onTagAdd={this.onTagAdd}
|
||||||
onTagDelete={this.onTagDelete}
|
onTagDelete={this.onTagDelete}
|
||||||
|
onTagReplace={this.onTagReplace}
|
||||||
{...this.props}
|
{...this.props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -71,6 +71,20 @@ class TextTagInputConnector extends Component {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onTagReplace = (tagToReplace, newTag) => {
|
||||||
|
const {
|
||||||
|
name,
|
||||||
|
valueArray,
|
||||||
|
onChange
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
const newValue = [...valueArray];
|
||||||
|
newValue.splice(tagToReplace.index, 1);
|
||||||
|
newValue.push(newTag.name.trim());
|
||||||
|
|
||||||
|
onChange({ name, value: newValue });
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Render
|
// Render
|
||||||
|
|
||||||
@ -80,6 +94,7 @@ class TextTagInputConnector extends Component {
|
|||||||
tagList={[]}
|
tagList={[]}
|
||||||
onTagAdd={this.onTagAdd}
|
onTagAdd={this.onTagAdd}
|
||||||
onTagDelete={this.onTagDelete}
|
onTagDelete={this.onTagDelete}
|
||||||
|
onTagReplace={this.onTagReplace}
|
||||||
{...this.props}
|
{...this.props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -3,3 +3,9 @@
|
|||||||
|
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tagInternalInput {
|
||||||
|
composes: internalInput from '~Components/Form/TagInput.css';
|
||||||
|
|
||||||
|
flex: 0 0 100%;
|
||||||
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Please do not change this file!
|
// Please do not change this file!
|
||||||
interface CssExports {
|
interface CssExports {
|
||||||
'deleteButton': string;
|
'deleteButton': string;
|
||||||
|
'tagInternalInput': string;
|
||||||
}
|
}
|
||||||
export const cssExports: CssExports;
|
export const cssExports: CssExports;
|
||||||
export default cssExports;
|
export default cssExports;
|
||||||
|
@ -48,6 +48,7 @@ function EditRestrictionModalContent(props) {
|
|||||||
|
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
{...required}
|
{...required}
|
||||||
|
inputClassName={styles.tagInternalInput}
|
||||||
type={inputTypes.TEXT_TAG}
|
type={inputTypes.TEXT_TAG}
|
||||||
name="required"
|
name="required"
|
||||||
helpText={translate('RequiredRestrictionHelpText')}
|
helpText={translate('RequiredRestrictionHelpText')}
|
||||||
@ -63,6 +64,7 @@ function EditRestrictionModalContent(props) {
|
|||||||
|
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
{...ignored}
|
{...ignored}
|
||||||
|
inputClassName={styles.tagInternalInput}
|
||||||
type={inputTypes.TEXT_TAG}
|
type={inputTypes.TEXT_TAG}
|
||||||
name="ignored"
|
name="ignored"
|
||||||
helpText={translate('IgnoredHelpText')}
|
helpText={translate('IgnoredHelpText')}
|
||||||
|
Loading…
Reference in New Issue
Block a user